[Oracle] Append hint(insert sql) will lead a TM LOCK
新增了append提示,會對test1表加上6級TM鎖,此時該表上的其他DML事物會被全部阻塞
sessioin 1:
SQL> insert /*+append*/ into test1 select * from test;
session 2:
SQL> insert /*+append*/ into test1 select * from test;
SQL> select inst_id,sid,serial#,machine from gv$session where username='SCOTT';
INST_ID SID SERIAL# MACHINE
---------- ---------- ---------- ----------------------------------------
2 571 4329 xxxxxxxx
1 3969 5217 xxxxxxxx
SQL> select * from gv$lock where sid in(571,3969);
INST_ID ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
---------- ---------------- ---------------- ---------- ------ ---------- ---------- ---------- ---------- ---------- ----------
1 C000000222009170 C0000002220091C8 3969 AE 100 0 4 0 8880 2
1 C000000222009348 C0000002220093A0 3969 FB 5 29515401 0 6 0 0
1 C000000212E486F0 C000000212E48768 3969 TX 458780 6646 6 0 243 2
1 9FFFFFFFFD3FB340 9FFFFFFFFD3FB3A0 3969 TM 88530 0 6 0 243 2
2 C000000222009CE8 C000000222009D40 571 AE 100 0 4 0 306 2
2 9FFFFFFFFD3EB340 9FFFFFFFFD3EB3A0 571 TM 88530 0 0 6 240 0
6 rows selected.
After session 1 commit;
SQL> /
INST_ID ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
---------- ---------------- ---------------- ---------- ------ ---------- ---------- ---------- ---------- ---------- ----------
2 C000000222009B28 C000000222009B80 571 XR 4 0 2 0 4 2
2 C000000222009CE8 C000000222009D40 571 AE 100 0 4 0 595 2
2 9FFFFFFFFD3FB340 9FFFFFFFFD3FB3A0 571 TM 88530 0 6 0 4 2
2 C0000002129D3B40 C0000002129D3BB8 571 TX 786463 1923 6 0 4 2
1 C000000222009170 C0000002220091C8 3969 AE 100 0 4 0 9169 2
sessioin 1:
SQL> insert /*+append*/ into test1 select * from test;
session 2:
SQL> insert /*+append*/ into test1 select * from test;
SQL> select inst_id,sid,serial#,machine from gv$session where username='SCOTT';
INST_ID SID SERIAL# MACHINE
---------- ---------- ---------- ----------------------------------------
2 571 4329 xxxxxxxx
1 3969 5217 xxxxxxxx
SQL> select * from gv$lock where sid in(571,3969);
INST_ID ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
---------- ---------------- ---------------- ---------- ------ ---------- ---------- ---------- ---------- ---------- ----------
1 C000000222009170 C0000002220091C8 3969 AE 100 0 4 0 8880 2
1 C000000222009348 C0000002220093A0 3969 FB 5 29515401 0 6 0 0
1 C000000212E486F0 C000000212E48768 3969 TX 458780 6646 6 0 243 2
1 9FFFFFFFFD3FB340 9FFFFFFFFD3FB3A0 3969 TM 88530 0 6 0 243 2
2 C000000222009CE8 C000000222009D40 571 AE 100 0 4 0 306 2
2 9FFFFFFFFD3EB340 9FFFFFFFFD3EB3A0 571 TM 88530 0 0 6 240 0
6 rows selected.
After session 1 commit;
SQL> /
INST_ID ADDR KADDR SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
---------- ---------------- ---------------- ---------- ------ ---------- ---------- ---------- ---------- ---------- ----------
2 C000000222009B28 C000000222009B80 571 XR 4 0 2 0 4 2
2 C000000222009CE8 C000000222009D40 571 AE 100 0 4 0 595 2
2 9FFFFFFFFD3FB340 9FFFFFFFFD3FB3A0 571 TM 88530 0 6 0 4 2
2 C0000002129D3B40 C0000002129D3BB8 571 TX 786463 1923 6 0 4 2
1 C000000222009170 C0000002220091C8 3969 AE 100 0 4 0 9169 2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2135182/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Append HintAPP
- 關於append sql hint的實驗APPSQL
- TM LOCK MODE
- oracle deadlock with TM lock in SX/SSX modeOracle
- Oracle中的sql hintOracleSQL
- APPEND_VALUES Hint in Oracle Database 11g Release 2APPOracleDatabase
- [原創]append_values hintAPP
- APPEND時的TM鎖定級別APP
- insert /*+ append */ into 與insert into 的區別APP
- 【sql調優之執行計劃】使用hint(六) append and noappendSQLAPP
- 關於加快INSERT語句執行速度和 HINT /*+ append*/及nologging的使用APP
- insert /*+ append */直接路徑插入APP
- insert 中append 用法詳解APP
- append HINT 的對事務的影響APP
- 11gr2,新增hint APPEND_VALUESAPP
- Oracle 12c 新SQL提示(hint)OracleSQL
- 關於insert /*+ append*/ 各種insert插入速度比較APP
- nologging和insert /*+append*/APP
- Append與Direct-Path Insert(一)APP
- Append與Direct-Path Insert(二)APP
- 直接路徑插入 -- insert /*+append*/ into [zt]APP
- oracle 通過sql profile為sql語句加hintOracleSQL
- 【sql hint 提示】SQL
- sql hint articleSQL
- Oralce SQL hintSQL
- ORACLE常用SQL最佳化hint語句OracleSQL
- insert append需要注意的問題APP
- 如何讓insert /*+ append */ 採用並行。APP並行
- oracle hintOracle
- ORACLE 通過SPM為SQL語句加HINTOracleSQL
- oracle sql hint提示_BITMAP CONVERSION FROM ROWIDSOracleSQL
- Oracle NoLogging Append 方式減少批量insert的redo_sizeOracleAPP
- MySQL SQL hint 提示MySql
- CTAS和insert append的一個測試APP
- insert /*+ append */於report unrecoverable命令實驗。APP
- 關於insert /* append */的幾點註記APP
- [Oracle]高效的SQL語句之分析函式(四)--lag()/lead()OracleSQL函式
- ORACLE 部分HINTOracle