oracle 官方文档关于修改控制文件的描述,个人觉得有点问题,应该先shutdown 数据库,然后再copy文件
To add a multiplexed copy of the current control file or to rename a control file:
-
Shut down the database.
-
Copy an existing control file to a new location, using operating system commands.
-
Edit the
CONTROL_FILES
parameter in the database initialization parameter file to add the new control file name, or to change the existing control filename. -
Restart the database.
SQL> show parameter control_files;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/oracle/oradata/stone/cont
rol01.ctl, /u01/oracle/oradata
/stone/control02.ctl, /u01/ora
cle/oradata/stone/control03.ct
l
SQL>
SQL> !cp /u01/oracle/oradata/stone/control01.ctl /u01/control04.ctl
SQL> alter system set control_files = '/u01/control04.ctl','/u01/oracle/oradata/stone/control01.ctl','/u01/oracle/oradata/stone/control02.ctl' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> SQL> SQL>
SQL>
SQL>
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 297795584 bytes
Fixed Size 1219040 bytes
Variable Size 96470560 bytes
Database Buffers 192937984 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/u01/oracle/oradata/stone/system01.dbf'
ORA-01207: file is more recent than control file - old control file
SQL> select status from v$instance;
STATUS
------------
MOUNTED
要指定scope=spfile
SQL> alter system set control_files = '/u01/control04.ctl,/u01/oracle/oradata/stone/control01.ctl,/u01/oracle/oradata/stone/control02.ctl';
alter system set control_files = '/u01/control04.ctl,/u01/oracle/oradata/stone/control01.ctl,/u01/oracle/oradata/stone/control02.ctl'
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set control_files = '/u01/control04.ctl,/u01/oracle/oradata/stone/control01.ctl,/u01/oracle/oradata/stone/control02.ctl' scope=spfile;
System altered.
SQL> alter system set control_files = '/u01/control04.ctl','/u01/oracle/oradata/stone/control01.ctl','/u01/oracle/oradata/stone/control02.ctl' scope=spfile;
System altered.