0% found this document useful (0 votes)
38 views1 page

Bad Plan Issue

The document contains SQL statements to: 1. Query the V$SQL view to find INSERT statements for a specific table and purge related entries from the shared pool. 2. Check the number of sessions and status for a specific user and kill inactive sessions for that user. 3. Purge entries from the shared pool again. 4. Query the DBA_AUDIT_SESSION view to view recent audit records for sessions.

Uploaded by

Vikas Gaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Bad Plan Issue

The document contains SQL statements to: 1. Query the V$SQL view to find INSERT statements for a specific table and purge related entries from the shared pool. 2. Check the number of sessions and status for a specific user and kill inactive sessions for that user. 3. Purge entries from the shared pool again. 4. Query the DBA_AUDIT_SESSION view to view recent audit records for sessions.

Uploaded by

Vikas Gaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

select SQL_ID, CHILD_NUMBER,EXECUTIONS, BUFFER_GETS, IS_BIND_SENSITIVE, IS_BIND_ AWARE, IS_SHAREABLE, PLAN_HASH_VALUE, HASH_VALUE, ADDRESS from v$sql where sql_t

ext like 'INSERT INTO PROD_SPLY%'; EXEC SYS.DBMS_SHARED_POOL.PURGE('&ADDRESS,&HASH_VALUE','c'); SELECT COUNT(*) , USERNAME, STATUS FROM V$SESSION WHERE USERNAME='XRXCOM' GROUP BY USERNAME, STATUS; select ' alter system kill session ''' ||SID|| ',' ||SERIAL#|| ''' immediate;' f rom v$session where username ='XRXCOM' and status='INACTIVE';

begin for y in ( select Sid, Serial#, machine, program from v$session where username ='XRXCOM' ) loop execute immediate 'Alter System Kill Session '''|| y.Sid || ',' || y.Serial# || ''' I MEDIATE'; end loop; end; /

EXEC SYS.DBMS_SHARED_POOL.PURGE('&ADDRESS,&HASH_VALUE','c');

SELECT TO_CHAR(TIMESTAMP,'MM/DD HH24:MI') TIMESTAMP, SUBSTR(OS_USERNAME,1,20) OS_USERNAME, SUBSTR(USERNAME,1,20) USERNAME, SUBSTR(TERMINAL,1,20) TERMINAL, ACTION_NAME, RETURNCODE FROM SYS.DBA_AUDIT_SESSION WHERE TIMESTAMP BETWEEN SYSDATE-8 AND SYSDATE ORDER BY TIMESTAMP DESC;

You might also like