RE: identify CTAS from v$ tables

  • From: Joseph Amalraj <joseph@xxxxxxxxxxxxxx>
  • To: paul.baumgartel@xxxxxxxxxxxxxxxxx, oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 25 Apr 2006 10:02:49 -0700 (PDT)

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@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
www.credit-suisse.com



-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Baumgartel, Paul
Sent: Tuesday, April 25, 2006 12:55 PM
To: oracle-l@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxx
www.credit-suisse.com



-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Christian Antognini
Sent: Tuesday, April 25, 2006 12:48 PM
To: Joseph Amalraj
Cc: oracle-l@xxxxxxxxxxxxx
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

--
//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
==============================================================================

--
//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
==============================================================================

--
//www.freelists.org/webpage/oracle-l



Other related posts: