设为首页 收藏本站
查看: 720|回复: 0

[经验分享] Oracle 学习之RMAN(十五)恢复实战--TSPITR

[复制链接]

尚未签到

发表于 2018-9-9 10:05:46 | 显示全部楼层 |阅读模式
RMAN> RECOVER TABLESPACE 'TSPITR' UNTIL LOGSEQ 3  AUXILIARY DESTINATION '/backup/aux';  

  
Starting recover at 2015/07/09 15:16:06
  
using target database control file instead of recovery catalog
  
allocated channel: ORA_DISK_1
  
channel ORA_DISK_1: SID=47 device type=DISK
  
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time
  

  
List of tablespaces expected to have UNDO segments
  
Tablespace SYSTEM
  
Tablespace UNDOTBS1
  

  
Creating automatic instance, with SID='nkvk'
  

  
initialization parameters used for automatic instance:
  
db_name=DEVDB
  
db_unique_name=nkvk_tspitr_DEVDB
  
compatible=11.2.0.0.0
  
db_block_size=8192
  
db_files=200
  
sga_target=280M
  
processes=50
  
db_create_file_dest=/backup/aux
  
log_archive_dest_1='location=/backup/aux'
  
#No auxiliary parameter file used
  

  

  
starting up automatic instance DEVDB
  

  
Oracle instance started
  

  
Total System Global Area     292278272 bytes
  

  
Fixed Size                     2227744 bytes
  
Variable Size                100663776 bytes
  
Database Buffers             184549376 bytes
  
Redo Buffers                   4837376 bytes
  
Automatic instance created
  
Running TRANSPORT_SET_CHECK on recovery set tablespaces
  
TRANSPORT_SET_CHECK completed successfully
  

  
contents of Memory Script:
  
{
  
# set requested point in time
  
set until  logseq 3 thread 1;
  
# restore the controlfile
  
restore clone controlfile;
  
# mount the controlfile
  
sql clone 'alter database mount clone database';
  
# archive current online log
  
sql 'alter system archive log current';
  
# avoid unnecessary autobackups for structural changes during TSPITR
  
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
  
}
  
executing Memory Script
  

  
executing command: SET until clause
  

  
Starting restore at 2015/07/09 15:16:22
  
allocated channel: ORA_AUX_DISK_1
  
channel ORA_AUX_DISK_1: SID=19 device type=DISK
  

  
channel ORA_AUX_DISK_1: starting datafile backup set restore
  
channel ORA_AUX_DISK_1: restoring control file
  
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T144032_bsw5ycl2_.bkp
  
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_ncsnf_TAG20150709T144032_bsw5ycl2_.bkp tag=TAG20150709T144032
  
channel ORA_AUX_DISK_1: restored backup piece 1
  
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
  
output file name=/backup/aux/DEVDB/controlfile/o1_mf_bsw7y759_.ctl
  
Finished restore at 2015/07/09 15:16:24
  

  
sql statement: alter database mount clone database
  

  
sql statement: alter system archive log current
  

  
sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;
  

  
contents of Memory Script:
  
{
  
# set requested point in time
  
set until  logseq 3 thread 1;
  
plsql ;
  
# set destinations for recovery set and auxiliary set datafiles
  
set newname for clone datafile  1 to new;
  
set newname for clone datafile  3 to new;
  
set newname for clone datafile  2 to new;
  
set newname for clone tempfile  1 to new;
  
set newname for datafile  6 to
  
"/u01/app/oracle/oradata/devdb/tspitr01.dbf";
  
# switch all tempfiles
  
switch clone tempfile all;
  
# restore the tablespaces in the recovery set and the auxiliary set
  
restore clone datafile  1, 3, 2, 6;
  
switch clone datafile all;
  
}
  
executing Memory Script
  

  
executing command: SET until clause
  

  
sql statement: alter tablespace "TSPITR" offline immediate
  

  
executing command: SET NEWNAME
  

  
executing command: SET NEWNAME
  

  
executing command: SET NEWNAME
  

  
executing command: SET NEWNAME
  

  
executing command: SET NEWNAME
  

  
renamed tempfile 1 to /backup/aux/DEVDB/datafile/o1_mf_temp_%u_.tmp in control file
  

  
Starting restore at 2015/07/09 15:16:29
  
using channel ORA_AUX_DISK_1
  

  
channel ORA_AUX_DISK_1: starting datafile backup set restore
  
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  
channel ORA_AUX_DISK_1: restoring datafile 00001 to /backup/aux/DEVDB/datafile/o1_mf_system_%u_.dbf
  
channel ORA_AUX_DISK_1: restoring datafile 00003 to /backup/aux/DEVDB/datafile/o1_mf_undotbs1_%u_.dbf
  
channel ORA_AUX_DISK_1: restoring datafile 00002 to /backup/aux/DEVDB/datafile/o1_mf_sysaux_%u_.dbf
  
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/devdb/tspitr01.dbf
  
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T144032_bsw5v1cb_.bkp
  
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_nnndf_TAG20150709T144032_bsw5v1cb_.bkp tag=TAG20150709T144032
  
channel ORA_AUX_DISK_1: restored backup piece 1
  
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
  
Finished restore at 2015/07/09 15:17:34
  

  
datafile 1 switched to datafile copy
  
