• 查找正在运行或上一次执行的sql


    SQL> set linesize 200
    SQL> set pagesize 200
    SQL> select * from v$mystat where rownum<2;
    
           SID STATISTIC#	   VALUE
    ---------- ---------- ----------
          1175	    0	       0
    	  
    	  
    SQL> select * from (select * from TLYH order by owner) where rownum<20;
    		 
    		 
    		 
    正在执行SQL:
    
    SQL> select sid,
                    serial#,
                    username,
                    sql_hash_value,
                    sql_address,
                    prev_hash_value,
                    sql_hash_value
               from v$session
              where sid = 1175  2    3    4    5    6    7    8    9  ;
    
           SID    SERIAL# USERNAME			     SQL_HASH_VALUE SQL_ADDRESS      PREV_HASH_VALUE SQL_HASH_VALUE
    ---------- ---------- ------------------------------ -------------- ---------------- --------------- --------------
          1175	31583 VXSPACE				 2226292732 000000007E67DF50	  3237839783	 2226292732
    	  
    	  
    执行完后;
    
    SQL>   select sid,
                    serial#,
                    username,
                    sql_hash_value,
                    sql_address,
                    prev_hash_value,
                    prev_sql_addr
               from v$session
              where sid = 1175  2    3    4    5    6    7    8    9  ;
    
           SID    SERIAL# USERNAME			     SQL_HASH_VALUE SQL_ADDRESS      PREV_HASH_VALUE PREV_SQL_ADDR
    ---------- ---------- ------------------------------ -------------- ---------------- --------------- ----------------
          1175	31583 VXSPACE					  0 00			  2226292732 000000007E67DF50
    	  
    	  
    SQL> select sql_text
      from v$sqlarea
     where (address, hash_value) in
           (select /*+unnest*/
             DECODE(sql_hash_value, 0, prev_sql_addr, sql_address),
             DECODE(sql_hash_value, 0, prev_hash_value, sql_hash_value)
              from v$session
             where sid = 1175)  2    3    4    5    6    7    8  ;
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select * from (select * from TLYH order by owner) where rownum<20
    
    再次运行SQL
    
    SQL> /
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    select 'aaa' from dual
    

  • 相关阅读:
    Promise小结 ES6异步编程
    XLNet模型
    BERT模型
    Transformer模型
    注意力机制(Attention Mechanism)
    序列到序列模型(seq2seq)
    【Pandas-附件2】查询手册
    【Pandas-附件1】读取excle和csv具体函数
    【pandas-21】实践-同比和环比指标
    【pandas-20】实践(泰坦尼克沉船事件)-特征处理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349629.html
Copyright © 2020-2023  润新知