[20211210]swc.sql如何使用.txt

lfree發表於2021-12-10

[20211210]swc.sql如何使用.txt

--//簡單記錄一下tpt swc.sql指令碼的使用。

1.環境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.測試:
SCOTT@book> @ spid
       SID    SERIAL# PROCESS                  SERVER    SPID       PID  P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
         4       1615 7760                     DEDICATED 7761        24        138 alter system kill session '4,1615' immediate;

SCOTT@book> select * from deptx where rownum=1 for update;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
--//再開啟2個會話執行相同語句。

SYS@book> @ swc sid||','||SERIAL#||',@'||inst_id 1=1
  SESSIONS PATH
---------- --------------------------------------------------------------------------------
         1  -> 32,723,@1
         1  -> 323,1667,@1
         1  -> 32,723,@1 -> 4,1615,@1
         1  -> 323,1667,@1 -> 4,1615,@1

--//可以確定罪魁禍首是4,1615,@1。

SYS@book> @killix sid=4
COMMANDS_TO_VERIFY_AND_RUN
-------------------------------------------------------------------------------------------------
alter system kill session '4,1615,@1' immediate -- SCOTT@xxxxxdg4 (sqlplus@xxxxxdg4 (TNS V1-V3));

SYS@book> alter system kill session '4,1615,@1' immediate -- SCOTT@xxxxxdg4 (sqlplus@xxxxxdg4 (TNS V1-V3));
System altered.

SYS@book> @ swc sid||','||SERIAL#||',@'||inst_id 1=1
  SESSIONS PATH
---------- --------------------------------------------------------------------------------
         1  -> 32,723,@1 -> 323,1667,@1
         1  -> 32,723,@1

SYS@book> @ killix sid=323
COMMANDS_TO_VERIFY_AND_RUN
---------------------------------------------------------------------------------------------------
alter system kill session '323,1667,@1' immediate -- SCOTT@xxxxxdg4 (sqlplus@xxxxxdg4 (TNS V1-V3));

--//繼續問題解決。

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

相關文章