stackpack
- Get all snapshot
select * from STATS$snapshot;
Check database instance
1
2select * from STATS$DATABASE_INSTANCE; – in case database restarted, an error will be thrown as ORA-20200: The instance was shutdown between snapshots 981 and 982
select * from v$instance;Run stackpack
1
2
3
4sqlplus perfstat/password@“(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xxrac)))”
@$ORACLE_HOME/rdbms/admin/spreport.sql
OR
@?/rdbms/admin/spreport.sqlPurge stackpack
1
2
3@$ORACLE_HOME/rdbms/admin/sppurge.sql
OR
@?/rdbms/admin/sppurge.sqlOracle jobs
1
2
3select * from user_jobs; SELECT job, next_date, next_sec, failures, broken, SUBSTR(what,1,40) DESCRIPTION FROM dba_jobs;
EXEC dbms_job.broken(24, false);
EXEC dbms_job.run(24, false); – reset job when failure 16 attemps to runOracle job for schedule run sppurge
——————– Check the snap present before 20 days ——————–
1 | select count(*) from stats$snapshot where snap_time < sysdate-20 |
——————– check the job already exits in the database ——————–
1 | SELECT job, next_date, next_sec, failures, broken, SUBSTR(what,1,40) DESCRIPTION FROM dba_jobs; |
——————– scheduled the job at mid night ——————–
1 | declare |
————– Another way———————————————————-
1 | variable v_jobno number; |
- Reference
Stackpack
http://www.oracle-base.com/articles/8i/statspack-8i.php
http://docs.oracle.com/cd/B10500_01/server.920/a96533/statspac.htm
Oracle job
http://www.orafaq.com/wiki/DBMS_JOB
http://www.dba-oracle.com/tips_oracle_statspack_purge_utility.htm
http://myoracleworld.hobby-electronics.net/DB-statspack.html
http://dbaworks-sunny.blogspot.hk/2012/12/statspack-purge-script-for-scheduling.html
http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_job.htm#i1000769