SlideShare une entreprise Scribd logo
1  sur  13
Télécharger pour lire hors ligne
还原 Oracle 中真实的
 Cache Recovery


    by Maclean.liu
          liu.maclean@gmail.com
      www.oracledatabase12g.com
About Me

l Email:liu.maclean@gmail.com
l Blog:www.oracledatabase12g.com
l Oracle Certified Database Administrator Master 10g
and 11g
l Over 6 years experience with Oracle DBA technology
l Over 7 years experience with Linux technology
l Member Independent Oracle Users Group
l Member All China Users Group
l Presents for advanced Oracle topics: RAC,
DataGuard, Performance Tuning and Oracle Internal.
我们在学习 Oracle 基础知识的时候会了解到实例恢复(Instance Recovery)或者说崩溃恢复
(Crash recovery)的概念,有时候甚至于这 2 个名词在我们日常的语言中表达同样的意思。实
际上 Instance Recovery 与 Crash Recovery 是存在区别的:针对单实例(single instance)或者
RAC 中所有节点全部崩溃后的恢复,我们称之为 Crash Recovery。而对于 RAC 中的某一个
节点失败,存活节点(surviving instance)试图对失败节点线程上 redo 做应用的情况,我们称之
为 Instance Recovery。


不管是 Instance Recovery 还是 Crash Recovery,都由 2 个部分组成:cache recovery 继以
transaction recovery。


根据官方文档的 介绍,Cache Recovery 也叫 Rolling Forward,就是我们常说的前滚;而
Transaction Recovery 也叫 Rolling Back,就是我们常说的回滚。前滚和回滚贯穿 Oracle 恢复
的基本概念,是我们入门必要学习的知识,在次不多介绍。

有文事者,必济之以武略。理论学得再好,不实践也无用。所幸 Crash Recovery 是很容易做
成的实验,我们不妨来看一看:



SQL> shutdown abort;
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1065353216 bytes
Fixed Size                  2089336 bytes
Variable Size             486542984 bytes
Database Buffers          570425344 bytes
Redo Buffers                6295552 bytes
Database mounted.

SQL> alter database open;

Crash Recovery 将从 alter database open 开始,我们来观察其日志

==================alert.log====================
alter database open
Tue Jun 14 18:19:53 2011
Beginning crash recovery of 1 threads
 parallel recovery started with 2 processes
Tue Jun 14 18:19:53 2011
Started redo scan
Tue Jun 14 18:19:53 2011
Completed redo scan
 0 redo blocks read, 0 data blocks need recovery
Tue Jun 14 18:19:53 2011
Started redo application at
 Thread 1: logseq 1004, block 1124, scn 17136185
Tue Jun 14 18:19:53 2011
Recovery of Online Redo Log: Thread 1 Group 2 Seq 1004 Reading mem 0
 Mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_2_6v34jokt_.log
 Mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_2_6v34jotq_.log
Tue Jun 14 18:19:53 2011
Completed redo application
Tue Jun 14 18:19:53 2011
Completed crash recovery at
 Thread 1: logseq 1004, block 1124, scn 17156186
 0 data blocks read, 0 data blocks written, 0 redo blocks read
Tue Jun 14 18:19:53 2011
LGWR: STARTING ARCH PROCESSES
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0 started with pid=16, OS id=7829
Tue Jun 14 18:19:53 2011
Thread 1 advanced to log sequence 1005 (thread open)
Thread 1 opened at log sequence 1005
 Current log# 3 seq# 1005 mem# 0:
/flashcard/oradata/G10R2/onlinelog/o1_mf_3_6v34jpmp_.log
 Current log# 3 seq# 1005 mem# 1:
/s01/flash_recovery_area/G10R2/onlinelog/o1_mf_3_6v34jpyn_.log
Successful open of redo thread 1
Tue Jun 14 18:19:53 2011
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC0: Becoming the heartbeat ARCH
Tue Jun 14 18:19:53 2011
SMON: enabling cache recovery
Tue Jun 14 18:19:53 2011
db_recovery_file_dest_size of 204800 MB is 6.81% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Tue Jun 14 18:19:54 2011
Successfully onlined Undo Tablespace 1.
Tue Jun 14 18:19:54 2011
SMON: enabling tx recovery
Database Characterset is UTF8
Opening with internal Resource Manager plan
where NUMA PG = 1, CPUs = 2
replication_dependency_tracking turned off (no async multimaster replication
found)
Starting background process QMNC
QMNC started with pid=17, OS id=7831
Tue Jun 14 18:19:55 2011
Completed: alter database open
注意上述单实例 Crash Recovery 到数据库打开的整个过程:
   •   alter database open
   •   Beginning crash recovery of 1 threads
   •   Started redo scan
   •   Completed redo scan
   •   Started redo application at
   •   Completed redo application
   •   Completed crash recovery at
   •   SMON: enabling cache recovery
   •   Successfully onlined Undo Tablespace 1
   •   SMON: enabling tx recovery
   •   Completed: alter database open

从上述步骤中我们可以看到三种恢复名词,即:
   • crash recovery
   • cache recovery
   • tx recovery




这和官方文档所描述的 Crash Recovery 概念是不一致的,我们现在来理清这几种 recovery。


crash recovery 包含对 redo 的 scan 和 application,显然其完成的是 Rolling Forward 前滚的工
作,告警日志中出现的 crash recovery 等同于官方文档中介绍的”cache recovery”,我们可以
将” Completed crash recovery”看做前滚完成的标志。而 tx recovery 从字面就可以看出实际上
是 Transaction Recovery,tx recovery 发生在 Undo Tablespace online 之后(回滚事务的前提是
Undo 可用),数据完成打开操作之前(“Completed: alter database open”)。注意 tx recovery 并不
要求数据库打开前完成,仅仅是在数据库打开之前由 smon 启动(“SMON: enabling tx
recovery”)。


剩下的唯一的问题是,这里的 cache recovery 是什么?显然它不是官方文档中所描述的”cache
recovery”,几乎没有任何文档介绍存在这样一个 recovery 操作,这也是本文重点要介绍的。
我们来看另一个演示,这个演示用以说明 cache recovery 还存在于最普通的不包含 Crash
Recovery 的数据库打开过程中:


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.
Total System Global Area 1065353216 bytes
Fixed Size                  2089336 bytes
Variable Size             486542984 bytes
Database Buffers          570425344 bytes
Redo Buffers                6295552 bytes
Database mounted.

SQL> alter database open;
Database altered.

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL> select * from global_name;

GLOBAL_NAME
--------------------------------------------------------------------------------
www.oracledatabase12g.com

