如果資料庫僅有一組control file檔案,需要添加一組或者多組,保證一組檔案損壞或者丢失導緻資料庫當機。
-- 環境說明
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> show parameter cluster;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
0、記錄現有控制檔案路徑
SQL>select name from v$controlfile;SQL> select name from v$controlfile;
NAME
+DATA/devdb/controlfile/current.260.936769367
+FLASH/devdb/controlfile/current.256.936769367
1、關閉兩個節點
$ srvctl stop database -d devdb
2、在其中一個節點上啟動rman
[oracle@node1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Dec 27 16:59:10 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
3、将資料庫啟動到nomount狀态下
RMAN> startup nomount;
Oracle instance started
Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 989856648 bytes
Database Buffers 3271557120 bytes
Redo Buffers 12107776 bytes
4、采用restore拷貝一份controlfile到新路徑
RMAN> restore controlfile to '+FLASH/devdb/controlfile/current.256.936769368' from '+DATA/devdb/controlfile/current.260.936769367';
Starting restore at 27-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=50 instance=orcl1 device type=DISK
channel ORA_DISK_1: copied control file copy
Finished restore at 27-DEC-16
說明:’+FLASH/devdb/controlfile/current.256.936769368’是拷貝的新的控制檔案,
如果asm自動管理的,可能名字不會按照你的命名,需要确定下新的檔案名字。
ASMCMD> pwd
+FLASH/devdb/controlfile/
ASMCMD> ls
current.303.956019293 > 跟你指定的不一樣
5. sqlplus 中 修改控制檔案路徑, 修改完成後,關閉資料庫
SQL> alter system set control_files='+DATA/devdb/controlfile/current.260.936769367','+FLASH/devdb/controlfile/current.256.936769367','+FLASH/devdb/controlfile/current.303.956019293' scope=spfile sid='*';
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
6、啟動資料庫
[grid@node1 oracle]$ srvctl start database -d devdb
7、驗證
SQL> select name from v$controlfile;
+FLASH/devdb/controlfile/current.303.956019293
文章可以轉載,必須以連結形式标明出處。
本文轉自 張沖andy 部落格園部落格,原文連結: http://www.cnblogs.com/andy6/p/7612360.html ,如需轉載請自行聯系原作者