码迷,mamicode.com
首页 > 数据库 > 详细

数据文件offline 时oracle 干了那些事?

时间:2017-07-31 21:13:49      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:日志文件   acl   3.3   div   log   数据文件   out   那些事   exe   

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 干了那些事?

标签:日志文件   acl   3.3   div   log   数据文件   out   那些事   exe   

原文地址:http://www.cnblogs.com/gavanwanggw/p/7265662.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!