模擬控制檔案丟失進行恢復。

煙花丶易冷發表於2016-04-27
模擬三個控制檔案丟失

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size             121636456 bytes
Database Buffers          155189248 bytes
Redo Buffers                7168000 bytes
ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 687
inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 673


SQL> shutdown abort;
ORACLE instance shut down.




ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size             121636456 bytes
Database Buffers          155189248 bytes
Redo Buffers                7168000 bytes


SQL> alter system set control_files='/u01/oracle/oradata/orcl/control03.ctl'scope=spfile;


System altered.


SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 687
inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 673




SQL> alter system set control_files='/u01/oracle/oradata/orcl/control01.ctl'scope=spfile
  2  ;


System altered.


SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 687
inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 673




SQL> alter system set control_files='/u01/oracle/oradata/orcl/control02.ctl'scope=spfile
  2  ;


System altered.


SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file '/u01/oracle/oradata/orcl/control01.ctl' version 687
inconsistent with file '/u01/oracle/oradata/orcl/control02.ctl' version 673




SQL> select status from v$instance;


STATUS
------------
STARTED


SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size             121636456 bytes
Database Buffers          155189248 bytes
Redo Buffers                7168000 bytes
SQL> alter system set control_files='/u01/oracle/oradata/orcl/control03.ctl' scope=spfile;


System altered.


SQL> alter database mount;


Database altered.


SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/u01/oracle/oradata/orcl/system01.dbf'
ORA-01207: file is more recent than control file - old control file




SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.


Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size             121636456 bytes
Database Buffers          155189248 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database open;


Database altered.
____________________________________________________________________________________________




控制檔案恢復後
今天檢視錶空間發現個MISSING00005資料檔案   --->原因:編輯控制檔案的時候被遺漏掉的資料檔案(example表空間)
SQL> select file_id,tablespace_name,file_name,online_status from dba_data_files;


   FILE_ID TABLESPACE_NAME      FILE_NAME                                ONLINE_
---------- -------------------- ---------------------------------------- -------
         6 TEST                 /u01/oracle/oradata/orcl/test01.dbf      ONLINE
         4 USERS                /u01/oracle/oradata/orcl/users01.dbf     ONLINE
         2 UNDOTBS1             /u01/oracle/oradata/orcl/undotbs01.dbf   ONLINE
         3 SYSAUX               /u01/oracle/oradata/orcl/sysaux01.dbf    ONLINE
         1 SYSTEM               /u01/oracle/oradata/orcl/system01.dbf    SYSTEM
         5 EXAMPLE              /u01/oracle/db_1/dbs/MISSING00005        RECOVER


6 rows selected.






SQL> alter tablespace example rename datafile '/u01/oracle/db_1/dbs/MISSING00005' to '/u01/oracle/oradata/orcl/example01.dbf';


Tablespace altered.


SQL> select file_id,tablespace_name,file_name,online_status from dba_data_files;


   FILE_ID TABLESPACE_NAME      FILE_NAME                                ONLINE_
---------- -------------------- ---------------------------------------- -------
         6 TEST                 /u01/oracle/oradata/orcl/test01.dbf      ONLINE
         4 USERS                /u01/oracle/oradata/orcl/users01.dbf     ONLINE
         2 UNDOTBS1             /u01/oracle/oradata/orcl/undotbs01.dbf   ONLINE
         3 SYSAUX               /u01/oracle/oradata/orcl/sysaux01.dbf    ONLINE
         1 SYSTEM               /u01/oracle/oradata/orcl/system01.dbf    SYSTEM
         5 EXAMPLE              /u01/oracle/oradata/orcl/example01.dbf   RECOVER


6 rows selected.


SQL> select name from v$datafile;


NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/orcl/system01.dbf
/u01/oracle/oradata/orcl/undotbs01.dbf
/u01/oracle/oradata/orcl/sysaux01.dbf
/u01/oracle/oradata/orcl/users01.dbf
/u01/oracle/oradata/orcl/example01.dbf
/u01/oracle/oradata/orcl/test01.dbf


6 rows selected.





中間不知道什麼原因試了好多次才成功,這個還有待研究。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29618264/viewspace-2089051/,如需轉載,請註明出處,否則將追究法律責任。

相關文章