当前位置:编程学习 > 网站相关 >>

增加控制文件副本

在ASM和本地磁盘的2种情况下控制文件配置多个副本。
归档模式下的情况:
SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /u01/oracle/10g/arch
Oldest online log sequence     22
Next log sequence to archive   24
Current log sequence           24
本地磁盘方式:
SQL>  show parameter control_files;
 
NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
control_files                 string     /u01/oracle/10g/oradata/gt10g/
                         control1.ctl
SQL> alter system set control_files='/u01/oracle/10g/oradata/gt10g/control1.ctl','/u01/oracle/10g/oradata/gt10g/control2.ctl' scope=spfile;
 
System altered.
 
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
接下来我们可以使用RMAN方式来恢复控制文件
RMAN> startup nomount;
 
Oracle instance started
 
Total System Global Area     520093696 bytes
 
Fixed Size                     2097496 bytes
Variable Size                138415784 bytes
Database Buffers             373293056 bytes
Redo Buffers                   6287360 bytes
 
RMAN> restore controlfile from '/u01/oracle/10g/oradata/gt10g/control1.ctl';
 
Starting restore at 25-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
 
channel ORA_DISK_1: copied control file copy
output filename=/u01/oracle/10g/oradata/gt10g/control1.ctl
output filename=/u01/oracle/10g/oradata/gt10g/control2.ctl
Finished restore at 25-FEB-13
 
RMAN> sql 'alter database mount';
 
sql statement: alter database mount
released channel: ORA_DISK_1
 
RMAN> sql 'alter database open';
 
sql statement: alter database open
 
SQL>  show parameter control_files;
 
NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
control_files                 string     /u01/oracle/10g/oradata/gt10g/
                         control1.ctl, /u01/oracle/10g/
                         oradata/gt10g/control2.ctl
 
也可以使用pfile的方式修改参数文件指向新的控制文件的OS cp副本,这里就不做演示。
                         
ASM方式:
SQL> show parameter control_files;
 
NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
control_files                 string     +DATA01/gt10g/controlfile/curr
                         ent.257.808238085
SQL> alter system set control_files='+DATA01/gt10g/controlfile/current.257.808238085','+DATA01','+DATA01' scope=spfile;
 
System altered.
 
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
 
RMAN> startup nomount;
 
Oracle instance started
 
Total System Global Area     520093696 bytes
 
Fixed Size                     2097496 bytes
Variable Size                138415784 bytes
Database Buffers             373293056 bytes
Redo Buffers                   6287360 bytes
 
RMAN> restore controlfile from '+DATA01/gt10g/controlfile/current.257.808238085';
 
Starting restore at 25-FEB-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
 
channel ORA_DISK_1: copied control file copy
output filename=+DATA01/gt10g/controlfile/current.257.808238085
output filename=+DATA01/gt10g/controlfile/current.268.808304299
output filename=+DATA01/gt10g/controlfile/current.267.808304301
Finished restore at 25-FEB-13
 
RMAN> sql 'alter database mount';
 
sql statement: alter database mount
released channel: ORA_DISK_1
 
RMAN> sql 'alter database open';
 
sql statement: alter database open
 www.zzzyk.com
SQL> show parameter control_files;
 
NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
control_files                 string     +DATA01/gt10g/controlfile/curr
                         ent.257.808238085, +DATA01/gt1
                         0g/controlfile/current.268.808
                         304299, +DATA01/gt10g/controlf
                         ile/current.267.808304301
                         
非归档模式下的配置方式也是一样,就不在演示。
-The End-
补充:综合编程 , 其他综合 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,