[20181107]18c新特性取消執行的sql.txt

lfree發表於2018-11-07

[20181107]18c新特性取消執行的sql.txt


--//18c有一個新特性,取消正在執行的sql語句.透過例子演示:


1.環境:

SQL> select banner_full from v$version;


BANNER_FULL

--------------------------------------------------------------------------------

Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

Version 18.3.0.0.0


SQL> select sid,serial# from v$session where sid in (select sid from v$mystat where rownum=1);


       SID    SERIAL#

---------- ----------

         9      19953


SQL> set feedback 6 sql_id

SQL> select count(*) from dba_tables,dba_tables;

  COUNT(*)

----------

   4618201


SQL_ID: 67whmvp7skh6r


--//或者這樣確定sql_id.

SQL>  select sql_text,sql_id from v$sql where sql_text like '%dba_tables%';

SQL_TEXT                                                             SQL_ID

-------------------------------------------------------------------- -------------

select sql_text,sql_id from v$sql where sql_text like '%dba_tables%' 4kjzfqnnm15ng

select count(*) from dba_tables,dba_tables                           67whmvp7skh6r


2.再次執行:

SQL> select count(*) from dba_tables,dba_tables;

select count(*) from dba_tables,dba_tables

                     *

ERROR at line 1:

ORA-01013: user requested cancel of current operation


--//開啟另外會話,執行:

SQL> alter system cancel sql '392,13330,67whmvp7skh6r';

System altered.


--//取消真正執行的sql_id.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2219085/,如需轉載,請註明出處,否則將追究法律責任。

相關文章