為資料庫新增控制檔案

楊奇龍發表於2010-05-28

      此文承接上一篇文章,由於對單個控制檔案恢復後,資料庫裡只有一個控制檔案,所以要為資料庫新增控制檔案。

1)在nomount狀態修改spfile檔案。由於資料庫裡只有一個控制檔案control03.ctl

先將control03.ctl複製後重新命名為control01.ctl ,control02.ctl ,

SQL> conn system/yang as sysdba
Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             138412948 bytes                                      
Database Buffers          390070272 bytes                                      
Redo Buffers                5844992 bytes
                                       
  2)將控制檔案新增到spfile檔案裡。                                                            
SQL> alter system set control_files=
  2  'f:\app\yang\oradata\oracl\control01.ctl',
  3  'f:\app\yang\oradata\oracl\control02.ctl',
  4  'f:\app\yang\oradata\oracl\control03.ctl' scope=spfile;

System altered.

3)修改後應關閉資料庫,重新啟動到nomount狀態時會用到修改過的spfile檔案。
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             138412948 bytes                                      
Database Buffers          390070272 bytes                                      
Redo Buffers                5844992 bytes
 

---出現沒有料到的錯誤,不過重建過控制檔案的話,ORA-00214  並不陌生。                                 
ORA-00214: control file 'F:\APP\YANG\ORADATA\ORACL\CONTROL03.CTL' version 8281
inconsistent with file 'F:\APP\YANG\ORADATA\ORACL\CONTROL01.CTL' version 8279

--此錯誤說明CONTROL03.CTL'   比CONTROL01.CTL'的版本高,

SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
4)重新複製CONTROL03.CTL 並將其重新命名CONTROL01.CTL 再試一下。 
                             
  SQL> alter system set control_files=
  2  'f:\app\yang\oradata\oracl\control01.ctl',
  3  'f:\app\yang\oradata\oracl\control02.ctl',
  4  'f:\app\yang\oradata\oracl\control03.ctl' scope=spfile;
System altered.
SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             134218644 bytes                                      
Database Buffers          394264576 bytes                                      
Redo Buffers                5844992 bytes
                                      
ORA-00214: control file 'F:\APP\YANG\ORADATA\ORACL\CONTROL01.CTL' version 8295
inconsistent with file 'F:\APP\YANG\ORADATA\ORACL\CONTROL02.CTL' version 8279

--此錯誤說明CONTROL01.CTL'   比CONTROL02.CTL'的版本高,號碼改變了,因為我實驗的時候開啟了資料庫。關閉資料庫再次修改,

SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             134218644 bytes                                      
Database Buffers          394264576 bytes                                      
Redo Buffers                5844992 bytes                                      
Database mounted.
SQL> select name from v$controlfile;
NAME                                                                           
--------------------------------------------------------------------------------
F:\APP\YANG\ORADATA\ORACL\CONTROL01.CTL                                        
F:\APP\YANG\ORADATA\ORACL\CONTROL02.CTL                                        
F:\APP\YANG\ORADATA\ORACL\CONTROL03.CTL                                        

這一次成功。。

不知道我的方法有什麼不妥,希望各位拍磚。。。。

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

相關文章