1. 程式人生 > >數據文件offline 時oracle 幹了那些事?

數據文件offline 時oracle 幹了那些事?

那些事 cef 都是 dbf oct 原因 div post sync

SQL> oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug event 10046 trace name context forever ,level 12;
Statement processed.
SQL> alter database datafile ‘/oracle/oradata/lixora/LIXORA/datafile/o1_mf_zjhcsoft_b24623wy_.dbf‘ offline;

Database altered.

SQL> oradebug event 10046 trace name context off;
Statement processed.
SQL> oradebug tracefile_name;
/oracle/admin/lixora/udump/lixora_ora_29515.trc

*** 2014-09-30 10:50:56.261
*** SERVICE NAME:(SYS$USERS) 2014-09-30 10:50:56.261
*** SESSION ID:(159.3) 2014-09-30 10:50:56.261
WAIT #0: nam=‘SQL*Net message to client‘ ela= 1 driver id=1650815232 #bytes=1 p3=0 obj#=0 tim=1378950640880510
WAIT #0: nam=‘SQL*Net message from client‘ ela= 9226316 driver id=1650815232 #bytes=1 p3=0 obj#=0 tim=1378950650107126
XCTEND rlbk=0, rd_only=1
=====================
PARSING IN CURSOR #9 len=101 dep=0 uid=0 oct=35 lid=0 tim=1378950650107611 hv=707773262 ad=‘7e6cd4e8‘
alter database datafile ‘/oracle/oradata/lixora/LIXORA/datafile/o1_mf_zjhcsoft_b24623wy_.dbf‘ offline
END OF STMT
PARSE #9:c=0,e=394,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=1378950650107606
BINDS #9:
WAIT #9: nam=‘control file sequential read‘ ela= 24 file#=0 block#=1 blocks=1 obj#=0 tim=1378950650107957
WAIT #9: nam=‘control file sequential read‘ ela= 21 file#=1 block#=1 blocks=1 obj#=0 tim=1378950650108006
WAIT #9: nam=‘control file sequential read‘ ela= 9 file#=2 block#=1 blocks=1 obj#=0 tim=1378950650108035
WAIT #9: nam=‘control file sequential read‘ ela= 6 file#=0 block#=16 blocks=1 obj#=0 tim=1378950650108060
WAIT #9: nam=‘control file sequential read‘ ela= 7 file#=0 block#=18 blocks=1 obj#=0 tim=1378950650108083
WAIT #9: nam=‘control file sequential read‘ ela= 10 file#=0 block#=30 blocks=1 obj#=0 tim=1378950650108114
WAIT #9: nam=‘control file sequential read‘ ela= 8 file#=0 block#=1 blocks=1 obj#=0 tim=1378950650108250
WAIT #9: nam=‘control file sequential read‘ ela= 5 file#=1 block#=1 blocks=1 obj#=0 tim=1378950650108278
WAIT #9: nam=‘control file sequential read‘ ela= 4 file#=2 block#=1 blocks=1 obj#=0 tim=1378950650108299
WAIT #9: nam=‘control file sequential read‘ ela= 5 file#=0 block#=16 blocks=1 obj#=0 tim=1378950650108321
WAIT #9: nam=‘control file sequential read‘ ela= 6 file#=0 block#=18 blocks=1 obj#=0 tim=1378950650108342
WAIT #9: nam=‘control file sequential read‘ ela= 20 file#=0 block#=23 blocks=1 obj#=0 tim=1378950650108385
WAIT #9: nam=‘rdbms ipc reply‘ ela= 32296 from_process=5 timeout=910 p3=0 obj#=0 tim=1378950650141300
WAIT #9: nam=‘rdbms ipc reply‘ ela= 9556 from_process=5 timeout=910 p3=0 obj#=0 tim=1378950650150904
XCTEND rlbk=0, rd_only=1
EXEC #9:c=1000,e=43469,p=0,cr=0,cu=2,mis=0,r=0,dep=0,og=1,tim=1378950650151144
WAIT #9: nam=‘log file sync‘ ela= 14463 buffer#=1811 p2=0 p3=0 obj#=0 tim=1378950650165680
WAIT #9: nam=‘SQL*Net message to client‘ ela= 7 driver id=1650815232 #bytes=1 p3=0 obj#=0 tim=1378950650165756
*** 2014-09-30 10:51:13.382
WAIT #9: nam=‘SQL*Net message from client‘ ela= 7434358 driver id=1650815232 #bytes=1 p3=0 obj#=0 tim=1378950657600174

結論:

對一個datafile不管是運行offline還是offline drop。都是僅僅改寫了control文件。不會更新file$和ts$,這就是為什麽能夠在mount狀態下對某個datafile運行offline/offline drop的本質原因;

而在datafile on line 過程中 oracle會檢查數據文件頭的scn 值。假設scn 值小於其它的數據文件,那麽這個數據文件就須要進行恢復,也就是說僅僅要用bbed 把offline 的數據文件的scn 該改成和其它數據文件一樣。那個這個文件就又能online 。而又不須要日誌文件來進行恢復。

數據文件offline 時oracle 幹了那些事?