很多时候我们需要调整数据库系统的SCN值有的是为了恢复的需要如为了解决ORA 错误
而以下修改纯属无聊:
通过oradebug修改SCN
[oracle@jumper oracle]$ sqlplus / as sysdba
SQL*Plus: Release Production on Wed Dec ::
Copyright (c) Oracle Corporation All rights reserved
Connected to:
Oraclei Enterprise Edition Release Production
With the Partitioning option
JServer Release Production
SQL> col a for
SQL> select CHECKPOINT_CHANGE# a from v$datafile;
A
SQL> oradebug setmypid
Statement processed
SQL> oradebug DUMPvar SGA kcsgscn_kcslf kcsgscn_ [BC BC) = FF
B
SQL> oradebug poke xBC BEFORE: [BC BC) =
AFTER: [BC BC) =
确认更改
SQL> select dbms_flashbackget_system_change_number a from dual;
A
SQL> oradebug DUMPvar SGA kcsgscn_
kcslf kcsgscn_ [BC BC) = FAC A
B
SQL>
SQL> alter system checkpoint;
System altered
SQL> select CHECKPOINT_CHANGE# a from v$datafile;
A
此时无法正常关闭数据库
Oracle会检测到异常:
SQL> shutdown immediate;
ORA: internal error code arguments: [kfhsls_] [] [] [] [] [] [] []
shutdown abort强制关闭数据库
重新启动会出现错误
SQL> shutdown abort;
ORACLE instance shut down
SQL> startup
ORACLE instance started
Total System Global Area bytes
Fixed Size bytes
Variable Size bytes
Database Buffers bytes
Redo Buffers bytes
Database mounted
ORA: internal error code arguments: [] [] [] [] [] [] [] []
通过不完全恢复启动数据库
SQL> recover database using backup controlfile until cancel;
ORA: change generated at // :: needed for thread
ORA: suggestion : /opt/oracle/oradata/conner/archive/_dbf
ORA: change for thread is in sequence #
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA: file needs more recovery to be consistent
ORA: data file : /opt/oracle/oradata/conner/systemdbf
ORA: media recovery not started
SQL> alter database open resetlogs;
Database altered
此时数据库可以正常打开