Friday, May 21, 2021

Oracle Statspack Installation / Re-Creation

We all must be thinking in this era of  21c why we need statspack. However for some non critical database where we dont  have license of tuning pack . Hence we need to survive on  statspack 


1)    take export  backup of  exiting perftstat user 

2) Drop  statspack  
@?/rdbms/admin/spdrop.sql

3) create stastpack 
@?/rdbms/admin/spcreate.sql

4)  Change  stastpack snap level to level 6 
BEGIN
  statspack.modify_statspack_parameter(i_snap_level=>6, i_modify_parameter=>'true');
END;
/

select SNAP_ID, SNAP_LEVEL from STATS$SNAPSHOT;


5) try manual snap 
exec PERFSTAT.statspack.snap;


6)  Schedule  statspack auto jobs for statspack snap   ( note job id) 
@?/rdbms/admin/spauto.sql



7)  Change  snap interval to 30 min 

alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
  set lines 180
  col SCHEMA_USER for a20
  col INTERVAL for a30
 col WHAT for a30
 select JOB, SCHEMA_USER, INTERVAL, BROKEN, WHAT from dba_jobs where JOB=428;

execute dbms_job.interval(428,'sysdate+(1/48)');

alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
  set lines 180
  col SCHEMA_USER for a20
  col INTERVAL for a30
 col WHAT for a30
 select JOB, SCHEMA_USER, INTERVAL, BROKEN, WHAT , to_char(next_date ,'DD-MON-YYYY:HH24:MI:SS')      "next date"  , failures   from dba_jobs where JOB=428;

select name,snap_id,to_char(snap_time,'DD-MON-YYYY:HH24:MI:SS')      "Date/Time" from stats$snapshot,v$database;


8)  after  30  minutes verify snap interval working fine with 30 min and level 6 

@?/rdbms/admin/spreport.sql





No comments:

Post a Comment