- データベース管理者のための主要20c新機能の学習
- データベース管理者のための主要20c新機能の学習
- パフォーマンスおよび高可用性のオプション
- Oracle Multitenant
- MAX_IDLE_BLOCKER_TIMEパラメータ
- 演習: MAX_IDLE_BLOCKER_TIMEパラメータの使用
演習: MAX_IDLE_BLOCKER_TIME
パラメータの使用
この演習では、新しい初期化パラメータMAX_IDLE_BLOCKER_TIME
を使用してブロックしているセッションを終了する方法を示します。
- 新しい演習を開始する前に、演習の環境の推奨事項を参照してください。
- 2つのターミナル・セッションを準備します。1つは
HR
としてPDB20
にログインし、もう1つはSYSTEM
としてPDB20
にログインします。SYSTEM
としてPDB20
にログインします。$ sqlplus system@PDB20 SQL*Plus: Release 20.0.0.0.0 - Production on Mon Jan 20 08:20:09 2020 Version 20.2.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Enter password: password Connected to: Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production Version 20.2.0.0.0 SQL> SET SQLPROMPT "SQL system> " SQL system>
HR
としてPDB20
にログインします。$ sqlplus hr@PDB20 SQL*Plus: Release 20.0.0.0.0 - Production on Mon Jan 20 08:20:09 2020 Version 20.2.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Enter password: password Connected to: Oracle Database 20c Enterprise Edition Release 20.0.0.0.0 - Production Version 20.2.0.0.0 SQL> SET SQLPROMPT "SQL hr> " SQL hr>
SYSTEM
セッションで、初期化パラメータMAX_IDLE_BLOCKER_TIME
を2分に設定します。SQL system> ALTER SYSTEM SET max_idle_blocker_time=2; System altered. SQL system> SHOW PARAMETER max_idle_blocker_time NAME TYPE VALUE ------------------------------- ----------- ------------------------------ max_idle_blocker_time integer 2 SQL system>
HR
セッションで、従業員の給与を更新します。SQL hr> UPDATE hr.employees SET salary=salary*2; 107 rows updated. SQL hr>
SYSTEM
セッションで、すべての従業員の歩合率を0に設定します。この文は、HR
によって行で保持されているロック・リソースが解放されるまで待機します。SQL system> UPDATE hr.employees SET commission_pct=0;
2分後に、文が実行されたことを確認します。
107 rows updated. SQL system>
HR
セッションに戻り、給与更新の結果を問い合せます。SQL hr> SELECT salary FROM hr.employees; SELECT salary FROM hr.employees * ERROR at line 1: ORA-03113: end-of-file on communication channel Process ID: 32314 Session ID: 274 Serial number: 8179 SQL hr> EXIT $
2分を超える間リソースを保持していたため、セッションは自動的に終了しました。
DIAGトレース・ファイルを確認します。
$ cd /u01/app/oracle/diag/rdbms/database_unq_name/database_name/trace $ ls -ltr ... -rw-r----- 1 oracle oinstall 4139 Mar 16 04:38 CDB20_dia0_30961_base_1.trm -rw-r----- 1 oracle oinstall 16101 Mar 16 04:38 CDB20_dia0_30961_base_1.trc -rw-r----- 1 oracle oinstall 1067 Mar 16 04:48 CDB20_mmon_31003.trm -rw-r----- 1 oracle oinstall 2614 Mar 16 04:48 CDB20_mmon_31003.trc -rw-r----- 1 oracle oinstall 1107 Mar 16 04:49 CDB20_dbrm_30949.trm -rw-r----- 1 oracle oinstall 3398 Mar 16 04:49 CDB20_dbrm_30949.trc ... $ cat CDB20_dia0_30961_base_1.trc ... HM: Session with ID 274 serial # 8179 (U01I) on single instance 1 is hung and is waiting on 'SQL*Net message from client' for 96 seconds. Session was previously waiting on 'SQL*Net more data to client'. Session ID 274 is blocking 1 session ... HM: Session with ID 136 serial # 42403 (U011) on single instance 1 is hung and is waiting on 'enq: TX - row lock contention' for 96 seconds. Session was previously waiting on 'db file sequential read'. Final Blocker is Session ID 274 serial# 8179 on instance 1 which is waiting on 'SQL*Net message from client' for 108 seconds p1: 'driver id'=0x54435000, p2: '#bytes'=0x1, p3: ''=0x0 ... *** 2020-03-16T04:31:35.031598+00:00 (CDB$ROOT(1)) All Current Hang Statistics current number of hangs 1 hangs:current number of impacted sessions 2 current number of deadlocks 0 deadlocks:current number of impacted sessions 0 current number of singletons 0 current number of local active sessions 2 current number of local hung sessions 1 Suspected Hangs in the System and possibly Rebuilt Hangs Root Chain Total Hang Hang Hang Inst Root #hung #hung Hang Hang Resolution ID Type Status Num Sess Sess Sess Conf Span Action ----- ---- -------- ---- ----- ----- ----- ------ ------ ------------------- 1 HANG VALID 1 274 2 2 LOW LOCAL Terminate Process Inst Sess Ser Proc Wait Wait Num ID Num OSPID Name Time(s) Event ----- ------ ----- --------- ----- ------- ----- PDBID PDBNm ----- --------------- 1 136 42403 32583 U011 97 enq: TX - row lock contention 7 PDB20 1 274 8179 32314 U01I 110 SQL*Net message from client 7 PDB20 ;.. HM: current SQL: UPDATE hr.employees SET commission_pct=0 IO Total Self- Total Total Outlr Outlr Outlr Hung Rslvd Rslvd Wait WaitTm Wait WaitTm Wait Sess Hangs Hangs Count Secs Count Secs Count Wait Event ------ ------ ------ ------ ------ ------ ------ ------ ----------- 1 0 0 0 0 0 0 0 enq: TX - row lock contention ... HM: current SQL: UPDATE employees SET salary=salary*2 ... HM: Session ID 274 serial# 8179 ospid 32314 on instance 1 in Hang ID 1 was considered hung but is now no longer hung HM: Session with ID 274 with serial number 8179 is no longer hung *** 2020-03-16T04:38:25.114410+00:00 (CDB$ROOT(1)) HM: Hang ID=1 detected at 03/16/2020 04:31:34 with victim:1/274/8179 Evt:'SQL*Net message from client', SELF-RESOLVED after 0 matches (0) (1). $
PMONトレース・ファイルを読み取ることもできます。
$ cat /u01/app/oracle/diag/rdbms/cdb20/CDB20/trace/CDB20_pmon_30913.trc ... Kill idle blocker, hang detected *** 2020-03-16T04:32:04.240685+00:00 ((7)) Idle session sniped info: reason=max_idle_blocker_time parameter sess=0x86a06a20 sid=274 serial=8179 idle=2 limit=2 event=SQL*Net message from client client details: O/S info: user: oracle, term: pts/0, ospid: 32312 machine: edcdr8p1 program: sqlplus@edcdr8p1 (TNS V1-V3) application name: SQL*Plus, hash value=3669949024 Current SQL: UPDATE employees SET salary=salary*2 End of Idle session sniped info KILL SESSION for sid=(274, 8179): Reason = max_idle_blocker_time parameter, idle time = 2 mins, currently waiting on 'SQL*Net message from ... $
SYSTEM
セッションで、従業員の歩合率を問い合せます。SQL system> SELECT DISTINCT commission_pct FROM hr.employees; COMMISSION_PCT -------------- 0 SQL system> EXIT $
親トピック: MAX_IDLE_BLOCKER_TIMEパラメータ