Sunday, January 24, 2016

Executing sql script to run in background


lvpu7:/opt/oraprd # cat rebuild_index.sh
#!/bin/ksh
sqlplus "/ as sysdba" << EOF
@/opt/oraprd/rebulid.sql
exit;
EOF


lvpu7:/opt/oraprd # cat rebulid.sql
spool index_rebuild.log

set echo on time on timing on

alter index ELCC.CK_CLIENT_MEMBER_ID rebuild nologging;
alter index ELCC.CLGDR_X1 rebuild nologging;
alter index ELCC.CLNT_CONFIDENCE_SCORE rebuild nologging;

spool off


nohup sh rebuild_index.sh &

==================


#!/bin/ksh
sqlplus <<-eof o:p="">
/ as sysdba
set echo on timing on
exec dbms_stats.gather_schema_stats(ownname=>'CASHPOOL',options=>'gather auto',estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE,degree=>6);
EOF

nohup sh gather.sh &


No comments: