为数据库添加控制文件

      此文承接上一篇文章,由于对单个控制文件恢复后,数据库里只有一个控制文件,所以要为数据库添加控制文件。

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                                        

这一次成功。。

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

上一篇:史上最全Redis高可用技术解决方案大全


下一篇:Asp.net2.0实现Word转换Html,同时分享系列笑话