Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

query to find out the sessions trying to create table.

591183Nov 30 2007 — edited Nov 30 2007
Hi Folks,

I wanted to know the sessions that are trying to create tables. I'm trying to use the query... but not getting the correct results...

These are the three versions of queries i wrote..

SELECT A.SID,A.USERNAME,A.SQL_ID,B.SQL_TEXT FROM V$SESSION A,V$SQLTEXT B
WHERE A.STATUS='ACTIVE'
AND A.SQL_ID=B.SQL_ID
AND B.SQL_TEXT LIKE '%INSERT%' OR B.SQL_TEXT LIKE '%insert%'


SELECT A.SID,A.USERNAME,A.SQL_ID,B.SQL_TEXT FROM V$SESSION A,V$SQLTEXT B
WHERE A.SID IN (SELECT SID FROM V$SESSION WHERE STATUS='ACTIVE')
AND A.SQL_ID=B.SQL_ID
AND B.SQL_TEXT LIKE '%INSERT%' OR B.SQL_TEXT LIKE '%insert%'


select sid, serial#, status, username, osuser,machine,sql_id from v$session
where sql_id in (select sql_id from v$sqltext where SQL_TEXT like '%INSERT%'
union
select sql_id from v$sqltext where SQL_TEXT like '%insert%')

But its not giving me the correct results. Can any one help me with a query to determine a way to catch the sessions trying to create tables.

Thanks
Karthik
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2007
Added on Nov 30 2007
8 comments
1,644 views