巧用exclude tablespace 剥离数据库
database June 4th, 2009这其实只是同平台数据库迁移的一个可选择方案。
原理:使用在rman备份时,将不剥离的表空间排除在备份集中,恢复时使用skip tablespace方式将不剥离的表空间skip。
以下仅是 示例:
将不剥离的表空间排除:
RMAN> CONFIGURE EXCLUDE FOR TABLESPACE ttt;
Tablespace TTT will be excluded from future whole database backups
new RMAN configuration parameters are successfully storedRMAN> CONFIGURE EXCLUDE FOR TABLESPACE xml;
Tablespace XML will be excluded from future whole database backups
new RMAN configuration parameters are successfully storedRMAN> CONFIGURE EXCLUDE FOR TABLESPACE boypoo;
Tablespace BOYPOO will be excluded from future whole database backups
new RMAN configuration parameters are successfully storedRMAN> CONFIGURE EXCLUDE FOR TABLESPACE t_4k;
Tablespace T_4K will be excluded from future whole database backups
new RMAN configuration parameters are successfully storedRMAN> CONFIGURE EXCLUDE FOR TABLESPACE ILMTBS ;
Tablespace ILMTBS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored备份数据库:
RMAN> backup database;
Starting backup at 23-OCT-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=297 device type=DISK
file 5 is excluded from whole database backup
file 6 is excluded from whole database backup
file 7 is excluded from whole database backup
file 9 is excluded from whole database backup
file 10 is excluded from whole database backup
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=F:\APP\ADMINISTRATOR\ORADATA\ORA11G\SYSTEM01.DBF
input datafile file number=00002 name=F:\APP\ADMINISTRATOR\ORADATA\ORA11G\SYSAUX01.DBF
input datafile file number=00003 name=F:\APP\ADMINISTRATOR\ORADATA\ORA11G\UNDOTBS01.DBF
input datafile file number=00008 name=F:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\ILM_TOOLKIT_TABLESPACE.F
input datafile file number=00004 name=F:\APP\ADMINISTRATOR\ORADATA\ORA11G\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 23-OCT-08
channel ORA_DISK_1: finished piece 1 at 23-OCT-08
piece handle=F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NNNDF_TAG20081023T205321_4J0WYS0H_.BKP tag=TAG20081023T205321
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:04:56
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 23-OCT-08
channel ORA_DISK_1: finished piece 1 at 23-OCT-08
piece handle=F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NCSNF_TAG20081023T205321_4J0X8SY8_.BKP tag=TAG20081023T205321
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-OCT-08
在新机器上进行恢复:C:\Documents and Settings\Administrator>rman target /
Recovery Manager: Release 11.1.0.6.0 – Production on Thu Oct 23 21:01:26 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 263639040 bytes
Fixed Size 1332552 bytes
Variable Size 226495160 bytes
Database Buffers 29360128 bytes
Redo Buffers 6451200 bytesRMAN> restore controlfile from ‘F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NCSNF_TAG20081023T205321_4J0X8SY8_.BKP’;
restore及recover时需要skip
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1RMAN> restore database skip forever tablespace xml,ttt,boypoo,t_4k,ILMTBS;
Starting restore at 23-OCT-08
Starting implicit crosscheck backup at 23-OCT-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=318 device type=DISK
Crosschecked 22 objects
Finished implicit crosscheck backup at 23-OCT-08Starting implicit crosscheck copy at 23-OCT-08
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 23-OCT-08searching for all files in the recovery area
cataloging files…
cataloging doneList of Cataloged Files
=======================
File Name: F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_1_4J0ZDDC7_.ARC
File Name: F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_3442_4J0XBGF5_.ARC
File Name: F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NCSNF_TAG20081023T205321_4J0X8SY8_.BKPusing channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to F:\APP\ADMINISTRATOR\ORADATA\ORA11G\SYSTEM01.DBF
channel ORA_DISK_1: restoring datafile 00002 to F:\APP\ADMINISTRATOR\ORADATA\ORA11G\SYSAUX01.DBF
channel ORA_DISK_1: restoring datafile 00003 to F:\APP\ADMINISTRATOR\ORADATA\ORA11G\UNDOTBS01.DBF
channel ORA_DISK_1: restoring datafile 00004 to F:\APP\ADMINISTRATOR\ORADATA\ORA11G\USERS01.DBF
channel ORA_DISK_1: restoring datafile 00008 to F:\APP\ADMINISTRATOR\PRODUCT\11.1.0\DB_1\DATABASE\ILM_TOOLKIT_TABLESPACE.F
channel ORA_DISK_1: reading from backup piece F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NNNDF_TAG20081023T205321_4J0W
YS0H_.BKP
channel ORA_DISK_1: piece handle=F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\BACKUPSET\2008_10_23\O1_MF_NNNDF_TAG20081023T205321_4J0WYS0H_.BKP tag
=TAG20081023T205321
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:35
Finished restore at 23-OCT-08RMAN>
RMAN> recover database skip forever tablespace ttt,xml,boypoo,t_4k,ILMTBS;
Starting recover at 23-OCT-08
using channel ORA_DISK_1starting media recovery
archived log for thread 1 with sequence 3441 is already on disk as file F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_
3441_4J0X4398_.ARC
archived log for thread 1 with sequence 3442 is already on disk as file F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_
3442_4J0XBGF5_.ARC
archived log file name=F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_3441_4J0X4398_.ARC thread=1 sequence=3441
archived log file name=F:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORA11G\ARCHIVELOG\2008_10_23\O1_MF_1_3442_4J0XBGF5_.ARC thread=1 sequence=3442
unable to find archived log
archived log thread=1 sequence=3443
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/23/2008 21:33:05
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 3443 and starting SCN of 4307186
open数据库
RMAN> alter database open resetlogs;
database opened
接下来有两件事要做:
1.在原库将剥离出来的表空间删除(drop tablespace xxx including contents and datafiles)及shema信息删除
2.在新库将skip过的表空间删除

Recent Comments