为了安全考虑,oracle推荐控制文件至少有两组,如果控制文件在文件系统下,直接拷贝一个即可,如果控制文件存储在asm磁盘组下,如何处理呢?
我们下面做一个实验来解决这个问题:
环境:
数据库版本:oracle 11g 11.2.0.3
操作系统:linux 5.5
存储:asm
1.查询目前控制文件情况:
SQL> show parameter control
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_files string +DATA/sztech/controlfile/curre nt.267.781051935
通过以上查询可知目前控制文件只有一个文件,而且放置在asm磁盘组上.
2.增加一个控制文件
通过命令直接修改 control_files参数实现:
SQL> alter system set c,'+data/sztech/controlfile/control02.ctl' scope=spfile;
System altered.
由于该参数是一个静态参数,需要重启生效.
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.
SQL> startup nomount; ORACLE instance started.
Total System Global Area 217608192 bytes Fixed Size 1344004 bytes Variable Size 167775740 bytes Database Buffers 41943040 bytes Redo Buffers 6545408 bytes
3.恢复新增加的控制文件 [oracle@dbserver ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon May 7 01:20:10 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: SZTECH (not mounted)
RMAN> restore controlfile from '+DATA/sztech/controlfile/current.267.781051935';
Starting restore at 07-MAY-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: copied control file copy output file name=+DATA/sztech/controlfile/current.267.781051935 output file name=+DATA/sztech/controlfile/control02.ctl --根据control_files参数自动恢复控制文件 Finished restore at 07-MAY-12
RMAN>
这里不需要手工在asm磁盘组之间拷贝控制文件,restore会自动恢复控制文件.
4.启动数据库进行验证
[oracle@dbserver ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Mon May 7 01:21:27 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> connect / as sysdba Connected. SQL> alter database mount; --这里能够mount,表明控制文件已经全部就位.
Database altered.
--检验一下目前的控制文件情况:
SQL> show parameter control_file
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string +DATA/sztech/controlfile/current.267.781051935,
+DATA/sztech/controlfile/control02.ctl SQL> alter database open;
Database altered.
以上表明控制文件已经增加成功.
本文章由 甲骨文(重庆思庄)认证学习中心 提供,转贴请注明出处.
|