- SYS@+ASM1 SQL>create diskgroup racfra_ext external redundancy disk '/dev/oracleasm/disks/VOL2';
- Diskgroup created.
- SYS@+ASM1 SQL>show parameter diskgroup
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- asm_diskgroups string RACFRA, RACDAT_EXT, RACFRA_EXT
- SYS@racdb1 SQL>alter system set log_archive_dest_1='LOCATION=+RACFRA_EXT/racdb/' scope=both sid='*';
- System altered.
- SYS@racdb1 SQL>alter system set db_recovery_file_dest='+RACFRA_EXT' SCOPE=BOTH SID='*';
- System altered.
- SYS@racdb1 SQL>select name from v$datafile
- union
- select name from v$tempfile
- union
- select member from v$logfile
- union
- select filename from v$block_change_tracking
- union
- select name from v$controlfile
- order by 1;
- NAME
- --------------------------------------------------------------------------------
- +RACDAT_EXT/racdb/controlfile/current.257.781130523
- +RACDAT_EXT/racdb/datafile/sysaux.282.781168791
- +RACDAT_EXT/racdb/datafile/system.272.781168791
- +RACDAT_EXT/racdb/datafile/tbs_test.279.781168793
- +RACDAT_EXT/racdb/datafile/tbs_test2.276.781168797
- +RACDAT_EXT/racdb/datafile/tbs_test2.277.781168795
- +RACDAT_EXT/racdb/datafile/ts_big1.275.781168947
- +RACDAT_EXT/racdb/datafile/ts_big2.280.781168791
- +RACDAT_EXT/racdb/datafile/undotbs1.281.781168791
- +RACDAT_EXT/racdb/datafile/undotbs2.278.781168793
- +RACDAT_EXT/racdb/datafile/users.287.781168791
- +RACDAT_EXT/racdb/onlinelog/group_1.274.781169975
- +RACDAT_EXT/racdb/onlinelog/group_2.273.781169983
- +RACDAT_EXT/racdb/onlinelog/group_3.267.781169991
- +RACDAT_EXT/racdb/onlinelog/group_4.266.781170011
- +RACDAT_EXT/racdb/tempfile/temp.265.781170033
- +RACFRA/racdb/controlfile/current.302.781130525
- +RACFRA/racdb/onlinelog/group_1.264.781169977
- +RACFRA/racdb/onlinelog/group_2.309.781169985
- +RACFRA/racdb/onlinelog/group_3.287.781169999
- +RACFRA/racdb/onlinelog/group_4.280.781170017
- 22 rows selected.
4) 在新的磁盘组中增加新的redo log member并删除位于原磁盘组的member
- SYS@racdb1 SQL>alter database add logfile member '+racfra_ext' to group 1;
- Database altered.
- SYS@racdb1 SQL>alter database add logfile member '+racfra_ext' to group 2;
- Database altered.
- SYS@racdb1 SQL>alter database add logfile member '+racfra_ext' to group 3;
- Database altered.
- SYS@racdb1 SQL>alter database add logfile member '+racfra_ext' to group 4;
- Database altered.
- SYS@racdb1 SQL>select group#,status from v$log;
- GROUP# STATUS
- ---------- ----------------
- 1 INACTIVE
- 2 CURRENT
- 3 INACTIVE
- 4 CURRENT
- SYS@racdb1 SQL>select member from v$logfile order by 1;
- MEMBER
- --------------------------------------------------------------------------------
- +RACDAT_EXT/racdb/onlinelog/group_1.274.781169975
- +RACDAT_EXT/racdb/onlinelog/group_2.273.781169983
- +RACDAT_EXT/racdb/onlinelog/group_3.267.781169991
- +RACDAT_EXT/racdb/onlinelog/group_4.266.781170011
- +RACFRA/racdb/onlinelog/group_1.264.781169977
- +RACFRA/racdb/onlinelog/group_2.309.781169985
- +RACFRA/racdb/onlinelog/group_3.287.781169999
- +RACFRA/racdb/onlinelog/group_4.280.781170017
- +RACFRA_EXT/racdb/onlinelog/group_1.256.781264871
- +RACFRA_EXT/racdb/onlinelog/group_2.258.781264885
- +RACFRA_EXT/racdb/onlinelog/group_3.260.781264899
- +RACFRA_EXT/racdb/onlinelog/group_4.262.781264911
- 12 rows selected.
- SYS@racdb1 SQL>alter database drop logfile member '+RACFRA/racdb/onlinelog/group_1.264.781169977';
- Database altered.
- SYS@racdb1 SQL>alter database drop logfile member '+RACFRA/racdb/onlinelog/group_3.287.781169999';
- Database altered.
- SYS@racdb1 SQL>alter system switch all logfile;
- System altered.
- SYS@racdb1 SQL>select group#,status from v$log;
- GROUP# STATUS
- ---------- ----------------
- 1 CURRENT
- 2 INACTIVE
- 3 CURRENT
- 4 INACTIVE
- SYS@racdb1 SQL>alter database drop logfile member '+RACFRA/racdb/onlinelog/group_2.309.781169985';
- Database altered.
- SYS@racdb1 SQL>alter database drop logfile member '+RACFRA/racdb/onlinelog/group_4.280.781170017';
- Database altered.
- SYS@racdb1 SQL>select member from v$logfile order by 1;
- MEMBER
- --------------------------------------------------------------------------------
- +RACDAT_EXT/racdb/onlinelog/group_1.274.781169975
- +RACDAT_EXT/racdb/onlinelog/group_2.273.781169983
- +RACDAT_EXT/racdb/onlinelog/group_3.267.781169991
- +RACDAT_EXT/racdb/onlinelog/group_4.266.781170011
- +RACFRA_EXT/racdb/onlinelog/group_1.256.781264871
- +RACFRA_EXT/racdb/onlinelog/group_2.258.781264885
- +RACFRA_EXT/racdb/onlinelog/group_3.260.781264899
- +RACFRA_EXT/racdb/onlinelog/group_4.262.781264911
- 8 rows selected.
5) 份数据库,然后单独备份一份控制文件:
- oracle@Linux1]./rmanL0_main.sh
- RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11>
- [oracle@Linux1]
- SYS@racdb1 SQL>alter database backup controlfile to '+RACFRA_EXT';
- Database altered.
6) 修改spfile,将指向原磁盘组的控制文件指向新磁盘组位置
- SYS@racdb1 SQL>show parameter control
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- control_file_record_keep_time integer 7
- control_files string +RACDAT_EXT/racdb/controlfile/
- current.257.781130523, +RACFRA
- /racdb/controlfile/current.302
- .781130525
- SYS@racdb1 SQL>alter system set control_files='+RACDAT_EXT/racdb/controlfile/current.257.781130523','+RACFRA_EXT/racdb/controlfile/current.302.781130525' SCOPE=SPFILE SID='*';
- System altered.
- SYS@racdb1 SQL>CREATE PFILE='/mnt/share/pfile20120422.ora' from spfile;
- File created.
7) 关闭所有实例
- [oracle@Linux1]crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora....SM1.asm application ONLINE ONLINE linux1
- ora....X1.lsnr application ONLINE ONLINE linux1
- ora.linux1.gsd application ONLINE ONLINE linux1
- ora.linux1.ons application ONLINE ONLINE linux1
- ora.linux1.vip application ONLINE ONLINE linux1
- ora....SM2.asm application ONLINE ONLINE linux2
- ora....X2.lsnr application ONLINE ONLINE linux2
- ora.linux2.gsd application ONLINE ONLINE linux2
- ora.linux2.ons application ONLINE ONLINE linux2
- ora.linux2.vip application ONLINE ONLINE linux2
- ora.racdb.db application ONLINE ONLINE linux1
- ora....b1.inst application ONLINE ONLINE linux1
- ora....b2.inst application ONLINE ONLINE linux2
- ora...._taf.cs application OFFLINE OFFLINE
- ora....db1.srv application OFFLINE OFFLINE
- ora....db2.srv application OFFLINE OFFLINE
- [oracle@Linux1]srvctl stop database -d racdb
- [oracle@Linux1]crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora....SM1.asm application ONLINE ONLINE linux1
- ora....X1.lsnr application ONLINE ONLINE linux1
- ora.linux1.gsd application ONLINE ONLINE linux1
- ora.linux1.ons application ONLINE ONLINE linux1
- ora.linux1.vip application ONLINE ONLINE linux1
- ora....SM2.asm application ONLINE ONLINE linux2
- ora....X2.lsnr application ONLINE ONLINE linux2
- ora.linux2.gsd application ONLINE ONLINE linux2
- ora.linux2.ons application ONLINE ONLINE linux2
- ora.linux2.vip application ONLINE ONLINE linux2
- ora.racdb.db application OFFLINE OFFLINE
- ora....b1.inst application OFFLINE OFFLINE
- ora....b2.inst application OFFLINE OFFLINE
- ora...._taf.cs application OFFLINE OFFLINE
- ora....db1.srv application OFFLINE OFFLINE
- ora....db2.srv application OFFLINE OFFLINE
8) 在一个节点上以nomount方式启动实例,并用备份的controlfile进行控制文件的恢复
- [oracle@Linux1]rman target /
- Recovery Manager: Release 10.2.0.5.0 - Production on Sun Apr 22 11:01:08 2012
- Copyright (c) 1982, 2007, Oracle. All rights reserved.
- connected to target database (not started)
- RMAN> startup nomount;
- Oracle instance started
- Total System Global Area 1224736768 bytes
- Fixed Size 2095896 bytes
- Variable Size 251659496 bytes
- Database Buffers 956301312 bytes
- Redo Buffers 14680064 bytes
- RMAN> restore controlfile from '+racfra_ext/racdb/controlfile/Backup.270.781267749';
- Starting restore at 22-APR-2012 11:05:04
- using channel ORA_DISK_1
- channel ORA_DISK_1: copied control file copy
- output filename=+RACDAT_EXT/racdb/controlfile/current.263.781268709
- output filename=+RACFRA_EXT/racdb/controlfile/current.269.781268713
- Finished restore at 22-APR-2012 11:05:25
9) 还原并打开数据库
- RMAN> alter database mount;
- database mounted
- released channel: ORA_DISK_1
- RMAN> recover database;
- Starting recover at 22-APR-2012 11:08:42
- Starting implicit crosscheck backup at 22-APR-2012 11:08:42
- allocated channel: ORA_DISK_1
- Crosschecked 7 objects
- Finished implicit crosscheck backup at 22-APR-2012 11:08:43
- Starting implicit crosscheck copy at 22-APR-2012 11:08:43
- using channel ORA_DISK_1
- Finished implicit crosscheck copy at 22-APR-2012 11:08:44
- searching for all files in the recovery area
- cataloging files...
- cataloging done
- List of Cataloged Files
- =======================
- File Name: +racfra_ext/RACDB/CONTROLFILE/Backup.270.781267749
- using channel ORA_DISK_1
- datafile 6 not processed because file is read-only
- starting media recovery
- archive log thread 1 sequence 8 is already on disk as file +RACDAT_EXT/racdb/onlinelog/group_2.273.781169983
- archive log thread 2 sequence 6 is already on disk as file +RACFRA_EXT/racdb/onlinelog/group_4.262.781264911
- archive log thread 2 sequence 8 is already on disk as file +RACDAT_EXT/racdb/onlinelog/group_4.266.781170011
- archive log filename=+RACDAT_EXT/racdb/onlinelog/group_2.273.781169983 thread=1 sequence=8
- archive log filename=+RACDAT_EXT/racdb/onlinelog/group_4.266.781170011 thread=2 sequence=8
- media recovery complete, elapsed time: 00:00:04
- Finished recover at 22-APR-2012 11:08:53
- RMAN> alter database open resetlogs;
- database opened
- SYS@racdb1 SQL>show parameter control
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- control_file_record_keep_time integer 7
- control_files string +RACDAT_EXT/racdb/controlfile/
- current.263.781268709, +RACFRA
- _EXT/racdb/controlfile/current
- .269.781268713
因为实例使用spfile启动,因此在做controlfile恢复时spfile中的控制文件指向已经自动用恢复后的控制文件替代了
10) 建立一个新的L0全备份
- [oracle@Linux1]./rmanL0_main.sh
- RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11>
11) 将原磁盘组置于nomount状态并重新启动RAC数据库测试
- SYS@+ASM1 SQL>select name,type,state from v$asm_diskgroup;
- NAME TYPE STATE
- ------------------------------ ------ -----------
- RACDAT_EXT EXTERN MOUNTED
- RACFRA NORMAL MOUNTED
- RACFRA_EXT EXTERN MOUNTED
- SYS@+ASM1 SQL>alter diskgroup racfra dismount;
- Diskgroup altered.
- SYS@+ASM1 SQL>select name,type,state from v$asm_diskgroup;
- NAME TYPE STATE
- ------------------------------ ------ -----------
- RACDAT_EXT EXTERN MOUNTED
- RACFRA DISMOUNTED
- RACFRA_EXT EXTERN MOUNTED
- [oracle@Linux1]crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora....SM1.asm application ONLINE ONLINE linux1
- ora....X1.lsnr application ONLINE ONLINE linux1
- ora.linux1.gsd application ONLINE ONLINE linux1
- ora.linux1.ons application ONLINE ONLINE linux1
- ora.linux1.vip application ONLINE ONLINE linux1
- ora....SM2.asm application ONLINE ONLINE linux2
- ora....X2.lsnr application ONLINE ONLINE linux2
- ora.linux2.gsd application ONLINE ONLINE linux2
- ora.linux2.ons application ONLINE ONLINE linux2
- ora.linux2.vip application ONLINE ONLINE linux2
- ora.racdb.db application OFFLINE OFFLINE
- ora....b1.inst application OFFLINE OFFLINE
- ora....b2.inst application OFFLINE OFFLINE
- ora...._taf.cs application OFFLINE OFFLINE
- ora....db1.srv application OFFLINE OFFLINE
- ora....db2.srv application OFFLINE OFFLINE
- [oracle@Linux1]srvctl start instance -d racdb -i racdb1
- [oracle@Linux1]crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora....SM1.asm application ONLINE ONLINE linux1
- ora....X1.lsnr application ONLINE ONLINE linux1
- ora.linux1.gsd application ONLINE ONLINE linux1
- ora.linux1.ons application ONLINE ONLINE linux1
- ora.linux1.vip application ONLINE ONLINE linux1
- ora....SM2.asm application ONLINE ONLINE linux2
- ora....X2.lsnr application ONLINE ONLINE linux2
- ora.linux2.gsd application ONLINE ONLINE linux2
- ora.linux2.ons application ONLINE ONLINE linux2
- ora.linux2.vip application ONLINE ONLINE linux2
- ora.racdb.db application ONLINE ONLINE linux2
- ora....b1.inst application ONLINE ONLINE linux1
- ora....b2.inst application ONLINE OFFLINE
- ora...._taf.cs application OFFLINE OFFLINE
- ora....db1.srv application OFFLINE OFFLINE
- ora....db2.srv application OFFLINE OFFLINE
12) 删除磁盘组
- SYS@+ASM1 SQL>select name,type,state from v$asm_diskgroup;
- NAME TYPE STATE
- ------------------------------ ------ -----------
- RACDAT_EXT EXTERN MOUNTED
- RACFRA DISMOUNTED
- RACFRA_EXT EXTERN MOUNTED
- SYS@+ASM1 SQL>alter diskgroup racfra mount;
- Diskgroup altered.
- SYS@+ASM1 SQL>drop diskgroup racfra including contents;
- Diskgroup dropped.
- SYS@+ASM1 SQL>select name,type,state from v$asm_diskgroup;
- NAME TYPE STATE
- ------------------------------ ------ -----------
- RACDAT_EXT EXTERN MOUNTED
- RACFRA_EXT EXTERN MOUNTED
13) 重启各个节点的crs,一切OK,至此测试结束
- [oracle@Linux1]crs_stat -t
- Name Type Target State Host
- ------------------------------------------------------------
- ora....SM1.asm application ONLINE ONLINE linux1
- ora....X1.lsnr application ONLINE ONLINE linux1
- ora.linux1.gsd application ONLINE ONLINE linux1
- ora.linux1.ons application ONLINE ONLINE linux1
- ora.linux1.vip application ONLINE ONLINE linux1
- ora....SM2.asm application ONLINE ONLINE linux2
- ora....X2.lsnr application ONLINE ONLINE linux2
- ora.linux2.gsd application ONLINE ONLINE linux2
- ora.linux2.ons application ONLINE ONLINE linux2
- ora.linux2.vip application ONLINE ONLINE linux2
- ora.racdb.db application ONLINE ONLINE linux1
- ora....b1.inst application ONLINE ONLINE linux1
- ora....b2.inst application ONLINE ONLINE linux2
- ora...._taf.cs application OFFLINE OFFLINE
- ora....db1.srv application OFFLINE OFFLINE
- ora....db2.srv application OFFLINE OFFLINE
- SYS@+ASM1 SQL>select g.name diskgroup,d.name diskname,
- d.path diskpath,
- g.type grouptype,
- g.state groupstate,
- d.state diskstate
- from v$asm_diskgroup g,v$asm_disk d
- where g.group_number(+)=d.group_number;
- DISKGROUP DISKNAME DISKPATH GROUPT GROUPSTATE DISKSTAT
- --------------- ------------------------------ ---------------------------------------- ------ ----------- --------
- /dev/oracleasm/disks/VOL5 NORMAL
- /dev/oracleasm/disks/VOL6 NORMAL
- /dev/oracleasm/disks/VOL3 NORMAL
- /dev/oracleasm/disks/VOL4 NORMAL
- RACDAT_EXT RACDAT_EXT_0000 /dev/oracleasm/disks/VOL1 EXTERN MOUNTED NORMAL
- RACFRA_EXT RACFRA_EXT_0000 /dev/oracleasm/disks/VOL2 EXTERN MOUNTED NORMAL