Description:
Below script can be used for Analyze Whole Database.
Script:
#!/bin/sh
. .profile
# Print Start Time
startTime=`date`
echo
echo "Starting Time $startTime"
Analyze1=/tmp/analyze.tmp
sqlplus -s system/manager << ! > $Analyze1
set pagesize 0
set feedback off
select 'analyze table', owner||'.'||table_name||
' estimate statistics;'
from dba_tables
where owner not in ('SYSTEM','SYS');
!
sqlplus -s system/manager << !
set feedback off
set pagesize 0
set echo on
set time on
set timing on
@$Analyze1
exit
!
# Print End Time
endTime=`date`
echo
echo "Analyze Schema Successfully Completed"
echo "Ending Time $endTime"
No comments:
Post a Comment