科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道Oracle HowTo:如何更改数据库的SCN?

Oracle HowTo:如何更改数据库的SCN?

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

本文介绍了更改数据库的SCN的问题。

作者:盖国强 来源:eygle.com 2007年10月2日

关键字: 盖国强 ORACLE

  • 评论
  • 分享微博
  • 分享邮件

很多时候,我们需要调整数据库系统的SCN值,有的是为了恢复的需要,如为了解决ORA-600 2662错误.

而以下修改纯属无聊:

1.通过oradebug修改SCN

[oracle@jumper oracle]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 21 10:33:35 2005
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> col a for 999999999999999
SQL> select CHECKPOINT_CHANGE# a from v$datafile;
              A
---------------
   107374358304
   107374358304
   107374358304
SQL> oradebug setmypid
Statement processed.
SQL> oradebug DUMPvar SGA kcsgscn_
kcslf kcsgscn_ [5000BC68, 5000BC88) = 00000019 0002F97F 00004979
00000000 00000000 00000000 00000000 5000B948
SQL> oradebug poke 0x5000BC69 4 8
BEFORE: [5000BC68, 5000BC70) = 00000019
AFTER:  [5000BC68, 5000BC70) = 00000819

2.确认更改

SQL> select dbms_flashback.get_system_change_number a from dual;
               A
----------------
   8903467399681
SQL> oradebug DUMPvar SGA kcsgscn_
kcslf kcsgscn_ [5000BC68, 5000BC88) = 00000819 0002FA0C 00004A75
00000000 00000000 00000000 00000000 5000B948
SQL>
SQL> alter system checkpoint;
System altered.
SQL> select CHECKPOINT_CHANGE# a from v$datafile;
               A
----------------
   8903467399867
   8903467399867
   8903467399867

3.此时无法正常关闭数据库

Oracle会检测到异常:

SQL> shutdown immediate;
ORA-00600: internal error code, arguments: [kfhsls_02], [20], [1], [], [], [], [], [] 

4.shutdown abort强制关闭数据库

重新启动会出现错误

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area  114365800 bytes
Fixed Size                   451944 bytes
Variable Size              50331648 bytes
Database Buffers           62914560 bytes
Redo Buffers                 667648 bytes
Database mounted.
ORA-00600: internal error code, arguments: [3756], [1], [25], [195904], [2073], [195259], [], [] 

5.通过不完全恢复启动数据库

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 8903467399867 generated at 12/21/2005 10:57:34 needed for thread 1
ORA-00289: suggestion : /opt/oracle/oradata/conner/archive/1_18.dbf
ORA-00280: change 8903467399867 for thread 1 is in sequence #18

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/oradata/conner/system01.dbf'

ORA-01112: media recovery not started

SQL> alter database open resetlogs;
Database altered.

此时数据库可以正常打开

查看本文来源

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章