日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle可以使用提交完成的事务,【体系结构】Oracle数据提交与事务隔离实验 oradebug挂起lgwr进程...

發布時間:2025/3/21 编程问答 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle可以使用提交完成的事务,【体系结构】Oracle数据提交与事务隔离实验 oradebug挂起lgwr进程... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Oracle數據提交與事務隔離實驗

oradebug掛起lgwr進程

原文作者:dbsnake?崔華

實驗參考原文鏈接:

Oracle 里未 commit 的數據除了當前 session 之外,其他 session 是看不到的。

Oracle里未成功 commit 的數據我們也可能能看到。

同時啟4個 session:

session 1: 創建測試表test,插入一條數據但不提交

SCOTT@PROD>create table test (id number,name varchar2(20));

SCOTT@PROD>insert into test values (1,'lvxinghao');

SCOTT@PROD>select * from test;

session 2:查看test表,由于session 1未commit,session 2查看不到這條數據

SCOTT@PROD>select * from test;

SCOTT@PROD>select count(*) from test;

session 3:sys用戶查看并把lgwr進程suspend住(掛起):

操作系統查看LGWR進程號

[oracle@rhel64 ~]$ ps -ef | grep lgwr | grep -v grep

sys用戶查看lgwr后臺進程對應操作系統pid:

SYS@PROD>select spid from v$process where pname='LGWR';

掛起lgwr進程

SYS@PROD>oradebug setospid 5528

SYS@PROD>oradebug suspend

alert日志中信息顯示

[oracle@rhel64 ~]$ tail -f $ORACLE_BASE/diag/rdbms/prod/PROD/trace/alert_PROD.log

session 1:執行commit命令,由于lgwr進程被掛起,commit命令hang住

SCOTT@PROD>commit;

session 2:再次查看test表中數據,能夠顯示出來

SCOTT@PROD>select * from test;

SCOTT@PROD>select count(*) from test;

從結果來看,之前看不到的那條記錄現在已經能看到了,即session 1對于session2而言已經commit了,盡管由于lgwr被掛起,session1的commit操作并沒有成功的做完。

Oracle 里 commit 操作時,

1、修改事務所對應的 undo segment header 中 slot 的狀態;

2、改完狀態后再 flush log buffer;

session 3中把lgwr 掛起了,步驟2 無法完成,但步驟1還可以完成。

只要步驟1做完了,其他的 session 就能看到這個事務所做的改變了(通過ITL中記錄的 transaction id 去 check相應的 undo segment header 中 slot 的狀態),也就是說對于其他 session 而言,這個事務已經 commit 了,雖然這個事務其實并沒有成功commit。

(解除掛起lgwr進程,可以使用oradebug resume)

session 4:shutdown abort之后startup啟動實例

SYS@PROD>shutdown abort;

SYS@PROD>startup;

告警日志顯示有instance recovery

session 1:再次查看test表,數據不存在。

SCOTT@PROD>conn scott/tiger

SCOTT@PROD>select * from test;

SYS@PROD>oradebug help

HELP ? ? ? ? ? [command] ? ? ? ? ? ? ? ? Describe one or all commands

SETMYPID ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Debug current process

SETOSPID ? ? ? ? ? ? ? ? ? ? ? ? Set OS pid of process to debug

SETORAPID ? ? ? ['force'] ? ? ? ?Set Oracle pid of process to debug

SETORAPNAME ? ? ? ? ? ? ? ? ? ?Set Oracle process name to debug

SHORT_STACK ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Get abridged OS stack

CURRENT_SQL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Get current SQL

DUMP ? ? ? ? ? [addr] ?Invoke named dump

DUMPSGA ? ? ? ?[bytes] ? ? ? ? ? ? ? ? ? Dump fixed SGA

DUMPLIST ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Print a list of available dumps

EVENT ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Set trace event in process

SESSION_EVENT ? ? ? ? ? ? ? ? ? ? ?Set trace event in session

DUMPVAR ? ? ? ?

[level] ?Print/dump a fixed PGA/SGA/UGA variable

DUMPTYPE ? ? ?

?Print/dump an address with type info

SETVAR ? ? ? ?

?Modify a fixed PGA/SGA/UGA variable

PEEK ? ? ? ? ? [level] ? ? ?Print/Dump memory

POKE ? ? ? ? ? ? ? ?Modify memory

WAKEUP ? ? ? ? ? ? ? ? ? ? ? ? ?Wake up Oracle process

SUSPEND ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Suspend execution

RESUME ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Resume execution

FLUSH ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Flush pending writes to trace file

CLOSE_TRACE ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Close trace file

TRACEFILE_NAME ? ? ? ? ? ? ? ? ? ? ? ? ? Get name of trace file

LKDEBUG ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Invoke global enqueue service debugger

NSDBX ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Invoke CGS name-service debugger

-G ? ? ? ? ? ? ? Parallel oradebug command prefix

-R ? ? ? ? ? ? ? Parallel oradebug prefix (return output

SETINST ? ? ? ? ? ? ?Set instance list in double quotes

SGATOFILE ? ? ? ? ? ? ? Dump SGA to file; dirname in double quotes

DMPCOWSGA ? ? ? Dump & map SGA as COW; dirname in double quotes

MAPCOWSGA ? ? ? ? ? ? ? Map SGA as COW; dirname in double quotes

HANGANALYZE ? ?[level] [syslevel] ? ? ? ?Analyze system hang

FFBEGIN ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Flash Freeze the Instance

FFDEREGISTER ? ? ? ? ? ? ? ? ? ? ? ? ? ? FF deregister instance from cluster

FFTERMINST ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Call exit and terminate instance

FFRESUMEINST ? ? ? ? ? ? ? ? ? ? ? ? ? ? Resume the flash frozen instance

FFSTATUS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Flash freeze status of instance

SKDSTTPCS ? ? ? ? ? ? ? ?Helps translate PCs to names

WATCH ? ? ? ? ?

?Watch a region of memory

DELETE ? ? ? ? watchpoint ? ?Delete a watchpoint

SHOW ? ? ? ? ? watchpoints ? ? ? ?Show ?watchpoints

DIRECT_ACCESS ? Fixed table access

CORE ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dump core without crashing process

IPC ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Dump ipc information

UNLIMIT ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Unlimit the size of the trace file

PROCSTAT ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dump process statistics

CALL ? ? ? ? ? [-t count] [arg1]...[argn] ?Invoke function with arguments

SYS@PROD>

呂星昊

2016.3.27

總結

以上是生活随笔為你收集整理的oracle可以使用提交完成的事务,【体系结构】Oracle数据提交与事务隔离实验 oradebug挂起lgwr进程...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。