Oracle 11g在ASM磁碟組上添加控制檔案,11gasm
控制檔案(Control File)是Oracle的物理檔案之一,它記錄了資料庫的名字、資料檔案的位置等資訊。控制檔案的重要性在於,一旦控制檔案損壞,資料庫將會宕機。如果沒有資料庫的備份和歸檔記錄檔,資料庫將無法恢複。因此,我們應該多路鏡像控制檔案(Multiplex Control Files),並把每個鏡像的控制檔案分布在不同的物理磁碟。根據經驗,控制檔案多路鏡像以後,幾個控制檔案同時壞掉的可能性幾乎為零。控制檔案管理的重心是重在預防,而不是亡羊補牢!
今天做在測試環境為control file建立多重路徑鏡像控制檔案!
環境:RHEL6.4 ORACLE 11.2.0.3 RAC
1:查看現在的控制檔案:
SQL> select * from V$CONTROLFILE; STATUS NAME IS_ BLOCK_SIZE FILE_SIZE_BLKS
------- ------------------------------------------------------------ --- ---------- --------------
+SYSTEM/gtsdb/controlfile/current.260.870609283 NO 16384 1128
2. 修改spfile中的控制檔案參數
SQL> alter system set control_files='+SYSTEM/gtsdb/controlfile/current.260.870609283','+ARCHIVE','+DATA' SCOPE=SPFILE;System altered.
3:停資料庫srvctl stop database -d gtsdb
4:將資料庫執行個體啟動到nomount狀態startup nomount
5:使用rman還原controlfile
SQL> startup nomount
ORACLE instance started.
Total System Global Area 3323752448 bytes
Fixed Size 2232920 bytes
Variable Size 838864296 bytes
Database Buffers 2466250752 bytes
Redo Buffers 16404480 bytes
[oracle@gtsdb1 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Feb 7 11:48:15 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: GTSDB (not mounted)
RMAN> restore controlfile from '+SYSTEM/gtsdb/controlfile/current.260.870609283';
Starting restore at 2015/02/07 11:48:22
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1425 instance=gtsdb1 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+SYSTEM/gtsdb/controlfile/current.260.870609283
output file name=+ARCHIVE/gtsdb/controlfile/current.259.871040903
output file name=+DATA/gtsdb/controlfile/current.258.871040903
Finished restore at 2015/02/07 11:48:26
RMAN>
RMAN>
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
RMAN> exit
Recovery Manager complete.
[oracle@gtsdb1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sat Feb 7 11:49:10 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select open_mode,name from v$database;
OPEN_MODE NAME
-------------------- ---------
READ WRITE GTSDB
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+SYSTEM/gtsdb/controlfile/current.260.870609283
+ARCHIVE/gtsdb/controlfile/current.259.871040903
+DATA/gtsdb/controlfile/current.258.871040903
6:將節點2執行個體啟動!