Oracle 入门之控制文件multiplex


Oracle当中的控制文件相当的重要,里面规定了启动和关闭Oracle数据库的一些重要的参数,例如日志文件和数据文件的个数和位置等,所以对这个文件一般要使用multiplex多路复用存储,而且最好存在不同的分区以实现冗余性,但是当多路中的一个控制文件出现问题的时候,Oracle数据库也将无法启动或关闭,下面来简要的介绍下配置方法

[oracle@jsb-ylw-5024 ~]$ sqlplus /nolog   //启动Oracle数据库,并查看当前控制文件的个数和储存位置

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 8 10:48:02 2010

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2213816 bytes
Variable Size             939526216 bytes
Database Buffers          671088640 bytes
Redo Buffers                7286784 bytes
Database mounted.
Database opened.
SQL> show parameter control;    //可以看到当前存在两个控制文件

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u01/oradata/yang/control01.ct
                                                 l, /u01/flash_recovery_area/ya
                                                 ng/control02.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING

SQL> shutdown immediate;      //关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create pfile from spfile;   //根据spfile生成pfile,若使用不同的参数文件,则需要加路径

File created.
SQL> !
[oracle@jsb-ylw-5024 ~]$ cp /u01/oradata/yang/control01.ctl /u01/oracle/control03.ctl   //使用cp命令复制控制文件
[oracle@jsb-ylw-5024 ~]$ grep -i 'control' /u01/oracle/dbs/inityang.ora       //修改pfile的control_files值如下
*.control_files='/u01/oradata/yang/control01.ctl','/u01/flash_recovery_area/yang/control02.ctl','/u01/oracle/control03.ctl'
[oracle@jsb-ylw-5024 ~]$ exit
exit

SQL> startup pfile=$ORACLE_HOME/dbs/inityang.ora   //使用pfile启动oracle数据库
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2213816 bytes
Variable Size             939526216 bytes
Database Buffers          671088640 bytes
Redo Buffers                7286784 bytes
Database mounted.
Database opened.


SQL> show parameter control;      //查看已经修改成功

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u01/oradata/yang/control01.ct
                                                 l, /u01/flash_recovery_area/ya
                                                 ng/control02.ctl, /u01/oracle/
                                                 control03.ctl
control_management_pack_access       string      DIAGNOSTIC+TUNING


SQL> shutdown immediate;   //关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile; //根据pfile生成spfile

File created.

SQL> startup                   //使用spfile启动Oracle
ORACLE instance started.

Total System Global Area 1620115456 bytes
Fixed Size                  2213816 bytes
Variable Size             939526216 bytes
Database Buffers          671088640 bytes
Redo Buffers                7286784 bytes
Database mounted.
Database opened.
SQL> !
[oracle@jsb-ylw-5024 ~]$ mv /u01/oracle/control03.ctl /tmp/
[oracle@jsb-ylw-5024 ~]$ exit
exit

SQL> shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/control03.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

相关内容