==================alert.log====================
alter database open
Tue Jun 14 18:43:52 2011
LGWR: STARTING ARCH PROCESSES
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0 started with pid=14, OS id=8133
Tue Jun 14 18:43:52 2011
Thread 1 opened at log sequence 1005
Current log# 3 seq# 1005 mem# 0:
/flashcard/oradata/G10R2/onlinelog/o1_mf_3_6v34jpmp_.log
Current log# 3 seq# 1005 mem# 1:
/s01/flash_recovery_area/G10R2/onlinelog/o1_mf_3_6v34jpyn_.log
Successful open of redo thread 1
Tue Jun 14 18:43:52 2011
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC0: Becoming the heartbeat ARCH
Tue Jun 14 18:43:52 2011
SMON: enabling cache recovery
Tue Jun 14 18:43:53 2011
Successfully onlined Undo Tablespace 1.
Tue Jun 14 18:43:53 2011
SMON: enabling tx recovery
Database Characterset is UTF8
Opening with internal Resource Manager plan
where NUMA PG = 1, CPUs = 2
replication_dependency_tracking turned off (no async multimaster replication
found)
Tue Jun 14 18:43:53 2011
Incremental checkpoint up to RBA [0x3ed.624.0], current log tail at RBA
[0x3ed.944.0]
Tue Jun 14 18:43:53 2011
Starting background process QMNC
QMNC started with pid=15, OS id=8135
Tue Jun 14 18:43:53 2011
Completed: alter database open


因为是 clean shutdown,所以这里不存在 crash recovery。但这里同样出现了”SMON: enabling
cache recovery”,可见 cache recovery 是每次实例启动 instance startup 必要执行的一种恢复操
作。但问题是,这个恢复操作到底针对何种对象?

实际上 cache recovery 所要恢复的是 rowcache,也就是我们常说的字典缓存(dictionary
cache)。关于这个结论,肯定有很多人要问我这样说的依据是什么,对应于这个”cache
recovery”的问题,我们很难从 google 中得到一些启示,因为它和官方文档所描述的”cache
recovery-rolling forward”存在重名的关系。

为了证明 cache recovery 所恢复的是 rowcache,我们需要一个实证,从正式的系统中得到验
证。要做到这一点是比较困难的,我们需要 Oracle 愿意把整个 database open 的过程变成慢
动作来供我们参考,验证要用到一些调试工具,例如 gdb 或者 dbx。

我们首先将实例启动到 mount 状态,并对执行 startup 的 LOCAL 进程做 gdb 的 breakpoint 断
点调试:



SQL> shutdown abort;
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.
Total System Global Area 1065353216 bytes
Fixed Size                  2089336 bytes
Variable Size             486542984 bytes
Database Buffers          570425344 bytes
Redo Buffers                6295552 bytes
Database mounted.

找出 LOCAL 进程的系统进程号 SPID

SQL> select spid from v$process
2 where addr in (
3 select paddr from v$session
4 where sid=(select distinct sid from v$mystat))
5 /

SPID
------------
8326

在实例 startup nomount/mount 后共享池的 library cache 就是可用的
SQL> select namespace from v$librarycache where gets!=0;

NAMESPACE
---------------
SQL AREA
TABLE/PROCEDURE

而 rowcache 则尚未被填充,因为字典缓存来源于自举对象(bootstrap$)和字典基表
SQL> select parameter,count,gets from v$rowcache where count!=0;
no rows selected

另开一个 terminal 窗口,并执行对 LOCAL 进程 8326 的 gdb breakpoint 调试
[oracle@rh2 ~]$ gdb $ORACLE_HOME/bin/oracle 8326
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /s01/db_1/bin/oracle...(no debugging symbols found)...done.
Attaching to program: /s01/db_1/bin/oracle, process 8326
Reading symbols from /s01/db_1/lib/libskgxp10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libskgxp10.so
Reading symbols from /s01/db_1/lib/libhasgen10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libhasgen10.so
Reading symbols from /s01/db_1/lib/libskgxn2.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libskgxn2.so
Reading symbols from /s01/db_1/lib/libocr10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libocr10.so
Reading symbols from /s01/db_1/lib/libocrb10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libocrb10.so
Reading symbols from /s01/db_1/lib/libocrutl10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libocrutl10.so
Reading symbols from /s01/db_1/lib/libjox10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libjox10.so
Reading symbols from /s01/db_1/lib/libclsra10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libclsra10.so
Reading symbols from /s01/db_1/lib/libdbcfg10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libdbcfg10.so
Reading symbols from /s01/db_1/lib/libnnz10.so...(no debugging symbols
found)...done.
Loaded symbols for /s01/db_1/lib/libnnz10.so
Reading symbols from /usr/lib64/libaio.so.1...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib64/libaio.so.1
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols
found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib64/libnss_files.so.2
0x0000003181a0d8e0 in __read_nocancel () from /lib64/libpthread.so.0

输入断点 kcrf_commit_force 和 kqlobjlod
(gdb) break kcrf_commit_force
Breakpoint 1 at 0x2724b6c

(gdb) break kqlobjlod
Breakpoint 2 at 0x1ac5e8c

在之前的 terminal 中执行数据库打开操作,因为 breakpoint 的关系这个 open 操作会
hang 住,
这时我们通过观察告警日志来了解恢复进度

SQL> alter database open;                              --这里会 hang 住

在 gdb 下输入 continue,
(gdb) c
Continuing.

Breakpoint 1, 0x0000000002724b6c in kcrf_commit_force ()

观察告警日志可以发现 redo application 已经完成,但还未进入 cache recovery 阶
段
alter database open
Tue Jun 14 19:14:33 2011
Beginning crash recovery of 1 threads
parallel recovery started with 2 processes
Tue Jun 14 19:14:33 2011
Started redo scan
Tue Jun 14 19:14:33 2011
Completed redo scan
39 redo blocks read, 74 data blocks need recovery
Tue Jun 14 19:14:33 2011
Started redo application at
Thread 1: logseq 1006, block 1155
Tue Jun 14 19:14:33 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 1006 Reading mem 0
Mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_1_6v34jnkn_.log
Mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_1_6v34jnst_.log
Tue Jun 14 19:14:33 2011
Completed redo application
Tue Jun 14 19:14:33 2011
Completed crash recovery at
Thread 1: logseq 1006, block 1194, scn 17200193
74 data blocks read, 74 data blocks written, 39 redo blocks read
Tue Jun 14 19:14:33 2011
LGWR: STARTING ARCH PROCESSES
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0 started with pid=17, OS id=8656
Tue Jun 14 19:14:33 2011
Thread 1 advanced to log sequence 1007 (thread open)
Thread 1 opened at log sequence 1007
Current log# 2 seq# 1007 mem# 0:
/flashcard/oradata/G10R2/onlinelog/o1_mf_2_6v34jokt_.log
Current log# 2 seq# 1007 mem# 1:
/s01/flash_recovery_area/G10R2/onlinelog/o1_mf_2_6v34jotq_.log
Successful open of redo thread 1
Tue Jun 14 19:14:33 2011
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC0: Becoming the heartbeat ARCH
db_recovery_file_dest_size of 204800 MB is 6.81% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Tue Jun 14 19:14:37 2011
Incremental checkpoint up to RBA [0x3ef.3.0], current log tail at RBA
[0x3ef.3.0]

且此时 rowcache 仍未被填充
SQL> select parameter,count,gets from v$rowcache where count!=0;
no rows selected

在 gdb 界面下再次执行 continue 2 次
(gdb) c
Continuing.

Breakpoint 1, 0x0000000002724b6c in kcrf_commit_force ()
(gdb) c
Continuing.

Breakpoint 2, 0x0000000001ac5e8c in kqlobjlod ()

