Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: identify CTAS from v$ tables
Thanks.
Am still not getting the Sql
SQL> select sid from v$session where command = 1;
SID
28
SQL> select sql_text from v$sqltext t1, v$session t2
where t2.sid = &sid
and t1.address = t2.sql_address
order by t1.piece 2 3 4
5 /
Enter value for sid: 28
old 2: where t2.sid = &sid
new 2: where t2.sid = 28
no rows selected
regards
Joseph
"Baumgartel, Paul" <paul.baumgartel_at_credit-suisse.com> wrote: I meant, of course, to say v$sqltext.
Paul Baumgartel
CREDIT SUISSE
Information Technology
DBA & Admin - NY, KIGA 1
11 Madison Avenue
New York, NY 10010
USA
Phone 212.538.1143
paul.baumgartel_at_credit-suisse.com
www.credit-suisse.com
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Baumgartel, Paul
Sent: Tuesday, April 25, 2006 12:55 PM
To: oracle-l_at_freelists.org
Subject: RE: identify CTAS from v$ tables
And if you are on 9i and want the full text, you can query v$sql, which contains the full sql text in pieces:
select sql_text from v$sqltext t1, v$session t2 where t2.sid = &sid and t1.address = t2.sql_address order by t1.piece
Paul Baumgartel
CREDIT SUISSE
Information Technology
DBA & Admin - NY, KIGA 1
11 Madison Avenue
New York, NY 10010
USA
Phone 212.538.1143
paul.baumgartel_at_credit-suisse.com
www.credit-suisse.com
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Christian Antognini
Sent: Tuesday, April 25, 2006 12:48 PM
To: Joseph Amalraj
Cc: oracle-l_at_freelists.org
Subject: RE: identify CTAS from v$ tables
Joseph
>I need to know the sql being run by the session.
This is another question ;-) Then use the following query:
select sql_text from v$sql where command_type = 1
Be careful that SQL_TEXT is a VARCHAR2(1000). If the statement is longer you should use SQL_FULLTEXT which is a LOB (10g only).
HTH
Chris
-- http://www.freelists.org/webpage/oracle-l ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== -- http://www.freelists.org/webpage/oracle-l ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Tue Apr 25 2006 - 12:02:49 CDT