ASM中如何配置多个控制文件
我们日常对数据库进行配置管理时,为了保证数据库的安全,通常会配置多个控制文件,以防单一控制文件的损坏引起数据库的宕机。如果数据库采用了ASM存储方案,假如只创建一个ASM磁盘组的话,控制文件默认只有一个,这样显然无助于数据库的保护。事实上我们可以通过简单的一些操作把对ASM中的控制文件进行多个配置:
一、将控制文件从文件系统迁移到ASM:
SQL> show parameter control_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /home/oracle/control01.ctl, /h
ome/oracle/control02.ctl, /hom
e/oracle/control03.ctl
SQL> show parameter db_create_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string +DATA
SQL> alter system reset control_files scope=spfile;
alter system reset control_files scope=spfile
*
ERROR at line 1:
ORA-00905: missing keyword
SQL> alter system reset control_files scope=spfile sid=\'*\';
System altered.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 8388608000 bytes
Fixed Size 2086096 bytes
Variable Size 4479519536 bytes
Database Buffers 3892314112 bytes
Redo Buffers 14688256 bytes
dw2:/u01/oracle/product/10g/db/bin>$./rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Mon Dec 3 10:17:05 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: test (not mounted)
RMAN> restore controlfile from \'/home/oracle/control01.ctl\';
Starting restore at 2007-12-03 10:17:12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1091 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DATA/test/controlfile/current.1623.640347437
Finished restore at 2007-12-03 10:17:21
二、可以看到ASM默认只会创建一个控制文件+DATA/test/controlfile/current.1623.640347437,且控制文件的名字由于遵循了ASM的命名方式,比较怪异。我们现在要将名字改为control01.ctl,control02.ctl,control03.ctl这样比较直观的名字。首先对当前控制文件进行一个备份,备份的路径为我们想要的ASM上的控制文件:
SQL> alter database mount database;
Database altered.
SQL> alter database backup controlfile to \'+DATA/test/controlfile/control01.ctl\';
Database altered.
SQL> alter system set control_files=\'+DATA/test/controlfile/control01.ctl\' scope=spfile;
System altered.
Elapsed: 00:00:00.00
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
三、以新的控制文件MOUNT数据库,然后再对控制文件依样进行备份,更改参数文件,成功地配置了多个控制文件:
SQL> startup nomount
ORACLE instance started.
Total System Global Area 8388608000 bytes
Fixed Size 2086096 bytes
Variable Size 4479519536 bytes
Database Buffers 3892314112 bytes
Redo Buffers 14688256 bytes
SQL> alter database mount database;
Database altered.
SQL> alter database backup controlfile to \'+DATA/test/controlfile/control02.ctl\';
Database altered.
SQL> alter database backup controlfile to \'+DATA/test/controlfile/control03.ctl\';
Database altered.
SQL> alter system set control_files=\'+DATA/test/controlfile/control01.ctl\',\'+DATA/test/controlfile/control02.ctl\',\'+DATA/test/controlfile/control03.ctl\' scope=spfile;
System altered.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 8388608000 bytes
Fixed Size 2086096 bytes
Variable Size 4479519536 bytes
Database Buffers 3892314112 bytes
Redo Buffers 14688256 bytes
SQL> alter database mount database;
Database altered.
四、通过ASM命令行工具asmcmd可以看到事实上我们设置的控制文件命名规范还是遵照ASM的命名方式的,它会通过一个LINK链接到我们想要的控制文件名字:
ASMCMD> ls
Backup.2882.640347745
Backup.4733.640348283
Backup.5043.640348291
control01.ctl
control02.ctl
control03.ctl
current.1623.640347437
ASMCMD> rm Backup.2882.640347745
ORA-15032: not all alterations performed
ORA-15028: ASM file \'+DATA/TEST/CONTROLFILE/Backup.2882.640347745\' not dropped; currently being accessed (DBD ERROR: OCIStmtExecute)
ASMCMD> ls -alt
Type Redund Striped Time Sys Name
CONTROLFILE UNPROT FINE DEC 03 10:00:00 Y none => current.1623.640347437
N control03.ctl => +DATA/TEST/CONTROLFILE/Backup.5043.640348291
N control02.ctl => +DATA/TEST/CONTROLFILE/Backup.4733.640348283
N control01.ctl => +DATA/TEST/CONTROLFILE/Backup.2882.640347745
CONTROLFILE UNPROT FINE DEC 03 10:00:00 Y +DATA/TEST/CONTROLFILE/control03.ctl => Backup.5043.640348291
CONTROLFILE UNPROT FINE DEC 03 10:00:00 Y +DATA/TEST/CONTROLFILE/control02.ctl => Backup.4733.640348283
CONTROLFILE UNPROT FINE DEC 03 10:00:00 Y +DATA/TEST/CONTROLFILE/control01.ctl => Backup.2882.640347745
建议继续学习:
- ASM使用AIX raw disk的问题 (阅读:3695)
- Oracle ASM存储方式浅析 (阅读:3199)
- ASM装载磁盘组时ORA-15063错误处理 (阅读:2517)
- ASM的争论 (阅读:2269)
- ASM的争论 (阅读:2232)
- 用ASM和iSCSI实现的另类HA方案 (阅读:1957)
- ASM的优点总结–关于日志文件调整 (阅读:1515)
- ASM HEADER 备份与恢复 (阅读:1458)
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:blue_prince 来源: blue_prince
- 标签: ASM
- 发布时间:2009-10-11 00:13:45
- [54] IOS安全–浅谈关于IOS加固的几种方法
- [52] android 开发入门
- [52] 如何拿下简短的域名
- [51] 图书馆的世界纪录
- [49] Oracle MTS模式下 进程地址与会话信
- [49] Go Reflect 性能
- [47] 【社会化设计】自我(self)部分――欢迎区
- [46] 读书笔记-壹百度:百度十年千倍的29条法则
- [36] 程序员技术练级攻略
- [29] 视觉调整-设计师 vs. 逻辑