一、查看控制文件和spfile文件位置
[root@node1 ~]# su - oracle
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期三 8月 16 09:58:38 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter spf
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATADG/prod/spfileprod.ora
SQL> show parameter contr
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATADG/prod/controlfile/curre
nt.260.947712913
control_management_pack_access string DIAGNOSTIC+TUNING
二、关闭两个节点
[oracle@node2 /]srvctl stop database -d PROD
[oracle@node1 /]srvctl stop database -d PROD
三、在其中一节点利用RMAN复制控制文件
[oracle@node1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on 星期三 8月 16 10:01:45 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 922750952 bytes
Database Buffers 318767104 bytes
Redo Buffers 8892416 bytes
RMAN> restore controlfile to '+DATADG' from '+DATADG/PROD/CONTROLFILE/Current.260.947712913';
Starting restore at 16-8月 -17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=15 instance=PROD1 device type=DISK
channel ORA_DISK_1: copied control file copy
Finished restore at 16-8月 -17
RMAN> exit
Recovery Manager complete.
四、确定新复制的控制文件名
[grid@node2 ~]$ asmcmd
ASMCMD> cd DATADG
ASMCMD> ls
PROD/
ASMCMD> cd PROD
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileprod.ora
ASMCMD> cd CONTROLFILE
ASMCMD> ls
Current.260.947712913
current.272.952164187
五、修改spfile文件
SQL> create pfile='/u01/0816.ora' from spfile='+DATADG/prod/spfileprod.ora';
File created.
[oracle@node1 u01]$ vi 0816.ora
*.control_files='+DATADG/prod/controlfile/current.260.947712913'
*.control_files='+DATADG/prod/controlfile/current.272.952164187'
SQL> create spfile='+DATADG/prod/spfileprod.ora' from pfile='/u01/0816.ora';
File created.
六、修改完成,查看
[oracle@node1 ~]$ srvctl start database -d PROD
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期三 8月 16 10:09:39 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter contr
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATADG/prod/controlfile/curre
nt.260.947712913, +DATADG/prod
/controlfile/current.272.95216
4187
control_management_pack_access string DIAGNOSTIC+TUNING
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATADG/prod/spfileprod.ora
注意:复制控制文件之前要关闭数据库,否则会出现控制文件版本不一致的报错
还有另外一种方式,在关库情况下直接在ASM里面复制,但是控制文件名字不能和ASM命名机制相同,
ASMCMD> cp current.272.952164187 current.272.952164188
copying +DATADG/PROD/CONTROLFILE/current.272.952164187 -> +DATADG/PROD/CONTROLFILE/current.272.952164188
ASMCMD-8016: copy source '+DATADG/PROD/CONTROLFILE/current.272.952164187' and target '+DATADG/PROD/CONTROLFILE/current.272.952164188' failed
ORA-15056: additional error message
ORA-15046: ASM file name '+DATADG/PROD/CONTROLFILE/current.272.952164188' is not in single-file creation form
ORA-06512: at "SYS.X$DBMS_DISKGROUP", line 415
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)
ASMCMD> cp current.272.952164187 current.272.95216418744444
copying +DATADG/PROD/CONTROLFILE/current.272.952164187 -> +DATADG/PROD/CONTROLFILE/current.272.95216418744444
然后再修改spfile文件即可。建议使用第一种方法
[root@node1 ~]# su - oracle
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期三 8月 16 09:58:38 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter spf
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATADG/prod/spfileprod.ora
SQL> show parameter contr
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATADG/prod/controlfile/curre
nt.260.947712913
control_management_pack_access string DIAGNOSTIC+TUNING
二、关闭两个节点
[oracle@node2 /]srvctl stop database -d PROD
[oracle@node1 /]srvctl stop database -d PROD
三、在其中一节点利用RMAN复制控制文件
[oracle@node1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on 星期三 8月 16 10:01:45 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 922750952 bytes
Database Buffers 318767104 bytes
Redo Buffers 8892416 bytes
RMAN> restore controlfile to '+DATADG' from '+DATADG/PROD/CONTROLFILE/Current.260.947712913';
Starting restore at 16-8月 -17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=15 instance=PROD1 device type=DISK
channel ORA_DISK_1: copied control file copy
Finished restore at 16-8月 -17
RMAN> exit
Recovery Manager complete.
四、确定新复制的控制文件名
[grid@node2 ~]$ asmcmd
ASMCMD> cd DATADG
ASMCMD> ls
PROD/
ASMCMD> cd PROD
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileprod.ora
ASMCMD> cd CONTROLFILE
ASMCMD> ls
Current.260.947712913
current.272.952164187
五、修改spfile文件
SQL> create pfile='/u01/0816.ora' from spfile='+DATADG/prod/spfileprod.ora';
File created.
[oracle@node1 u01]$ vi 0816.ora
*.control_files='+DATADG/prod/controlfile/current.260.947712913'
*.control_files='+DATADG/prod/controlfile/current.272.952164187'
SQL> create spfile='+DATADG/prod/spfileprod.ora' from pfile='/u01/0816.ora';
File created.
六、修改完成,查看
[oracle@node1 ~]$ srvctl start database -d PROD
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期三 8月 16 10:09:39 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter contr
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATADG/prod/controlfile/curre
nt.260.947712913, +DATADG/prod
/controlfile/current.272.95216
4187
control_management_pack_access string DIAGNOSTIC+TUNING
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATADG/prod/spfileprod.ora
注意:复制控制文件之前要关闭数据库,否则会出现控制文件版本不一致的报错
还有另外一种方式,在关库情况下直接在ASM里面复制,但是控制文件名字不能和ASM命名机制相同,
ASMCMD> cp current.272.952164187 current.272.952164188
copying +DATADG/PROD/CONTROLFILE/current.272.952164187 -> +DATADG/PROD/CONTROLFILE/current.272.952164188
ASMCMD-8016: copy source '+DATADG/PROD/CONTROLFILE/current.272.952164187' and target '+DATADG/PROD/CONTROLFILE/current.272.952164188' failed
ORA-15056: additional error message
ORA-15046: ASM file name '+DATADG/PROD/CONTROLFILE/current.272.952164188' is not in single-file creation form
ORA-06512: at "SYS.X$DBMS_DISKGROUP", line 415
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)
ASMCMD> cp current.272.952164187 current.272.95216418744444
copying +DATADG/PROD/CONTROLFILE/current.272.952164187 -> +DATADG/PROD/CONTROLFILE/current.272.95216418744444
然后再修改spfile文件即可。建议使用第一种方法
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29618264/viewspace-2143615/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29618264/viewspace-2143615/