Oracle推进SCN系列:使用oradebug在mount状态下推进SCN

环境:RHEL 6.5(x86-64) + Oracle 11.2.0.4
声明:推进SCN属于非常规恢复范畴,不建议非专业人员操作,否则后果自负。
需求:我这里演示下推进SCN 10W数量级,实际需求推进多少可以根据ORA-600 [2662] [a] [b] [c] [d] [e]具体值来确认。

ARGUMENTS:
Arg [a] Current SCN WRAP
Arg [b] Current SCN BASE
Arg [c] dependent SCN WRAP
Arg [d] dependent SCN BASE
Arg [e] Where present this is the DBA where the dependent SCN came from.

更多详情可参考: ORA-600 [2662] "Block SCN is ahead of Current SCN" (文档 ID 28929.1)

1.查看当前数据库的Current SCN

SYS@orcl> select current_scn||'' from v$database;

CURRENT_SCN||''
--------------------------------------------------------------------------------
4563483988

可以看到当前SCN是4563483988,我现在想推进SCN,在10w级别,也就是4563483988标红数字修改为指定值。

2.重新启动数据库到mount阶段

重新启动数据库到mount阶段:

SYS@orcl> shutdown abort
ORACLE instance shut down.
SYS@orcl> startup mount
ORACLE instance started.

Total System Global Area 1235959808 bytes
Fixed Size                  2252784 bytes
Variable Size             788529168 bytes
Database Buffers          436207616 bytes
Redo Buffers                8970240 bytes
Database mounted.

3.使用oradebug poke推进SCN

我这里直接把十万位的"4"改为"9"了,相当于推进了50w左右:
说明:实验发现oradebug poke 推进的SCN值,既可以指定十六进制的0x11008DE74,也可以直接指定十进制的4563983988。

SYS@orcl> oradebug setmypid
Statement processed.
SYS@orcl> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
SYS@orcl> select to_char(checkpoint_change#, 'XXXXXXXXXXXXXXXX') from v$database;

TO_CHAR(CHECKPOINT_CHANGE#,'XXXXXX
----------------------------------
        110013C41

SYS@orcl> oradebug poke 0x06001AE70 8 4563983988
BEFORE: [06001AE70, 06001AE78) = 00000000 00000000
AFTER:  [06001AE70, 06001AE78) = 1008DE74 00000001

SYS@orcl> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 1008DE74 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000

SYS@orcl> alter database open;

Database altered.

SYS@orcl> select current_scn||'' from v$database;

CURRENT_SCN||''
--------------------------------------------------------------------------------
4563984271

可以看到已经成功将SCN推进到4563983988,SCN不断增长,所以这里查到的值略大一些。

猜你喜欢

转载自www.cnblogs.com/jyzhao/p/9242352.html
SCN