4.2 修改CRS注册表中相关配置信息
(1) 挂载新的ASM磁盘组
-
[grid@rac1 ~]$ sqlplus / as sysasm
-
-
SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 00:16:05 2013
-
-
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 Real Application Clusters and Automatic Storage Management options
-
-
SQL>
-
SQL> selectname,state from v$asm_diskgroup;
-
-
NAME STATE
-
-
SYSTEMDG MOUNTED
-
ARCLOGDG DISMOUNTED
-
DATADG DISMOUNTED
-
-
SQL> alter diskgroup ARCLOGDG,DATADG mount;
-
-
Diskgroup altered.
(2) 更改CRS配置文件中数据库的磁盘组为DATADG和ARCLOGDG
-
[root@rac1 ~]# srvctl modifydatabase -d csdb -a "DATADG,ARCLOGDG"
(3) 禁用并删除原来的磁盘组DATA
-
[root@rac1 ~]# srvctl disable diskgroup -g DATA
-
[root@rac1 ~]# srvctl remove diskgroup -g DATA
-
-
[root@rac1 rac-cluster]# crs_stat -t -v
-
Name Type R/RA F/FT Target State Host
-
-
ora....OGDG.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
-
ora.DATADG.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
-
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE rac1
-
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
-
ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE rac1
-
ora.csdb.db ora....se.type 0/2 0/1 ONLINE OFFLINE
-
ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE rac1
-
ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
-
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE rac1
-
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE rac1
-
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE rac1
-
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
-
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
-
ora.rac1.gsd application 0/5 0/0 OFFLINE OFFLINE
-
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
-
ora.rac1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
-
ora.rac2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
-
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1
(4) 在OCR注册表中修改Oracle数据库参数文件的位置
-
[root@rac1 ~]# srvctl modifydatabase -d csdb -p +DATADG/csdb/spfilecsdb.ora
4.3 恢复数据库
(1) 查看备份文件路径和名称
-
[root@rac1 ~]# su - oracle
-
[oracle@rac1 ~]$
-
[oracle@rac1 ~]$ cd /u01/app/oracle/backup
-
[oracle@rac1 backup]$ ll
-
total 221796
-
-rw-r
-
-rw-r
-
-rw-r
-
-rw-r
-
-rw-r
-
[oracle@rac1 backup]$
(2) 创建一个基本的启动参数文件,以便启动数据库到nomout状态恢复spfile
-
[oracle@rac1 ~]$ touch /u01/app/oracle/backup/init.ora
-
[oracle@rac1 ~]$ vi /u01/app/oracle/backup/init.ora
-
-
*.db_name='csdb'
-
*.remote_login_passwordfile='exclusive'
(3) 使用刚创建的参数文件将数据库启动到nomount状态
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 13:56:06 2013
-
-
Copyright (c) 1982, 2011, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL> startup nomount pfile='/u01/app/oracle/backup/init.ora';
-
ORACLE instance started.
-
-
Total System Global Area 238034944 bytes
-
Fixed Size 2227136 bytes
-
Variable Size 180356160 bytes
-
Database Buffers 50331648 bytes
-
Redo Buffers 5120000 bytes
-
SQL>
(4) 使用RMAN恢复SPFILE到ASM磁盘组DATADG
-
[oracle@rac1 ~]$ rman target /
-
-
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 6 13:59:26 2013
-
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
-
connected to target database: CSDB (not mounted)
-
-
RMAN> restore spfile to'+DATADG/csdb/spfilecsdb.ora'from'/u01/app/oracle/backup/spfile_0doe04js_1_1_20130705';
-
-
Starting restore at 06-JUL-13
-
using channel ORA_DISK_1
-
-
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/backup/spfile_0doe04js_1_1_20130705
-
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
-
Finished restore at 06-JUL-13
(5) 使用恢复后spfile启动数据库,并修改control_files,db_recovery_file_dest,log_archive_dest等存在旧路径的参数值。
-
[oracle@rac1 ~]$ vi $ORACLE_HOME/dbs/initcsdb1.ora
-
-
SPFILE='+DATADG/csdb/spfilecsdb.ora'
-
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 14:11:58 2013
-
-
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, OLAP, Data Mining
-
andReal Application Testing options
-
-
SQL> startup nomount force
-
ORACLE instance started.
-
-
Total System Global Area 1653518336 bytes
-
Fixed Size 2228904 bytes
-
Variable Size 1073745240 bytes
-
Database Buffers 570425344 bytes
-
Redo Buffers 7118848 bytes
-
SQL>
-
SQL> show parameter control_files
-
-
NAME TYPE VALUE
-
-
control_files string +DATA/csdb/control01.ctl, +DAT
-
A/csdb/control02.ctl
-
SQL>
-
SQL> alter system set control_files='+DATADG/csdb/control01.ctl','+DATADG/csdb/control02.ctl' scope=spfile
-
-
System altered.
-
-
SQL> alter system set db_recovery_file_dest='+DATADG' scope=spfile;
-
-
System altered.
-
-
SQL> alter system set log_archive_dest_1='LOCATION=+ARCLOGDG' scope=spfile;
-
-
System altered.
-
-
SQL> startup force nomount;
-
ORACLE instance started.
-
-
Total System Global Area 1653518336 bytes
-
Fixed Size 2228904 bytes
-
Variable Size 1073745240 bytes
-
Database Buffers 570425344 bytes
-
Redo Buffers 7118848 bytes
(6) 查看数据库的DBID
-
[oracle@rac1 ~]$ strings /u01/app/oracle/backup/CSDB_819991120_5.bk | grep MAXVALUE,
-
-
返回的值类似下面的例子,其中那一窜数字即为DBID。
-
...
-
MAXVALUE, MAXVALUE!
-
3042905279, MAXVALUE,
-
3042905279, MAXVALUE,
-
...
(7) 恢复控制文件到新的ASM磁盘组DATADG
-
[oracle@rac1 ~]$ rman target /
-
-
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 6 14:28:28 2013
-
-
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
-
-
connected to target database: CSDB (not mounted)
-
-
RMAN> set dbid=3042905279
-
-
executing command: SET DBID
-
-
RMAN> restore controlfile from'/u01/app/oracle/backup/ctl_file_0coe04jq_1_1_20130705.ctl';
-
-
Starting restore at 06-JUL-13
-
using target database control file insteadof recovery catalog
-
allocated channel: ORA_DISK_1
-
channel ORA_DISK_1: SID=18 instance=csdb1 device type=DISK
-
-
channel ORA_DISK_1: restoring control file
-
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
-
output file name=+DATADG/csdb/control01.ctl
-
output file name=+DATADG/csdb/control02.ctl
-
Finished restore at 06-JUL-13
(8) 进入SQLPLUS,查看旧数据文件信息
-
[oracle@rac1 ~]$ sqlplus / as sysdba
-
-
SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 14:41:12 2013
-
-
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 andReal Application Testing options
-
-
SQL> alterdatabase mount;
-
-
Database altered.
-
SQL> col name format a50
-
SQL> select file#,namefrom v$datafile;
-
-
FILE# NAME
-
-
1 +DATA/csdb/datafile/system.260.819979847
-
2 +DATA/csdb/datafile/sysaux.261.819979871
-
3 +DATA/csdb/datafile/undotbs1.262.819979889
-
4 +DATA/csdb/datafile/undotbs2.264.819979905
-
5 +DATA/csdb/datafile/users.265.819979913
(9) 使用RMAN恢复数据库
(10) 更改REDO LOG位置信息
-
SQL> select member from v$logfile;
-
-
MEMBER
-
-
+DATA/csdb/redo01.log
-
+DATA/csdb/redo02.log
-
+DATA/csdb/redo03.log
-
+DATA/csdb/redo04.log
-
-
SQL> alterdatabase rename file '+DATA/csdb/redo01.log'to'+DATADG/csdb/redo01.log';
-
-
Database altered.
-
-
SQL> alterdatabase rename file '+DATA/csdb/redo02.log'to'+DATADG/csdb/redo02.log';
-
-
Database altered.
-
-
SQL> alterdatabase rename file '+DATA/csdb/redo03.log'to'+DATADG/csdb/redo03.log';
-
-
Database altered.
-
-
SQL> alterdatabase rename file '+DATA/csdb/redo04.log'to'+DATADG/csdb/redo04.log';
-
-
Database altered.
(11) 打开数据库
-
SQL> alterdatabaseopen resetlogs;
-
-
Database altered.
(12) 更改TEMP表空间文件位置
-
SQL> selectnamefrom v$tempfile;
-
-
NAME
-
-
+DATA/csdb/tempfile/temp.263.819979895
-
-
SQL> alter tablespace tempadd tempfile '+DATADG';
-
-
Tablespace altered.
-
-
-
SQL> alter tablespace tempdrop tempfile '+DATA/csdb/tempfile/temp.263.819979895';
-
-
Tablespace altered
4.4 完成恢复操作
(1) 在其他RAC节点上更改OCR路径
-
[root@rac2 ~]# vi /etc/oracle/ocr.loc
-
-
ocrconfig_loc=+SYSTEMDG
-
local_only=FALSE
(2) 在恢复节点上重启CRS
-
[root@rac1 ~]# crsctl stop crs
-
[root@rac1 ~]# crsctl start has
(3) 在其他节点上启动CRS
-
[root@rac2 ~]# crsctl start crs
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25542870/viewspace-2144777/
,如需转载,请注明出处,否则将追究法律责任。