程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> ASM中如何配置多個控制文件

ASM中如何配置多個控制文件

編輯:Oracle數據庫基礎
 

我們日常對數據庫進行配置管理時,為了保證數據庫的安全,通常會配置多個控制文件,以防單一控制文件的損壞引起數據庫的宕機。如果數據庫采用了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)
 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved