SQL_FULLTEXT Column of v$sqlarea

All,
What do I need to do so that the full text stored in sql_fulltext column of v$sqlarea is displayed.
At the moment, when I run the following sql:
select SQL_FULLTEXT from v$sqlarea
where sql_id='0n6x4f5kaaymb';
I get the output below:
SQL_FULLTEXT
SELECT INSTALLED_APP_ID, ORIGINATED_DATE, APPLICATION_ID, RECEIVED_DATE, EFFECTI
Thanks in advance
Baffy

SQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
SQL> set long 999999999
SQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
GO.OBJ# AND GO.NAME = 'LOG_HISTORY'

Similar Messages

  • What's unit of CPU_TIME & ELAPSED_TIME columns in v$sqlarea

    Hi,
    Oracle 9.2.0.4 on Solaris 9.
    What is the time unit of CPU_TIME & ELAPSED_TIME columns in v$sqlarea?
    The Database Reference says it is in microseconds (1/1000 seconds?).
    My java code would get the query result even before the database engine finishes parsing the query string. Either the doc is wrong, or the data in the v$sqlarea is not right.
    It seems to me that the unit should be 1/1000000 seconds.
    Anybody knows what the unit really is in those columns?
    Thanks,
    Harry

    Anyone any idea by what logic "10s of milliseconds" can translate to .000001 seconds?
    I can see how it could mean .01 seconds (10 times a millisecond) or .0001 seconds (a tenth of a millisecond), but .000001 seconds seems a long way off.
    Would you remember where you found those numbers?

  • Reg: Rows_Processed column in v$SQLAREA

    Hi all,
    I had a request to check the rows processed while an insert statement is running in the database.
    Can anyone clarify me on this from v$sqlarea (rows_processed) is it possible to get the rows processed till that time.
    As i am in thinking that it depends on how application has commit transactions.
    Can any one throw some light on this request...
    Thanks in advance...
    Satya G

    Hi,
    Rows_processed column of v$sql gives the count of total rows that has been processed whether it is committed or not committed. It gives the sum of rows processed by the query even if some of the transaction has been rollbacked.
    I suppose you are looking for USED_UREC in v$transaction.
    Regards
    Anurag

  • Which user/schema executed query in V$SQLAREA

    I am looking on one row/query in view "V$SQLAREA" and want to which user/schema was used to log in to the database when that one query was executed. How i can get that schema name?
    Should i look this column maybe:
    V$SQLAREA
    PARSING_SCHEMA_NAME             VARCHAR2(30)      Schema name that was used to parse this child cursor( http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2129.htm )
    I have Java software that uses different database schemas/users to make connections to my database. And i want to know for one query which schema/user was used to connect to database before running the query.
    I think i need to join "V$SQLAREA" to view V$SESSION and there the column "USERNAME" tells me the connection user name for the executed query.
    V$SESSION
    USERNAME      VARCHAR2(30)      Oracle username
    ( http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2088.htm )Seems like i fail to join "V$SQLAREA" to view V$SESSION:
    select q.SQL_TEXT, q.sql_id, q.PARSING_SCHEMA_NAME, q.ADDRESS, q.last_active_time, s.USERNAME, s.SCHEMANAME from v$sqlarea q, v$session s
    where q.last_active_time > sysdate - 1
    and q.sql_text like 'DELETE FROM casino.lgngameoperationlog WHERE sessionCode%'
    and s.sql_address=q.address
    order by last_active_time desc
    no rows found
    select q.SQL_TEXT, q.sql_id, q.PARSING_SCHEMA_NAME, q.ADDRESS, q.last_active_time from v$sqlarea q
    where q.last_active_time > sysdate - 1
    and q.sql_text like 'DELETE FROM casino.lgngameoperationlog WHERE sessionCode%'
    order by last_active_time desc
    'DELETE FROM casino.lgngameoperationlog WHERE sessionCode = :1 and sessionType = :2';     51thfgbubkkg6;     JAVA;     0000000392523658;     28.10.2010 18:09:14;
    */

    I have Java software that uses different database schemas/users to make connections to my database. And i want to know for one query which schema/user was used to connect to database before running the query.If the SQL-text sits inside your Java code, that is the text does not sit inside some stored pl/sql program unit, then you can use parsing_schema_id, yes.
    If the SQL-text sits inside a stored procedure, then depending on how that procedure is defined (invoker rights or definer rights), you could use parsing_schema_id too (in the first case (invoker rights)).

  • V$session and v$sqlarea

    Hi All,
    How can i join the v$session and v$sqlarea? I am trying to find out who has executed the sql statement or still executing the statement. I think without joining with v$session its not possible.
    Is there a way to get this information?
    And I am using Oracle 10g.
    Edited by: Ratna Bikram on Sep 25, 2010 11:45 PM

    Ratna Bikram wrote:
    Hi All,
    How can i join the v$session and v$sqlarea? I am trying to find out who has executed the sql statement or still executing the statement. I think without joining with v$session its not possible.
    Is there a way to get this information?
    And I am using Oracle 10g.
    Edited by: Ratna Bikram on Sep 25, 2010 11:45 PMhttp://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2088.htm#REFRN30223
    SQL_ADDRESS      RAW(4 | 8)      Used with SQL_HASH_VALUE to identify the SQL statement that is currently being executed
    SQL_HASH_VALUE      NUMBER      Used with SQL_ADDRESS to identify the SQL statement that is currently being executed
    SQL_ID      VARCHAR2(13)      SQL identifier of the SQL statement that is currently being executed
    SQL_CHILD_NUMBER      NUMBER      Child number of the SQL statement that is currently being executedFrom V$SESSION will map into the column in V$SQLAREA. There they will lose the SQL_ prefix (so HASH_VALUE and ADDRESS), but SQL_ID stays the same.

  • V$sqlarea and plan_hash_value

    If I have a query with multiple child cursors, I can have more than 1 plan_hash_value for the same sql_id.
    how does oracle decide which plan_hash_value to put into v$sqlarea which is a rollup to the sql_id level?

    Guess2 wrote:
    If I have a query with multiple child cursors, I can have more than 1 plan_hash_value for the same sql_id.
    how does oracle decide which plan_hash_value to put into v$sqlarea which is a rollup to the sql_id level?Let's try a bit of an experiment (in 11.2.0.2) to determine which child cursor's PLAN_HASH_VALUE appears in V$SQLAREA. First, we will create a test table with skewed data:
    CREATE TABLE T1 AS
    SELECT
      ROWNUM C1,
      DECODE(ROWNUM,1,1,0) C2,
      LPAD('A',255,'A') C3
    FROM
      DUAL
    CONNECT BY
      LEVEL<=10000;
    CREATE UNIQUE INDEX IND_T1_C1 ON T1(C1);
    CREATE INDEX IND_T1_C2 ON T1(C2);
    ALTER TABLE T1 MODIFY (C1 NOT NULL, C2 NOT NULL);
    EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=>USER,TABNAME=>'T1',CASCADE=>TRUE,ESTIMATE_PERCENT=>100,METHOD_OPT=>'FOR ALL INDEXED COLUMNS SIZE 254')The initial test:
    SET LINESIZE 120
    SET PAGESIZE 1000
    VARIABLE V1 NUMBER
    EXEC :V1:=1
    SELECT /*+ BIND_AWARE */
      C1,
      C2,
      C3
    FROM
      T1
    WHERE
      C2=:V1;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
    SQL_ID  7p4yxrzwwuybt, child number 0
    SELECT /*+ BIND_AWARE */   C1,   C2,   C3 FROM   T1 WHERE   C2=:V1
    Plan hash value: 236868917
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |           |       |       |     2 (100)|          |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1        |     1 |   136 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IND_T1_C2 |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("C2"=:V1)
    SELECT
      PLAN_HASH_VALUE
    FROM
      V$SQLAREA
    WHERE
      SQL_ID='7p4yxrzwwuybt';
    PLAN_HASH_VALUE
          236868917As shown above, the PLAN_HASH_VALUE was set to 236868917, which is the most recently executed child number.
    Trying again with a different bind variable value:
    EXEC :V1:=0
    SELECT /*+ BIND_AWARE */
      C1,
      C2,
      C3
    FROM
      T1
    WHERE
      C2=:V1;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
    SQL_ID  7p4yxrzwwuybt, child number 1
    SELECT /*+ BIND_AWARE */   C1,   C2,   C3 FROM   T1 WHERE   C2=:V1
    Plan hash value: 3617692013
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |       |       |    33 (100)|          |
    |*  1 |  TABLE ACCESS FULL| T1   |  9999 |  1327K|    33   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("C2"=:V1)
    SELECT
      PLAN_HASH_VALUE
    FROM
      V$SQLAREA
    WHERE
      SQL_ID='7p4yxrzwwuybt';
    PLAN_HASH_VALUE
         3617692013As shown above, the PLAN_HASH_VALUE changed to the value 3617692013, which is the most recently executed child number.
    TRying again without changing the bind variable value:
    SELECT /*+ BIND_AWARE */
      C1,
      C2,
      C3
    FROM
      T1
    WHERE
      C2=:V1;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
    SQL_ID  7p4yxrzwwuybt, child number 1
    SELECT /*+ BIND_AWARE */   C1,   C2,   C3 FROM   T1 WHERE   C2=:V1
    Plan hash value: 3617692013
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |       |       |    33 (100)|          |
    |*  1 |  TABLE ACCESS FULL| T1   |  9999 |  1327K|    33   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("C2"=:V1)
    SELECT
      PLAN_HASH_VALUE
    FROM
      V$SQLAREA
    WHERE
      SQL_ID='7p4yxrzwwuybt';
    PLAN_HASH_VALUE
         3617692013As shown above, the PLAN_HASH_VALUE remained at the value 3617692013, which is the most recently executed child number.
    Switching back to the original bind variable value:
    EXEC :V1:=1
    SELECT /*+ BIND_AWARE */
      C1,
      C2,
      C3
    FROM
      T1
    WHERE
      C2=:V1;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
    SQL_ID  7p4yxrzwwuybt, child number 0
    SELECT /*+ BIND_AWARE */   C1,   C2,   C3 FROM   T1 WHERE   C2=:V1
    Plan hash value: 236868917
    | Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |           |       |       |     2 (100)|          |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1        |     1 |   136 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IND_T1_C2 |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("C2"=:V1)
    SELECT
      PLAN_HASH_VALUE
    FROM
      V$SQLAREA
    WHERE
      SQL_ID='7p4yxrzwwuybt';
    PLAN_HASH_VALUE
          236868917 As shown above, the PLAN_HASH_VALUE switched back to the original value.
    In 11.2.0.2, V$SQLAREA is based on GV$SQLAREA, which is based on the X$KGLCURSOR_CHILD_SQLID structure. You can execute the following SQL statement to show the columns that are retrieved and the corresponding names of those columns in GV$SQLAREA:
    SELECT
      VIEW_DEFINITION
    FROM
      V$FIXED_VIEW_DEFINITION
    WHERE
      VIEW_NAME='GV$SQLAREA';
    DESC GV$SQLAREAWe are able to confirm that the most recently executed child cursor number will appear in V$SQLAREA with the following SQL statement (I suggest not running this on a very busy database instance):
    SET LINESIZE 120
    SET PAGESIZE 1000
    SELECT
      X.KGLOBT03 SQL_ID,
      X.KGLOBT30 PLAN_HASH_VALUE,
      TO_CHAR(X.KGLOBCLA,'HH24:MI:SS') LAST_ACTIVE_TIME,
      S.CHILD_NUMBER,
      S.PLAN_HASH_VALUE S_PLAN_HASH_VALUE,
      TO_CHAR(S.LAST_ACTIVE_TIME,'HH24:MI:SS') S_LAST_ACTIVE_TIME,
      DECODE(X.KGLOBCLA,S.LAST_ACTIVE_TIME,NULL,'DIFFERENT') TIMESTAMP
    FROM
      X$KGLCURSOR_CHILD_SQLID X,
      V$SQL S
    WHERE
      X.KGLOBT02 != 0
      AND X.KGLOBT03=S.SQL_ID
    ORDER BY
      S.SQL_ID,
      S.CHILD_NUMBER;
    SQL_ID        PLAN_HASH_VALUE LAST_ACT CHILD_NUMBER S_PLAN_HASH_VALUE S_LAST_A TIMESTAMP
    fz2htd7p723p5      3775029212 13:01:24            0        3775029212 13:01:24
    fzrshwabvtwc0      3637245398 13:21:28            0        3637245398 13:21:28
    fzt8s1f6kmk5k               0 12:58:30            0                 0 12:58:30
    g00cj285jmgsw       315182377 13:06:24            0         315182377 12:58:30 DIFFERENT
    g00cj285jmgsw       315182377 13:06:24            1         315182377 13:06:24
    g3wrkmxkxzhf2       749386351 13:21:24            0         749386351 13:21:24
    g3wrkmxkxzhf2       749386351 13:21:24            1         749386351 12:51:27 DIFFERENT
    ga9j9xk5cy9s0      1697022209 13:01:24            0        1697022209 13:01:24
    ga9j9xk5cy9s0      1697022209 13:01:24            1        1697022209 12:51:27 DIFFERENT
    grwydz59pu6mc      3684871272 13:21:24            0        3684871272 13:21:24
    grwydz59pu6mc      3684871272 13:21:24            1        3684871272 12:51:27 DIFFERENT
    gx4mv66pvj3xz      2570921597 13:21:24            0        1932954096 12:51:27 DIFFERENT
    gx4mv66pvj3xz      2570921597 13:21:24            1        2570921597 13:21:24
    gzyt498gtbgt5      2826905927 12:51:23            0        2826905927 12:51:23As shown above, the child with the most recent LAST_ACTIVE_TIME timestamp appears in V$SQLAREA.
    Charles Hooper
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • V$SQLAREA question

    I have a quick question regarding V$SQLAREA.
    Oracle's Reference doc says followings about it:
    DISK_READS NUMBER: Sum of the number of disk reads over all child cursors
    BUFFER_GETS NUMBER: Sum of buffer gets over all child cursors
    So, in order to find out real bytes read, we need to multiply DISK_READS NUMBER with DB_BLOCK_SIZE, don't we?
         BYTES_READ_FROM_DISK == DISK_READS NUMBER x DB_BLOCK_SIZE
    Same for BUFFER_GETS NUMBER, isn't it?
         BYTES_READ_FROM_BUFFER == BUFFER_GETS NUMBER x DB_BLOCK_SIZE
    Thank you for help

    Thank you but many of our DBs are 10g, not 11g
    Unlike 11g, 10g doesn't have PHYSICAL_READ_BYTES column in V$SQLAREA
    So, are these correct?
    {Bytes_read_from_disk} == DISK_READS NUMBER x DB_BLOCK_SIZE
    {Bytes_read_from_buffer} == BUFFER_GETS NUMBER x DB_BLOCK_SIZE
    Thank you for help

  • Query to find the Views and synonyms that are accessing through db_link

    HI all,
    Oracle 10g
    I need a Query to find the Views and synonyms that are accessing through db_link.
    ie.
    database A have the db_link to database B through a schema A
    now i need to find what are the Synonyms and views that are accessing through db_link either directly or indirectly..
    regards,
    Deepak
    Edited by: Deepak_DBA on Dec 10, 2010 5:38 PM

    On the second database (B) use this query to find the SQL which used by the schema A (DB LINK USER). Check the SQL_FULLTEXT column.
    select sql_fulltext,sql_id,module,parsing_schema_name,parsing_user_id,first_load_time,loads,users_executing,rows_processed,plsql_exec_time,sorts,fetches,invalidations,parse_calls,cpu_time,elapsed_time,disk_reads,buffer_gets
    from V$sqlarea
    where parsing_schema_name = 'A' --and to_char(first_load_time,'dd/mm/yyyy') like  '%11/08/2007'
    order by first_load_time desc;
    Regards
    Asif Kabir

  • Performance of Database

    Hi all ,
    I a, having 9.2.0.6.0. database.
    when developers executes some batch job(running around 1 hour).They are saying it is responding very slow.Which view i need to check what wait events are there and caluse of slowness .Like where i need to find the cause .
    V$waitstat
    V$session_wait
    V$system_event
    which view (column) i need to go for...steps
    can u put some light on it .
    Thanks
    Rohit Mathur

    first look at which sqls are active and running on database:
    set lines 233
    select /*+ ordered */ to_char(s.sid,'99999'),
    substr(username,1,8),
    substr(t.sql_text,1,60),
    nvl(last_call_et,0) TIME_sec,
    t.hash_value,
    substr(w.event,1,30) WAIT_EV,
    substr(machine,1,10) MACHINE
    from v$session s,v$sqltext t,v$session_wait w
    where s.sql_address=t.address
    and s.sql_HASH_VALUE=t.HASH_VALUE
    and w.sid=s.sid
    and username between 'AAAAAAAAA' and 'ZZZZZZZZZ'
    and s.status='ACTIVE'
    and t.piece=0
    --and upper(sql_text) not like 'BEGIN%'
    order by TIME_SEC
    For the ones with high TIME_SEC value, run following script put its HASH_VALUE as input to see execution plan:
    UNDEFINE H_VALUE
    select
    to_char(ID,'999') ID,substr(LPAD(' ',depth,' ')||OPERATION||' '||OPTIONS,1,40) Operation,
    substr(OBJECT_NAME,1,25) Name,
    substr(OPTIMIZER,1,10) OPTIMIZER,
    CARDINALITY ,
    Bytes,
    Cost
    from
    v$sql_plan
    where
    HASH_VALUE=&&H_VALUE
    --and child_number=0
    order by
    child_number,ID
    select
    to_char(ID,'999')||'- Filter: '||FILTER_PREDICATES ACCESS_FILTER
    from
    v$sql_plan
    where
    HASH_VALUE=&&H_VALUE and FILTER_PREDICATES is not null and FILTER_PREDICATES <> ' '
    union
    select
    to_char(ID,'999')||'- Access: '||ACCESS_PREDICATES ACCESS_FILTER
    from
    v$sql_plan
    where
    HASH_VALUE=&H_VALUE and ACCESS_PREDICATES is not null --and ACCESS_PREDICATES <> ' '
    order by ACCESS_FILTER
    however, if batch job runs thousands of short TIME_sec sqls, then this method is useless. In this case you should check executions column of v$sqlarea view in order to see if there is a huge increase in execution number of any sql. Then you should focus on those sqls.
    regards,
    erkan

  • Query Result pane - disabling tooltip display of LOB data

    In the query result pane of SQL Developer, if a column is too long for the display (typically, in my case, for a CLOB column) and you hover the mouse over the column data, a tooltip showing the full value appears.
    For an example, do "select sql_fulltext from v$sql where rownum < 3" and hover the mouse over one of the values in the SQL_FULLTEXT column.
    In our application we typically query a table with a large CLOB column, and the tooltip fills the whole screen. This is a pain if you just leave your mouse on the screen somewhere over a CLOB column while typing :-( I've looked for a way to switch off this tooltip, but haven't managed to find one. Can anyone point me at a way of doing so? Unfortunately, I'm running SQL Developer 2.1.1, but even a response along the lines of "you can only do this in 3.0 and later, and this is how" would be useful, as it might help me argue for an upgrade.
    Thanks,
    Paul

    Hi Paul,
    Actually versions 3.0 and 3.1 have a very nice UI (Tools | Preferences | Mouseover Popups) to control this sort of thing, but unfortunately the settings seem only applicable to the debugger.
    You might consider making a feature request for this on the SQL Developer Exchange.
    Regards,
    Gary
    SQL Developer Team

  • Snapshots full sql_texts

    hi
    how can I find the full sql_texts in my database.
    I look at the snapshots but I cannot see whole sql texts in the snapshots.Than I want to see executıon plan of these sqls.(oracle 10gxe)
    For example:
    SELECT SHIPMENT.waybillid, SHIPMENT.APPLICATIONID, SHIPMENT.APPLICATION_VERSION, SHIPMENT.AUDITCREATEDBY, SHIPMENT.AUDITCREATEUNITID, SHIPMENT.AUDITMODIFIEDBY, SHIPMENT.AUDITMODIFYUNITID, SHIPMENT.AUDIT_CREATE_DATE, SHIPMENT.AUDIT_DELETED, SHIPMENT.AUDIT_MODIFY_DATE,
    7,794,780 2,200 3,543.1 9.1 36.17 42.00 2473420379

    Hi ,
    I didnt understand.Which sql texts you are looking for and from where?Are these statement already run?If they are than you can check their text from V$sql.In it sql_fulltext column will show the complete sql.
    Is this what you are looking for ?
    Cheers
    Aman....

  • V$SQLAREA.sharable_mem column !!

    Hi, all.
    What is the unit of V$SQLAREA.sharable_mem column, bytes or bits?
    One of sqls has the value of 4846245 in sharable_mem column!
    It means 4,846,245 bytes or bits?
    I cannot believe the sql is using 450 MegaBytes.
    In addition, which memory component includes "sharable_mem"?
    Is it part of shared pool?
    Thanks and Regards.

    SHARABLE_MEM is memory in bytes. There are no v$views that I know of that list in bits. 4846245 bytes is roughly 4.8MB, or to be more correct 4.621MB.
    Shared sql is stored in the library cache in the shared pool. You can increase the size of SHARED_POOL_SIZE or pin this sql statement in the pool so it is not aged out, hence increasing performace, by using the dbms_shared_pool.keep(); procedure. You may need to run \rdbms\admin\dbmspool.sql for this package to be created.
    --andrew                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Oracle 8i: full sql text in v$sqlarea

    I work with oracle 8i.
    is there a v$... that shows the execution plan for a query.
    in thev$sqlarea there isn't the full_sqltext column, and I need to know what oracle is doing now.
    Message was edited by:
    user596611

    v$sqltext_with_newlines will produce multiple rows per statement.
    You'll need an inline view
    select t.hash_value, t.sorts, t.executions, t.buffer_gets, t.disk_reads, tn.sql_text
    from v$sqlarea t,
    (select hash_value,sql_text
    from v$sqltext_with_newlines
    order by hash_value, piece) tn
    where sn.hash_value = t.hash_value
    Sybrand Bakker
    Senior Oracle DBA

  • V$session and v$sqlarea is interpreting in different way

    I am using redhad linux 5 version. The db version is oracle11g.
    I am trying to run the below shell script on the linux box
    export ORACLE_SID=chf01
    export ORACLE_HOME=/ora/app/oracle/product/11.1.0/db_1
    export WORKDIR=/ora/app/oracle/admin/chf01/scripts
    cd $WORKDIR
    $ORACLE_HOME/bin/sqlplus scott/tiger@ch01 << EOF
    spool sqlcapture.log
    INSERT INTO scott.T_SQL_CAPTURE
    SELECT MACHINE,
    SQL_FULLTEXT
    FROM
    v$session a,
    v$sqlarea b
    where
    ((a.sql_address = b.address
    and a.sql_hash_value = b.hash_value )
    or ( a.prev_sql_addr = b.address
    and a.prev_hash_value = b.hash_value))
    commit;
    spool off
    exit
    EOF
    ERROR=`grep 'ORA-' sqlcapture.log | wc -l`
    if [ "$ERROR" -gt 0 ]
    then
    cat sqlcapture.log|mailx -s "sqlcapture is failed" \ [email protected]
    else
    cat sqlcapture.log|mailx -s "sqlcapture is successful" \ [email protected]
    fi
    exit
    here is the spool file content. v$session is interpreted as v a and v$sqlarea is interpreted as v b.
    How can i fix this?
    SQL> INSERT INTO scott.T_SQL_CAPTURE
    2 SELECT MACHINE,
    3 SQL_FULLTEXT
    4 FROM
    5 v a,
    6 v b
    7 where
    8 ((a.sql_address = b.address
    9 and a.sql_hash_value = b.hash_value ) 10 or ( a.prev_sql_addr = b.address
    11 and a.prev_hash_value = b.hash_value))
    13 ;
    v b
    ERROR at line 6:
    ORA-00942: table or view does not exist
    SQL> commit;
    Commit complete.
    SQL> spool off

    Because *$* is interpreted by Linux shell. So you need to escape it. I used to escape all $ with \$ but someone in another thread posted a lovely trick. Use this:
    $ORACLE_HOME/bin/sqlplus scott/tiger@ch01 << \EOF
    .

  • Confusion in v$sqlarea

    Hello  Experts ;
    I am testing few things on pl-sql  supplies packages (DBMS_SHARED_POOL.PURGE )
    but i have few doubts please clear my doubt.
    << On Terminal 1  >>
    SQL>desc tab1;
    Name                                      Null?                         Type
    NO                                                                              NUMBER
    NAME                                                                       VARCHAR2(15)
    EMAIL                                                                       VARCHAR2(15)
    CITY                                                                           VARCHAR2(15)
    SQL>select count(*) from tab1;
      COUNT(*)
        300000
    SQL>select  *  from t ab1;
    In  Process
    << On Terminal 2  >>
    SQL. conn /as sysdba
    Connected.
    SQL>select sql_text,address, hash_value, executions, loads, version_count, invalidations, parse_calls  from  v$sqlarea
    where  sql_text ='SELECT * FROM TAB1';
    no  rows  selected
    Why  i did n't get  values  in terminal 2 , when  query running on terminal 1;
    MY DB VRSION IS : 10.2.0.1.0
    Thanks in dvance ..

    @BCV
    i got 268 lines  ..then  i have created spool file .  i am pasting output for  following  query..
    SYS>select * From v$sqlarea
      2  order by FIRST_LOAD_TIME desc;
    SQL_TEXT
    --------------------------------------------------------------------------------SQL_FULLTEXT
    --------------------------------------------------------------------------------SQL_ID        SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM      SORTS VERSION_COUNT
    LOADED_VERSIONS OPEN_VERSIONS USERS_OPENING    FETCHES EXECUTIONS
    PX_SERVERS_EXECUTIONS END_OF_FETCH_COUNT USERS_EXECUTING      LOADS
    FIRST_LOAD_TIME     INVALIDATIONS PARSE_CALLS DISK_READS DIRECT_WRITES
    BUFFER_GETS APPLICATION_WAIT_TIME CONCURRENCY_WAIT_TIME CLUSTER_WAIT_TIME
    USER_IO_WAIT_TIME PLSQL_EXEC_TIME JAVA_EXEC_TIME ROWS_PROCESSED COMMAND_TYPE
    OPTIMIZER_ OPTIMIZER_COST
    OPTIMIZER_ENV
    --------------------------------------------------------------------------------OPTIMIZER_ENV_HASH_VALUE PARSING_USER_ID PARSING_SCHEMA_ID
    PARSING_SCHEMA_NAME            KEPT_VERSIONS ADDRESS  HASH_VALUE OLD_HASH_VALUE
    PLAN_HASH_VALUE MODULE
    --------------- ----------------------------------------------------------------MODULE_HASH ACTION
    ACTION_HASH SERIALIZABLE_ABORTS
    OUTLINE_CATEGORY                                                   CPU_TIME
    ELAPSED_TIME OUTLINE_SID                              LAST_ACT R
    OBJECT_STATUS       LITERAL_HASH_VALUE LAST_LOAD I CHILD_LATCH
    SQL_PROFILE                                                      PROGRAM_ID
    PROGRAM_LINE# EXACT_MATCHING_SIGNATURE FORCE_MATCHING_SIGNATURE LAST_ACTI
    BIND_DATA
    select * From v$sqlarea order by FIRST_LOAD_TIME desc

Maybe you are looking for