观察告警日志可以发现已开始 cache recovery,但也卡陷在 cache recovery 上,这保
证我们的演示不受骚扰
Tue Jun 14 19:16:44 2011
SMON: enabling cache recovery

此时 rowcache 中出现唯一的一个 dc_objects 对象
select parameter,count,gets from v$rowcache where count!=0;

PARAMETER                             COUNT       GETS
-------------------------------- ---------- ----------
dc_objects                                1          1
这个对象是什么呢?也许你已经猜到了,我们做一个 rowcache dump 来看一下:
SQL> ALTER SESSION SET EVENTS 'immediate trace name row_cache level 10';

================row_cache trace===================

BUCKET 43170:
row cache parent object: address=0x92326060 cid=8(dc_objects)
hash=f3d1a8a1 typ=11 transaction=(nil) flags=00000001
own=0x92326130[0x9230f628,0x9230f628] wat=0x92326140[0x92326140,0x92326140]
mode=S
status=EMPTY/-/-/-/-/-/-/-/-
set=0, complete=FALSE
data=
00000000 4f42000a 5453544f 24504152 00000000 00000000 00000000 00000000
00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
BUCKET 43170 total object count=1

可以看到上述 dc_objects 尚未完成加载(status=EMPTY & complete=FALSE ),那
么这是一个什么 object 呢?

4f42000a 5453544f 24504152 => 转换为文本即:OB TSTO$PAR 也就是
BOOTSTRAP$

换而言之在 cache recovery 时第一个恢复的字典缓存对象是 BOOTSTRAP$,这并不出乎
我们的意料。

启动实例的 LOCAL 进程的等待事件为 instance state change,这是常规情况下我们观
察不到得
SQL> select event,p1text,p1 from v$session where wait_class!='Idle';

EVENT                                    P1TEXT
P1
----------------------------------------
---------------------------------------- ----------
instance state change                    layer
2

在 gdb 界面下再次 continue,将载入更多的 rowcache 对象
(gdb) c
Continuing.

Breakpoint 2, 0x0000000001ac5e8c in kqlobjlod ()

BUCKET 37:
row cache parent object: address=0x916cd980 cid=3(dc_rollback_segments)
hash=5fed2a24 typ=9 transaction=(nil) flags=000000a6
own=0x916cda50[0x916cda50,0x916cda50] wat=0x916cda60[0x916cda60,0x916cda60]
mode=N
status=VALID/INSERT/-/FIXED/-/-/-/-/-
data=
00000000 00000000 00000001 00000009 59530006 4d455453 00000000 00000000
00000000 00000000 00000000 00000000 00000003 00000000 00000000 00000000
00000000 00000000 00000000 00000000
BUCKET 37 total object count=1

595300064d455453 -> SYSTEM 属于 dc_rollback_segments 也就是著名的
system 回滚段
BUCKET 55556:
row cache parent object: address=0x916d8cd0 cid=8(dc_objects)
hash=ce89d903 typ=11 transaction=(nil) flags=00000001
own=0x916d8da0[0x9230f628,0x9230f628] wat=0x916d8db0[0x916d8db0,0x916d8db0]
mode=S
status=EMPTY/-/-/-/-/-/-/-/-
set=0, complete=FALSE
data=
00000000 5f430006 234a424f 00000000 00000000 00000000 00000000 00000000
00000000 00000005 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
BUCKET 55556 total object count=1

5f430006 234a424f -> C_OBJ# 是著名的 bootstrap 对象之一,可以从
$ORACLE_HOME/rdbms/admin/sql.bsq 中找到它
create rollback segment SYSTEM tablespace SYSTEM
storage (initial 50K next 50K)
/
create cluster c_obj# (obj# number)
pctfree 5 size 800                           /* don't waste too much space */
/* A table of 32 cols, 2 index, 2 col per index requires about 2K.
* A table of 10 cols, 2 index, 2 col per index requires about 750.
*/
storage (initial 130K next 200k maxextents unlimited pctincrease 0)
/* avoid space management during IOR I */
/

我们还可以通过 v$rowcache_parent 视图来了解 dictionary cache 的情况
SQL>   col cache_name for a20
SQL>   col keystr for a31
SQL>   set linesize 200
SQL>   select address,cache_name,existent,lock_mode,saddr,substr(key,1,30) keystr
from   v$rowcache_parent;

ADDRESS          CACHE_NAME             E LOCK_MODE SADDR             KEYSTR
---------------- --------------------   - ---------- ----------------
-------------------------------
00000000916CCE20 dc_tablespaces         N          0 00
000000000000000000000000000000
00000000916CD980 dc_rollback_segments   Y          0 00
000000000000000000000000000000
0000000092326060 dc_objects           Y          0 00
000000000A00424F4F545354524150
00000000916D8CD0 dc_objects           N          3 000000009BD91328
000000000600435F4F424A23000000
00000000916DA830 dc_object_ids        Y          0 00
380000000000000000000000000000

可以看到持有 row cache lock 的会话是'000000009BD91328',
且该 dc_objects 对象还处于 non-existent 状态,
换而言之真正装载 rowcache 的是启动实例的 LOCAL 服务进程

SQL> select sid,program,event,p1,p2,p3 from v$session where
saddr='000000009BD91328';

SID PROGRAM                                          EVENT
P1   P2 P3
----- ------------------------------------------------
---------------------------------------- -- ---- --
3294 sqlplus@rh2.oracle.com (TNS V1-V3)                db file scattered read
1 378 3

该进程正在等待 db file scattered read,fileid->1,block-378,这些块属于
BOOTSTRAP$表

BOOTSTRAP$对象已从 rowcache 被载入到 library cache 中
SQL> select kglhdadr,kglnaobj from x$kglob where kglobtyp=2 and kglnaobj not
like 'X$%';

KGLHDADR             KGLNAOBJ
-------------------- --------------------
0000000092326990     BOOTSTRAP$

SQL> select owner||'.'||Name from v$db_object_cache where type='TABLE' and name
not like 'X$%';

OWNER||'.'||NAME
--------------------------------------------------------------------------------
SYS.BOOTSTRAP$


初步总结:

   1. 在数据库正式 open 前需要恢复字典缓存,这个步骤被称为 cache recovery,其实是
     row cache recovery。与官方文档中描述的”cache recovery”不同,row cache recovery
     应当是 Oracle Internal 的叫法。
   2. 实际执行 row cache recovery 的不是 SMON 进程,而是启动实例的服务进程

Contenu connexe

Tendances

Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneDeepti Singh
 
Oracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby databaseOracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby databaseuzzal basak
 
Advanced rac troubleshooting
Advanced rac troubleshootingAdvanced rac troubleshooting
Advanced rac troubleshootingRiyaj Shamsudeen
 
Upgrade 11gR2 to 12cR1 Clusterware
Upgrade 11gR2 to 12cR1 ClusterwareUpgrade 11gR2 to 12cR1 Clusterware
Upgrade 11gR2 to 12cR1 ClusterwareNikhil Kumar
 
Oracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesOracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesKyle Hailey
 
你所不知道的Oracle后台进程Smon功能
你所不知道的Oracle后台进程Smon功能你所不知道的Oracle后台进程Smon功能
你所不知道的Oracle后台进程Smon功能maclean liu
 
