Quote:
Originally Posted by gauravgoel
the thing is it seems loke a homework problem, otherwise would have deinitely helped you
ok atleast post what have u tried so far
Ok thanks.. Definitely not home work.. I am working and this is what i wrote
runsql_analyze_db() {
echo "I am in runsql_analyze_db and the parameter is $1"
statement=$1
echo " The process id in SQL is $$"
echoLog "$statement started at `date`"
sqlResult=`$BINDIR/sqlplus -s <<SQL
######/#######
WHENEVER SQLERROR exit 10
set feedback off
set heading off
set pagesize 100
exec dbms_stats.gather_table_stats($statement
exit
SQL
`
echo "SQL RESULT is $sqlResult"
echoLog "Completed at `date`"
checkORA "$sqlResult" $2
}
submit()
{
chk_process=1
stmt1="update analyze_table set status = NULL;"
echo " The process id in submit is $$"
echo "Now i am in submit"
for collect_stat in `$BINDIR/sqlplus -s <<EOF
xchtbl/xchtblint3
set heading off
set feedback off
set linesize 132
set pagesize 100
select 'ownname=>''' || owner
||''',tabname=>''' || table_name
||''',granularity=>''' || granularity
||''',cascade=>' || cascade
||',method_opt=>''' || NVL(method_opt,'''')
||');'
from analyze_table;
exit
EOF
`
do
I am planning to take the table name from above and fetch rest of the records in the SQL plus to analyze a table. I am running out of ideas.
Thanks