熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

如何更改數據庫的SCN?

2022-06-13   來源: Oracle 

  

  很多時候我們需要調整數據庫系統的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

  此時數據庫可以正常打開


From:http://tw.wingwit.com/Article/program/Oracle/201311/17746.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.