配置Golden gate同步ddl语句
配置Golden gate同步ddl语句配置Golden gate同步ddl语句
配置Golden gate同步ddl语句maclean liu
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document StoreDave Stokes
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016Dave Stokes
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016Dave Stokes
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksKyle Hailey
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Özgür Umut Vurgun
 
A kind and gentle introducton to rac
A kind and gentle introducton to racA kind and gentle introducton to rac
A kind and gentle introducton to racRiyaj Shamsudeen
 
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Raheel Syed
 
RAC - The Savior of DBA
RAC - The Savior of DBARAC - The Savior of DBA
RAC - The Savior of DBANikhil Kumar
 
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...Marco Vigelini
 
Oracle 11g R2 RAC implementation and concept
Oracle 11g R2 RAC implementation and conceptOracle 11g R2 RAC implementation and concept
Oracle 11g R2 RAC implementation and conceptSantosh Kangane
 
Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingKyle Hailey
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1Chien Chung Shen
 

Tendances (20)

Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
Oracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby databaseOracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby database
 
Advanced rac troubleshooting
Advanced rac troubleshootingAdvanced rac troubleshooting
Advanced rac troubleshooting
 
Rac questions
Rac questionsRac questions
Rac questions
 
Upgrade 11gR2 to 12cR1 Clusterware
Upgrade 11gR2 to 12cR1 ClusterwareUpgrade 11gR2 to 12cR1 Clusterware
Upgrade 11gR2 to 12cR1 Clusterware
 
Oracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesOracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueues
 
你所不知道的Oracle后台进程Smon功能
你所不知道的Oracle后台进程Smon功能你所不知道的Oracle后台进程Smon功能
你所不知道的Oracle后台进程Smon功能
 
配置Golden gate同步ddl语句
配置Golden gate同步ddl语句配置Golden gate同步ddl语句
配置Golden gate同步ddl语句
 
MySQL as a Document Store
MySQL as a Document StoreMySQL as a Document Store
MySQL as a Document Store
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction Locks
 
Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014Oracle12c Pluggable Database Hands On - TROUG 2014
Oracle12c Pluggable Database Hands On - TROUG 2014
 
A kind and gentle introducton to rac
A kind and gentle introducton to racA kind and gentle introducton to rac
A kind and gentle introducton to rac
 
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
 
RAC - The Savior of DBA
RAC - The Savior of DBARAC - The Savior of DBA
RAC - The Savior of DBA
 
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
The first bug on Oracle Database 12c: how to create a pdb by cloning a remote...
 
Oracle 11g R2 RAC implementation and concept
Oracle 11g R2 RAC implementation and conceptOracle 11g R2 RAC implementation and concept
Oracle 11g R2 RAC implementation and concept
 
Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 sampling
 
Oracle Database Management Basic 1
Oracle Database Management Basic 1Oracle Database Management Basic 1
Oracle Database Management Basic 1
 

En vedette

Workflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in DrupalWorkflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in Drupalmewren
 
Evaluating my magazine
Evaluating my magazineEvaluating my magazine
Evaluating my magazineabcdsmile
 
Leadership for Justice Peace Safety and Security
Leadership for Justice Peace Safety and SecurityLeadership for Justice Peace Safety and Security
Leadership for Justice Peace Safety and SecurityErwin Schwella
 
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaianIrma Muthiara Sari
 
Permen tahun2013 nomor81a_lampiran1
Permen tahun2013 nomor81a_lampiran1Permen tahun2013 nomor81a_lampiran1
Permen tahun2013 nomor81a_lampiran1Irma Muthiara Sari
 
ETL 523 Presentation: The Digital Divide
ETL 523 Presentation: The Digital DivideETL 523 Presentation: The Digital Divide
ETL 523 Presentation: The Digital DivideTeneal Morley
 
Oracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmOracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmmaclean liu
 
What if I can design my care?
What if I can design my care?What if I can design my care?
What if I can design my care?Stefania Marcoli
 
Aditya meshram Bday PPT
Aditya meshram Bday PPTAditya meshram Bday PPT
Aditya meshram Bday PPTShubhangi1234
 
Que hago y_como_vivo
Que hago y_como_vivoQue hago y_como_vivo
Que hago y_como_vivoalmeri1595
 
2 clasificación de los ángulos
2 clasificación de los ángulos2 clasificación de los ángulos
2 clasificación de los ángulosRicardo Castro
 
20151116ケアワークアカデミー資料
20151116ケアワークアカデミー資料20151116ケアワークアカデミー資料
20151116ケアワークアカデミー資料Takeshita Kouhei
 
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaianIrma Muthiara Sari
 
Cross-sectoral innovation in Smart Homes
Cross-sectoral innovation in Smart HomesCross-sectoral innovation in Smart Homes
Cross-sectoral innovation in Smart HomesMarcel van Hest
 
了解真实的Oracle unbreakable database appliance
了解真实的Oracle unbreakable database appliance了解真实的Oracle unbreakable database appliance
了解真实的Oracle unbreakable database appliancemaclean liu
 
Internet Librarian :: Libraries, Ebooks & Econtent
Internet Librarian :: Libraries, Ebooks & EcontentInternet Librarian :: Libraries, Ebooks & Econtent
Internet Librarian :: Libraries, Ebooks & Econtentbillyhoya
 
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar prosesIrma Muthiara Sari
 

En vedette (20)

Workflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in DrupalWorkflow, Revisioning and Rules in Drupal
Workflow, Revisioning and Rules in Drupal
 
Diverse recruitment
Diverse recruitmentDiverse recruitment
Diverse recruitment
 
Evaluating my magazine
Evaluating my magazineEvaluating my magazine
Evaluating my magazine
 
Leadership for Justice Peace Safety and Security
Leadership for Justice Peace Safety and SecurityLeadership for Justice Peace Safety and Security
Leadership for Justice Peace Safety and Security
 
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian
04. b. salinan lampiran permendikbud no. 66 th 2013 tentang standar penilaian
 
Permen tahun2013 nomor81a_lampiran1
Permen tahun2013 nomor81a_lampiran1Permen tahun2013 nomor81a_lampiran1
Permen tahun2013 nomor81a_lampiran1
 
ETL 523 Presentation: The Digital Divide
ETL 523 Presentation: The Digital DivideETL 523 Presentation: The Digital Divide
ETL 523 Presentation: The Digital Divide
 
Oracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asmOracle prm数据库恢复工具与asm
Oracle prm数据库恢复工具与asm
 
Kisi-kisi Materi PLPG IPA SMP
Kisi-kisi Materi PLPG IPA SMPKisi-kisi Materi PLPG IPA SMP
Kisi-kisi Materi PLPG IPA SMP
 
What if I can design my care?
What if I can design my care?What if I can design my care?
What if I can design my care?
 
CSS3
CSS3CSS3
CSS3
 
Aditya meshram Bday PPT
Aditya meshram Bday PPTAditya meshram Bday PPT
Aditya meshram Bday PPT
 
Que hago y_como_vivo
Que hago y_como_vivoQue hago y_como_vivo
Que hago y_como_vivo
 
2 clasificación de los ángulos
2 clasificación de los ángulos2 clasificación de los ángulos
2 clasificación de los ángulos
 
