控制文件(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實例啟動!