input datafile copy RECID=5 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_system_bsw7yg0d_.dbf
  
datafile 3 switched to datafile copy
  
input datafile copy RECID=6 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_undotbs1_bsw7yg16_.dbf
  
datafile 2 switched to datafile copy
  
input datafile copy RECID=7 STAMP=884618255 file name=/backup/aux/DEVDB/datafile/o1_mf_sysaux_bsw7yg0j_.dbf
  

  
contents of Memory Script:
  
{
  
# set requested point in time
  
set until  logseq 3 thread 1;
  
# online the datafiles restored or switched
  
sql clone "alter database datafile  1 online";
  
sql clone "alter database datafile  3 online";
  
sql clone "alter database datafile  2 online";
  
sql clone "alter database datafile  6 online";
  
# recover and open resetlogs
  
recover clone database tablespace  "TSPITR", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
  
alter clone database open resetlogs;
  
}
  
executing Memory Script
  

  
executing command: SET until clause
  

  
sql statement: alter database datafile  1 online
  

  
sql statement: alter database datafile  3 online
  

  
sql statement: alter database datafile  2 online
  

  
sql statement: alter database datafile  6 online
  

  
Starting recover at 2015/07/09 15:17:35
  
using channel ORA_AUX_DISK_1
  

  
starting media recovery
  

  
channel ORA_AUX_DISK_1: starting archived log restore to default destination
  
channel ORA_AUX_DISK_1: restoring archived log
  
archived log thread=1 sequence=2
  
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144220_bsw5ydxj_.bkp
  
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DEVDB/backupset/2015_07_09/o1_mf_annnn_TAG20150709T144220_bsw5ydxj_.bkp tag=TAG20150709T144220
  
channel ORA_AUX_DISK_1: restored backup piece 1
  
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
  
archived log file name=/backup/aux/1_2_884613136.dbf thread=1 sequence=2
  
channel clone_default: deleting archived log(s)
  
archived log file name=/backup/aux/1_2_884613136.dbf RECID=3 STAMP=884618256
  
media recovery complete, elapsed time: 00:00:01
  
Finished recover at 2015/07/09 15:17:38
  

  
database opened
  

  
contents of Memory Script:
  
{
  
# make read only the tablespace that will be exported
  
sql clone 'alter tablespace  "TSPITR" read only';
  
# create directory for datapump import
  
sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
  
/backup/aux''";
  
# create directory for datapump export
  
sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
  
/backup/aux''";
  
}
  
executing Memory Script
  

  
sql statement: alter tablespace  "TSPITR" read only
  

  
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup/aux''
  

  
sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/backup/aux''
  

  
Performing export of metadata...
  
   EXPDP> Starting "SYS"."TSPITR_EXP_nkvk":
  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
  
   EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
  
   EXPDP> Master table "SYS"."TSPITR_EXP_nkvk" successfully loaded/unloaded
  
   EXPDP> ******************************************************************************
  
   EXPDP> Dump file set for SYS.TSPITR_EXP_nkvk is:
  
   EXPDP>   /backup/aux/tspitr_nkvk_59637.dmp
  
   EXPDP> ******************************************************************************
  
   EXPDP> Datafiles required for transportable tablespace TSPITR:
  
   EXPDP>   /u01/app/oracle/oradata/devdb/tspitr01.dbf
  
   EXPDP> Job "SYS"."TSPITR_EXP_nkvk" successfully completed at 15:19:40
  
Export completed
  

  

  
contents of Memory Script:
  
{
  
# shutdown clone before import
  
shutdown clone immediate
  
# drop target tablespaces before importing them back
  
sql 'drop tablespace  "TSPITR" including contents keep datafiles';
  
}
  
executing Memory Script
  

  
database closed
  
database dismounted
  
Oracle instance shut down
  

  
sql statement: drop tablespace  "TSPITR" including contents keep datafiles
  

  
Removing automatic instance
  
shutting down automatic instance
  
target database instance not started
  
Automatic instance removed
  
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_temp_bsw80r22_.tmp deleted
  
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_3_bsw80n92_.log deleted
  
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_2_bsw80m9y_.log deleted
  
auxiliary instance file /backup/aux/DEVDB/onlinelog/o1_mf_1_bsw80lhs_.log deleted
  
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_sysaux_bsw7yg0j_.dbf deleted
  
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_undotbs1_bsw7yg16_.dbf deleted
  
auxiliary instance file /backup/aux/DEVDB/datafile/o1_mf_system_bsw7yg0d_.dbf deleted
  
auxiliary instance file /backup/aux/DEVDB/controlfile/o1_mf_bsw7y759_.ctl deleted
  
RMAN-00571: ===========================================================
  
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  
RMAN-00571: ===========================================================
  
RMAN-03002: failure of recover command at 07/09/2015 15:20:10
  
RMAN-03015: error occurred in stored script Memory Script
  
RMAN-03009: failure of sql command on default channel at 07/09/2015 15:20:10
  
RMAN-11003: failure during parse/execution of SQL statement: drop tablespace  "TSPITR" including contents keep datafiles
  
ORA-00604: error occurred at recursive SQL level 1
  
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
  

  
RMAN>



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-568593-1-1.html 上篇帖子: Oracle表联结之嵌套循环 下篇帖子: Oracle学习之DATAGUARD(一) DG架构
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表