20151116ケアワークアカデミー資料
20151116ケアワークアカデミー資料20151116ケアワークアカデミー資料
20151116ケアワークアカデミー資料
 
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian
04. a. salinan permendikbud no. 66 th 2013 ttg standar penilaian
 
Cross-sectoral innovation in Smart Homes
Cross-sectoral innovation in Smart HomesCross-sectoral innovation in Smart Homes
Cross-sectoral innovation in Smart Homes
 
了解真实的Oracle unbreakable database appliance
了解真实的Oracle unbreakable database appliance了解真实的Oracle unbreakable database appliance
了解真实的Oracle unbreakable database appliance
 
Internet Librarian :: Libraries, Ebooks & Econtent
Internet Librarian :: Libraries, Ebooks & EcontentInternet Librarian :: Libraries, Ebooks & Econtent
Internet Librarian :: Libraries, Ebooks & Econtent
 
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses03. b. salinan lampiran permendikbud no. 65 th 2013  ttg standar proses
03. b. salinan lampiran permendikbud no. 65 th 2013 ttg standar proses
 

Similaire à 还原Oracle中真实的cache recovery

Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in DataguardJason Arneil
 
Enterprise Manager Cloud Control 12c Release 4 - Installation
Enterprise Manager Cloud Control 12c Release 4 - InstallationEnterprise Manager Cloud Control 12c Release 4 - Installation
Enterprise Manager Cloud Control 12c Release 4 - InstallationIvica Arsov
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响maclean liu
 
Oracle upgrade
Oracle upgradeOracle upgrade
Oracle upgradeRaj p
 
Manual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLManual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLErick Vidbaz
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库maclean liu
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GN/A
 
0396 oracle-goldengate-12c-tutorial
0396 oracle-goldengate-12c-tutorial0396 oracle-goldengate-12c-tutorial
0396 oracle-goldengate-12c-tutorialKlausePaulino
 

Similaire à 还原Oracle中真实的cache recovery (20)

Missing redo logs in oracle
Missing redo logs in oracleMissing redo logs in oracle
Missing redo logs in oracle
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in Dataguard
 
Enterprise Manager Cloud Control 12c Release 4 - Installation
Enterprise Manager Cloud Control 12c Release 4 - InstallationEnterprise Manager Cloud Control 12c Release 4 - Installation
Enterprise Manager Cloud Control 12c Release 4 - Installation
 
Oracle-11g-upgrade
Oracle-11g-upgradeOracle-11g-upgrade
Oracle-11g-upgrade
 
Oracle ORA Errors
Oracle ORA ErrorsOracle ORA Errors
Oracle ORA Errors
 
Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响Vbox virtual box在oracle linux 5 - shoug 梁洪响
Vbox virtual box在oracle linux 5 - shoug 梁洪响
 
Oracle upgrade
Oracle upgradeOracle upgrade
Oracle upgrade
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
 
Cloning 2
Cloning 2Cloning 2
Cloning 2
 
Install oracle11gr2 rhel5
Install oracle11gr2 rhel5Install oracle11gr2 rhel5
Install oracle11gr2 rhel5
 
Manual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQLManual Tecnico OGG Oracle to MySQL
Manual Tecnico OGG Oracle to MySQL
 
Using AWR for IO Subsystem Analysis
Using AWR for IO Subsystem AnalysisUsing AWR for IO Subsystem Analysis
Using AWR for IO Subsystem Analysis
 
oracle dba
oracle dbaoracle dba
oracle dba
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
 
RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA
 
FIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11GFIXING BLOCK CORRUPTION (RMAN) on 11G
FIXING BLOCK CORRUPTION (RMAN) on 11G
 
Rmoug ashmaster
Rmoug ashmasterRmoug ashmaster
Rmoug ashmaster
 
les09.pdf
les09.pdfles09.pdf
les09.pdf
 
0396 oracle-goldengate-12c-tutorial
0396 oracle-goldengate-12c-tutorial0396 oracle-goldengate-12c-tutorial
0396 oracle-goldengate-12c-tutorial
 

Plus de maclean liu

Mysql企业备份发展及实践
Mysql企业备份发展及实践Mysql企业备份发展及实践
Mysql企业备份发展及实践maclean liu
 
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルOracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルmaclean liu
 
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略maclean liu
 
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案maclean liu
 
TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例maclean liu
 
PRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health CheckPRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health Checkmaclean liu
 
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案maclean liu
 
【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案maclean liu
 
Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2maclean liu
 
Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2maclean liu
 
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1maclean liu
 
诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 maclean liu
 
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangOrclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangmaclean liu
 
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24maclean liu
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?maclean liu
 
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践maclean liu
 
Prm dul is an oracle database recovery tool database
Prm dul is an oracle database recovery tool   databasePrm dul is an oracle database recovery tool   database
Prm dul is an oracle database recovery tool databasemaclean liu
 
Oracle prm dul, jvm and os
Oracle prm dul, jvm and osOracle prm dul, jvm and os
Oracle prm dul, jvm and osmaclean liu
 
Oracle dba必备技能 使用os watcher工具监控系统性能负载
Oracle dba必备技能   使用os watcher工具监控系统性能负载Oracle dba必备技能   使用os watcher工具监控系统性能负载
Oracle dba必备技能 使用os watcher工具监控系统性能负载maclean liu
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3maclean liu
 

Plus de maclean liu (20)

Mysql企业备份发展及实践
Mysql企业备份发展及实践Mysql企业备份发展及实践
Mysql企业备份发展及实践
 
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアルOracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
Oracle専用データ復旧ソフトウェアprm dulユーザーズ・マニュアル
 
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
【诗檀软件 郭兆伟-技术报告】跨国企业级Oracle数据库备份策略
 
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
基于Oracle 12c data guard & far sync的低资源消耗两地三数据中心容灾方案
 
TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例TomCat迁移步骤简述以及案例
TomCat迁移步骤简述以及案例
 
PRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health CheckPRM DUL Oracle Database Health Check
PRM DUL Oracle Database Health Check
 
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
dbdao.com 汪伟华 my-sql-replication复制高可用配置方案
 
【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案【诗檀软件】Mysql高可用方案
【诗檀软件】Mysql高可用方案
 
Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2Shoug at apouc2015 4min pitch_biotwang_v2
Shoug at apouc2015 4min pitch_biotwang_v2
 
Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2Apouc 4min pitch_biotwang_v2
Apouc 4min pitch_biotwang_v2
 
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
使用Oracle osw analyzer工具分析oswbb日志,并绘制系统性能走势图1
 
诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础 诗檀软件 Oracle开发优化基础
诗檀软件 Oracle开发优化基础
 
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wangOrclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
Orclrecove 1 pd-prm-dul testing for oracle database recovery_20141030_biot_wang
 
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
诗檀软件 – Oracle数据库修复专家 oracle数据块损坏知识2014-10-24
 
追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?追求Jdbc on oracle最佳性能?如何才好?
追求Jdbc on oracle最佳性能?如何才好?
 
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
使用Virtual box在oracle linux 5.7上安装oracle database 11g release 2 rac的最佳实践
 
Prm dul is an oracle database recovery tool database
Prm dul is an oracle database recovery tool   databasePrm dul is an oracle database recovery tool   database
Prm dul is an oracle database recovery tool database
 
