Posts

Showing posts from November, 2021

top sessions

 http://db.geeksinsight.com/tools-scripts/ REF: set pagesize 100 set linesize 250 col INSTANCE_NUMBER format 99 col SESSION_ID format 99999 col BLOCKING_INST_ID format 99 col event format a20 col WAIT_CLASS format a15 col PROGRAM format a20 col MODULE format a16 col p3 format 99999999999999999999 select sql_id,to_char(SAMPLE_TIME,'YYYYMMDD-HH24:MI:SS'),        INSTANCE_NUMBER,SESSION_ID,PROGRAM,MODULE,EVENT,        CURRENT_OBJ#,WAIT_CLASS,BLOCKING_INST_ID,        BLOCKING_SESSION, p3 from dba_hist_active_sess_history where INSTANCE_NUMBER= 3  and SESSION_ID = 2437  and sample_time between to_date('16-06-18 11:00:00','DD-MM-YY HH24:MI:SS') and to_date('16-06-18 11:04:00','DD-MM-YY HH24:MI:SS') and event ='library cache lock' order by sample_id; col USERNAME for a10 col machine for a30 col Text for a50 wrap on select  se.SID, ss.serial#,  ss.username,   ss.machine,  ss.sql_id,  to_char...

Gather stats on the table

  col TABLE_NAME for a30 col PARTITION_NAME for a20 col SUBPARTITION_NAME for a20 select OWNER,TABLE_NAME,PARTITION_NAME,SUBPARTITION_NAME,NUM_ROWS,LAST_ANALYZED from DBA_TAB_STATISTICS where STALE_STATS='YES'; OR select OWNER,TABLE_NAME,LAST_ANALYZED,STALE_STATS from DBA_TAB_STATISTICS where OWNER='&OWNER' AND STALE_STATS='YES'; set linesize 200 trimspool on set pagesize 100 set pause off echo off verify off set head on term on col begin_interval_time format a30 col min_sess_per_day format 99 , 999 head ' MIN|SESS|PER|DAY ' col max_sess_per_day format 99 , 999 head ' MAX|SESS|PER|DAY ' col avg_sess_per_day format 99 , 999 head ' AVG|SESS|PER|DAY ' col min_proc_per_day format 99 , 999 head ' MIN|PROC|PER|DAY ' col max_proc_per_day format 99 , 999 head ' MAX|PROC|PER|DAY ' col avg_proc_per_day format 99 , 999 head ' AVG|PROC|PER|DAY ' with processes as ( select snap_id, CURRENT_UTILIZATION p...