Oracle prm dul, jvm and os
Oracle prm dul, jvm and osOracle prm dul, jvm and os
Oracle prm dul, jvm and os
 
Oracle dba必备技能 使用os watcher工具监控系统性能负载
Oracle dba必备技能   使用os watcher工具监控系统性能负载Oracle dba必备技能   使用os watcher工具监控系统性能负载
Oracle dba必备技能 使用os watcher工具监控系统性能负载
 
Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3Parnassus data recovery manager for oracle database user guide v0.3
Parnassus data recovery manager for oracle database user guide v0.3
 

Dernier

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

还原Oracle中真实的cache recovery

  • 1. 还原 Oracle 中真实的 Cache Recovery by Maclean.liu liu.maclean@gmail.com www.oracledatabase12g.com
  • 2. About Me l Email:liu.maclean@gmail.com l Blog:www.oracledatabase12g.com l Oracle Certified Database Administrator Master 10g and 11g l Over 6 years experience with Oracle DBA technology l Over 7 years experience with Linux technology l Member Independent Oracle Users Group l Member All China Users Group l Presents for advanced Oracle topics: RAC, DataGuard, Performance Tuning and Oracle Internal.
  • 3. 我们在学习 Oracle 基础知识的时候会了解到实例恢复(Instance Recovery)或者说崩溃恢复 (Crash recovery)的概念,有时候甚至于这 2 个名词在我们日常的语言中表达同样的意思。实 际上 Instance Recovery 与 Crash Recovery 是存在区别的:针对单实例(single instance)或者 RAC 中所有节点全部崩溃后的恢复,我们称之为 Crash Recovery。而对于 RAC 中的某一个 节点失败,存活节点(surviving instance)试图对失败节点线程上 redo 做应用的情况,我们称之 为 Instance Recovery。 不管是 Instance Recovery 还是 Crash Recovery,都由 2 个部分组成:cache recovery 继以 transaction recovery。 根据官方文档的 介绍,Cache Recovery 也叫 Rolling Forward,就是我们常说的前滚;而 Transaction Recovery 也叫 Rolling Back,就是我们常说的回滚。前滚和回滚贯穿 Oracle 恢复 的基本概念,是我们入门必要学习的知识,在次不多介绍。 有文事者,必济之以武略。理论学得再好,不实践也无用。所幸 Crash Recovery 是很容易做 成的实验,我们不妨来看一看: SQL> shutdown abort; ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 1065353216 bytes Fixed Size 2089336 bytes Variable Size 486542984 bytes Database Buffers 570425344 bytes Redo Buffers 6295552 bytes Database mounted. SQL> alter database open; Crash Recovery 将从 alter database open 开始,我们来观察其日志 ==================alert.log==================== alter database open Tue Jun 14 18:19:53 2011 Beginning crash recovery of 1 threads parallel recovery started with 2 processes Tue Jun 14 18:19:53 2011 Started redo scan Tue Jun 14 18:19:53 2011 Completed redo scan 0 redo blocks read, 0 data blocks need recovery Tue Jun 14 18:19:53 2011 Started redo application at Thread 1: logseq 1004, block 1124, scn 17136185
  • 4. Tue Jun 14 18:19:53 2011 Recovery of Online Redo Log: Thread 1 Group 2 Seq 1004 Reading mem 0 Mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_2_6v34jokt_.log Mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_2_6v34jotq_.log Tue Jun 14 18:19:53 2011 Completed redo application Tue Jun 14 18:19:53 2011 Completed crash recovery at Thread 1: logseq 1004, block 1124, scn 17156186 0 data blocks read, 0 data blocks written, 0 redo blocks read Tue Jun 14 18:19:53 2011 LGWR: STARTING ARCH PROCESSES ARC0: Archival started LGWR: STARTING ARCH PROCESSES COMPLETE ARC0 started with pid=16, OS id=7829 Tue Jun 14 18:19:53 2011 Thread 1 advanced to log sequence 1005 (thread open) Thread 1 opened at log sequence 1005 Current log# 3 seq# 1005 mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_3_6v34jpmp_.log Current log# 3 seq# 1005 mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_3_6v34jpyn_.log Successful open of redo thread 1 Tue Jun 14 18:19:53 2011 ARC0: Becoming the 'no FAL' ARCH ARC0: Becoming the 'no SRL' ARCH ARC0: Becoming the heartbeat ARCH Tue Jun 14 18:19:53 2011 SMON: enabling cache recovery Tue Jun 14 18:19:53 2011 db_recovery_file_dest_size of 204800 MB is 6.81% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup. Tue Jun 14 18:19:54 2011 Successfully onlined Undo Tablespace 1. Tue Jun 14 18:19:54 2011 SMON: enabling tx recovery Database Characterset is UTF8 Opening with internal Resource Manager plan where NUMA PG = 1, CPUs = 2 replication_dependency_tracking turned off (no async multimaster replication found) Starting background process QMNC QMNC started with pid=17, OS id=7831 Tue Jun 14 18:19:55 2011 Completed: alter database open
  • 5. 注意上述单实例 Crash Recovery 到数据库打开的整个过程: • alter database open • Beginning crash recovery of 1 threads • Started redo scan • Completed redo scan • Started redo application at • Completed redo application • Completed crash recovery at • SMON: enabling cache recovery • Successfully onlined Undo Tablespace 1 • SMON: enabling tx recovery • Completed: alter database open 从上述步骤中我们可以看到三种恢复名词,即: • crash recovery • cache recovery • tx recovery 这和官方文档所描述的 Crash Recovery 概念是不一致的,我们现在来理清这几种 recovery。 crash recovery 包含对 redo 的 scan 和 application,显然其完成的是 Rolling Forward 前滚的工 作,告警日志中出现的 crash recovery 等同于官方文档中介绍的”cache recovery”,我们可以 将” Completed crash recovery”看做前滚完成的标志。而 tx recovery 从字面就可以看出实际上 是 Transaction Recovery,tx recovery 发生在 Undo Tablespace online 之后(回滚事务的前提是 Undo 可用),数据完成打开操作之前(“Completed: alter database open”)。注意 tx recovery 并不 要求数据库打开前完成,仅仅是在数据库打开之前由 smon 启动(“SMON: enabling tx recovery”)。 剩下的唯一的问题是,这里的 cache recovery 是什么?显然它不是官方文档中所描述的”cache recovery”,几乎没有任何文档介绍存在这样一个 recovery 操作,这也是本文重点要介绍的。
  • 6. 我们来看另一个演示,这个演示用以说明 cache recovery 还存在于最普通的不包含 Crash Recovery 的数据库打开过程中: SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 1065353216 bytes Fixed Size 2089336 bytes Variable Size 486542984 bytes Database Buffers 570425344 bytes Redo Buffers 6295552 bytes Database mounted. SQL> alter database open; Database altered. SQL> select * from v$version; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Production TNS for Linux: Version 10.2.0.4.0 - Production NLSRTL Version 10.2.0.4.0 - Production SQL> select * from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- www.oracledatabase12g.com ==================alert.log==================== alter database open Tue Jun 14 18:43:52 2011 LGWR: STARTING ARCH PROCESSES ARC0: Archival started LGWR: STARTING ARCH PROCESSES COMPLETE ARC0 started with pid=14, OS id=8133 Tue Jun 14 18:43:52 2011 Thread 1 opened at log sequence 1005 Current log# 3 seq# 1005 mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_3_6v34jpmp_.log Current log# 3 seq# 1005 mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_3_6v34jpyn_.log Successful open of redo thread 1 Tue Jun 14 18:43:52 2011 ARC0: Becoming the 'no FAL' ARCH ARC0: Becoming the 'no SRL' ARCH ARC0: Becoming the heartbeat ARCH Tue Jun 14 18:43:52 2011 SMON: enabling cache recovery Tue Jun 14 18:43:53 2011 Successfully onlined Undo Tablespace 1. Tue Jun 14 18:43:53 2011 SMON: enabling tx recovery
  • 7. Database Characterset is UTF8 Opening with internal Resource Manager plan where NUMA PG = 1, CPUs = 2 replication_dependency_tracking turned off (no async multimaster replication found) Tue Jun 14 18:43:53 2011 Incremental checkpoint up to RBA [0x3ed.624.0], current log tail at RBA [0x3ed.944.0] Tue Jun 14 18:43:53 2011 Starting background process QMNC QMNC started with pid=15, OS id=8135 Tue Jun 14 18:43:53 2011 Completed: alter database open 因为是 clean shutdown,所以这里不存在 crash recovery。但这里同样出现了”SMON: enabling cache recovery”,可见 cache recovery 是每次实例启动 instance startup 必要执行的一种恢复操 作。但问题是,这个恢复操作到底针对何种对象? 实际上 cache recovery 所要恢复的是 rowcache,也就是我们常说的字典缓存(dictionary cache)。关于这个结论,肯定有很多人要问我这样说的依据是什么,对应于这个”cache recovery”的问题,我们很难从 google 中得到一些启示,因为它和官方文档所描述的”cache recovery-rolling forward”存在重名的关系。 为了证明 cache recovery 所恢复的是 rowcache,我们需要一个实证,从正式的系统中得到验 证。要做到这一点是比较困难的,我们需要 Oracle 愿意把整个 database open 的过程变成慢 动作来供我们参考,验证要用到一些调试工具,例如 gdb 或者 dbx。 我们首先将实例启动到 mount 状态,并对执行 startup 的 LOCAL 进程做 gdb 的 breakpoint 断 点调试: SQL> shutdown abort; ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 1065353216 bytes Fixed Size 2089336 bytes Variable Size 486542984 bytes Database Buffers 570425344 bytes Redo Buffers 6295552 bytes Database mounted. 找出 LOCAL 进程的系统进程号 SPID SQL> select spid from v$process 2 where addr in ( 3 select paddr from v$session 4 where sid=(select distinct sid from v$mystat)) 5 / SPID
  • 8. ------------ 8326 在实例 startup nomount/mount 后共享池的 library cache 就是可用的 SQL> select namespace from v$librarycache where gets!=0; NAMESPACE --------------- SQL AREA TABLE/PROCEDURE 而 rowcache 则尚未被填充,因为字典缓存来源于自举对象(bootstrap$)和字典基表 SQL> select parameter,count,gets from v$rowcache where count!=0; no rows selected 另开一个 terminal 窗口,并执行对 LOCAL 进程 8326 的 gdb breakpoint 调试 [oracle@rh2 ~]$ gdb $ORACLE_HOME/bin/oracle 8326 GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /s01/db_1/bin/oracle...(no debugging symbols found)...done. Attaching to program: /s01/db_1/bin/oracle, process 8326 Reading symbols from /s01/db_1/lib/libskgxp10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libskgxp10.so Reading symbols from /s01/db_1/lib/libhasgen10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libhasgen10.so Reading symbols from /s01/db_1/lib/libskgxn2.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libskgxn2.so Reading symbols from /s01/db_1/lib/libocr10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libocr10.so Reading symbols from /s01/db_1/lib/libocrb10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libocrb10.so Reading symbols from /s01/db_1/lib/libocrutl10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libocrutl10.so Reading symbols from /s01/db_1/lib/libjox10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libjox10.so Reading symbols from /s01/db_1/lib/libclsra10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libclsra10.so Reading symbols from /s01/db_1/lib/libdbcfg10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libdbcfg10.so Reading symbols from /s01/db_1/lib/libnnz10.so...(no debugging symbols found)...done. Loaded symbols for /s01/db_1/lib/libnnz10.so Reading symbols from /usr/lib64/libaio.so.1...(no debugging symbols
  • 9. found)...done. Loaded symbols for /usr/lib64/libaio.so.1 Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/libdl.so.2 Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib64/libm.so.6 Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done. [Thread debugging using libthread_db enabled] Loaded symbols for /lib64/libpthread.so.0 Reading symbols from /lib64/libnsl.so.1...(no debugging symbols found)...done. Loaded symbols for /lib64/libnsl.so.1 Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib64/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/libnss_files.so.2 0x0000003181a0d8e0 in __read_nocancel () from /lib64/libpthread.so.0 输入断点 kcrf_commit_force 和 kqlobjlod (gdb) break kcrf_commit_force Breakpoint 1 at 0x2724b6c (gdb) break kqlobjlod Breakpoint 2 at 0x1ac5e8c 在之前的 terminal 中执行数据库打开操作,因为 breakpoint 的关系这个 open 操作会 hang 住, 这时我们通过观察告警日志来了解恢复进度 SQL> alter database open; --这里会 hang 住 在 gdb 下输入 continue, (gdb) c Continuing. Breakpoint 1, 0x0000000002724b6c in kcrf_commit_force () 观察告警日志可以发现 redo application 已经完成,但还未进入 cache recovery 阶 段 alter database open Tue Jun 14 19:14:33 2011 Beginning crash recovery of 1 threads parallel recovery started with 2 processes Tue Jun 14 19:14:33 2011 Started redo scan Tue Jun 14 19:14:33 2011 Completed redo scan 39 redo blocks read, 74 data blocks need recovery Tue Jun 14 19:14:33 2011 Started redo application at Thread 1: logseq 1006, block 1155 Tue Jun 14 19:14:33 2011 Recovery of Online Redo Log: Thread 1 Group 1 Seq 1006 Reading mem 0 Mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_1_6v34jnkn_.log
  • 10. Mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_1_6v34jnst_.log Tue Jun 14 19:14:33 2011 Completed redo application Tue Jun 14 19:14:33 2011 Completed crash recovery at Thread 1: logseq 1006, block 1194, scn 17200193 74 data blocks read, 74 data blocks written, 39 redo blocks read Tue Jun 14 19:14:33 2011 LGWR: STARTING ARCH PROCESSES ARC0: Archival started LGWR: STARTING ARCH PROCESSES COMPLETE ARC0 started with pid=17, OS id=8656 Tue Jun 14 19:14:33 2011 Thread 1 advanced to log sequence 1007 (thread open) Thread 1 opened at log sequence 1007 Current log# 2 seq# 1007 mem# 0: /flashcard/oradata/G10R2/onlinelog/o1_mf_2_6v34jokt_.log Current log# 2 seq# 1007 mem# 1: /s01/flash_recovery_area/G10R2/onlinelog/o1_mf_2_6v34jotq_.log Successful open of redo thread 1 Tue Jun 14 19:14:33 2011 ARC0: Becoming the 'no FAL' ARCH ARC0: Becoming the 'no SRL' ARCH ARC0: Becoming the heartbeat ARCH db_recovery_file_dest_size of 204800 MB is 6.81% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup. Tue Jun 14 19:14:37 2011 Incremental checkpoint up to RBA [0x3ef.3.0], current log tail at RBA [0x3ef.3.0] 且此时 rowcache 仍未被填充 SQL> select parameter,count,gets from v$rowcache where count!=0; no rows selected 在 gdb 界面下再次执行 continue 2 次 (gdb) c Continuing. Breakpoint 1, 0x0000000002724b6c in kcrf_commit_force () (gdb) c Continuing. Breakpoint 2, 0x0000000001ac5e8c in kqlobjlod () 观察告警日志可以发现已开始 cache recovery,但也卡陷在 cache recovery 上,这保 证我们的演示不受骚扰 Tue Jun 14 19:16:44 2011 SMON: enabling cache recovery 此时 rowcache 中出现唯一的一个 dc_objects 对象 select parameter,count,gets from v$rowcache where count!=0; PARAMETER COUNT GETS -------------------------------- ---------- ---------- dc_objects 1 1
  • 11. 这个对象是什么呢?也许你已经猜到了,我们做一个 rowcache dump 来看一下: SQL> ALTER SESSION SET EVENTS 'immediate trace name row_cache level 10'; ================row_cache trace=================== BUCKET 43170: row cache parent object: address=0x92326060 cid=8(dc_objects) hash=f3d1a8a1 typ=11 transaction=(nil) flags=00000001 own=0x92326130[0x9230f628,0x9230f628] wat=0x92326140[0x92326140,0x92326140] mode=S status=EMPTY/-/-/-/-/-/-/-/- set=0, complete=FALSE data= 00000000 4f42000a 5453544f 24504152 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 BUCKET 43170 total object count=1 可以看到上述 dc_objects 尚未完成加载(status=EMPTY & complete=FALSE ),那 么这是一个什么 object 呢? 4f42000a 5453544f 24504152 => 转换为文本即:OB TSTO$PAR 也就是 BOOTSTRAP$ 换而言之在 cache recovery 时第一个恢复的字典缓存对象是 BOOTSTRAP$,这并不出乎 我们的意料。 启动实例的 LOCAL 进程的等待事件为 instance state change,这是常规情况下我们观 察不到得 SQL> select event,p1text,p1 from v$session where wait_class!='Idle'; EVENT P1TEXT P1 ---------------------------------------- ---------------------------------------- ---------- instance state change layer 2 在 gdb 界面下再次 continue,将载入更多的 rowcache 对象 (gdb) c Continuing. Breakpoint 2, 0x0000000001ac5e8c in kqlobjlod () BUCKET 37: row cache parent object: address=0x916cd980 cid=3(dc_rollback_segments) hash=5fed2a24 typ=9 transaction=(nil) flags=000000a6 own=0x916cda50[0x916cda50,0x916cda50] wat=0x916cda60[0x916cda60,0x916cda60]
  • 12. mode=N status=VALID/INSERT/-/FIXED/-/-/-/-/- data= 00000000 00000000 00000001 00000009 59530006 4d455453 00000000 00000000 00000000 00000000 00000000 00000000 00000003 00000000 00000000 00000000 00000000 00000000 00000000 00000000 BUCKET 37 total object count=1 595300064d455453 -> SYSTEM 属于 dc_rollback_segments 也就是著名的 system 回滚段 BUCKET 55556: row cache parent object: address=0x916d8cd0 cid=8(dc_objects) hash=ce89d903 typ=11 transaction=(nil) flags=00000001 own=0x916d8da0[0x9230f628,0x9230f628] wat=0x916d8db0[0x916d8db0,0x916d8db0] mode=S status=EMPTY/-/-/-/-/-/-/-/- set=0, complete=FALSE data= 00000000 5f430006 234a424f 00000000 00000000 00000000 00000000 00000000 00000000 00000005 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 BUCKET 55556 total object count=1 5f430006 234a424f -> C_OBJ# 是著名的 bootstrap 对象之一,可以从 $ORACLE_HOME/rdbms/admin/sql.bsq 中找到它 create rollback segment SYSTEM tablespace SYSTEM storage (initial 50K next 50K) / create cluster c_obj# (obj# number) pctfree 5 size 800 /* don't waste too much space */ /* A table of 32 cols, 2 index, 2 col per index requires about 2K. * A table of 10 cols, 2 index, 2 col per index requires about 750. */ storage (initial 130K next 200k maxextents unlimited pctincrease 0) /* avoid space management during IOR I */ / 我们还可以通过 v$rowcache_parent 视图来了解 dictionary cache 的情况 SQL> col cache_name for a20 SQL> col keystr for a31 SQL> set linesize 200 SQL> select address,cache_name,existent,lock_mode,saddr,substr(key,1,30) keystr from v$rowcache_parent; ADDRESS CACHE_NAME E LOCK_MODE SADDR KEYSTR ---------------- -------------------- - ---------- ---------------- ------------------------------- 00000000916CCE20 dc_tablespaces N 0 00 000000000000000000000000000000 00000000916CD980 dc_rollback_segments Y 0 00 000000000000000000000000000000
  • 13. 0000000092326060 dc_objects Y 0 00 000000000A00424F4F545354524150 00000000916D8CD0 dc_objects N 3 000000009BD91328 000000000600435F4F424A23000000 00000000916DA830 dc_object_ids Y 0 00 380000000000000000000000000000 可以看到持有 row cache lock 的会话是'000000009BD91328', 且该 dc_objects 对象还处于 non-existent 状态, 换而言之真正装载 rowcache 的是启动实例的 LOCAL 服务进程 SQL> select sid,program,event,p1,p2,p3 from v$session where saddr='000000009BD91328'; SID PROGRAM EVENT P1 P2 P3 ----- ------------------------------------------------ ---------------------------------------- -- ---- -- 3294 sqlplus@rh2.oracle.com (TNS V1-V3) db file scattered read 1 378 3 该进程正在等待 db file scattered read,fileid->1,block-378,这些块属于 BOOTSTRAP$表 BOOTSTRAP$对象已从 rowcache 被载入到 library cache 中 SQL> select kglhdadr,kglnaobj from x$kglob where kglobtyp=2 and kglnaobj not like 'X$%'; KGLHDADR KGLNAOBJ -------------------- -------------------- 0000000092326990 BOOTSTRAP$ SQL> select owner||'.'||Name from v$db_object_cache where type='TABLE' and name not like 'X$%'; OWNER||'.'||NAME -------------------------------------------------------------------------------- SYS.BOOTSTRAP$ 初步总结: 1. 在数据库正式 open 前需要恢复字典缓存,这个步骤被称为 cache recovery,其实是 row cache recovery。与官方文档中描述的”cache recovery”不同,row cache recovery 应当是 Oracle Internal 的叫法。 2. 实际执行 row cache recovery 的不是 SMON 进程,而是启动实例的服务进程