rman 异机恢复脚本

举报
snowofsummer 发表于 2020/12/27 09:52:11 2020/12/27
【摘要】 新建pfile: initkfptdb.ora *.audit_file_dest='/u01/app/oracle/admin/kfptdb/adump'*.audit_trail='db'*.compatible='11.2.0.4.0'*.control_files='/oradata/KFPTDB/controlfile/o1_mf_g1gsj9w7_.ctl','/archlog/...

新建pfile: initkfptdb.ora 

*.audit_file_dest='/u01/app/oracle/admin/kfptdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/KFPTDB/controlfile/o1_mf_g1gsj9w7_.ctl','/archlog/KFPTDB/controlfile/o1_mf_g1gsj9xx_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata'
*.db_create_online_log_dest_1='/oradata'
*.db_create_online_log_dest_2='/archlog'
*.db_domain=''
*.db_name='kfptdb'
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=kfptdbXDB)'
*.log_archive_dest_1='LOCATION=/archlog'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=1000M
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1655
*.sga_target=9000M
*.undo_tablespace='UNDOTBS1'

恢复控制文件:

 restore controlfile from '/backup/ctlbackup/CTLBAK_KFPTDB_20201222_1313_1';

恢复数据库文件:

rman target  / <<eof
restore database;
exit;
eof
connected to target database: KFPTDB (DBID=3370770057, not open)

RMAN> 
Starting restore at 27-DEC-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1711 device type=DISK

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 /oradata/KFPTDB/datafile/o1_mf_system_g1gsg7f7_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /oradata/KFPTDB/datafile/o1_mf_users_g1gsg7j5_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oradata/KFPTDB/datafile/TS_EXEC_D.dbf
channel ORA_DISK_1: restoring datafile 00009 to /oradata/KFPTDB/datafile/TS_AMP_D.dbf
channel ORA_DISK_1: restoring datafile 00010 to /oradata/KFPTDB/datafile/TS_TASKCENTER_D.dbf
channel ORA_DISK_1: restoring datafile 00011 to /oradata/KFPTDB/datafile/TS_PS_D.dbf
channel ORA_DISK_1: restoring datafile 00014 to /oradata/KFPTDB/datafile/TS_YSJ_D01.dbf
channel ORA_DISK_1: restoring datafile 00017 to /oradata/KFPTDB/datafile/TS_ZXBZ_BAK_D01.dbf
channel ORA_DISK_1: restoring datafile 00019 to /oradata/KFPTDB/datafile/TS_GEMINI_D.dbf
channel ORA_DISK_1: reading from backup piece /backup/oracle/kfptdb/fullbackup/FULLBAK_KFPTDB_20201222_1309_1
channel ORA_DISK_1: piece handle=/backup/oracle/kfptdb/fullbackup/FULLBAK_KFPTDB_20201222_1309_1 tag=DB_FULL_BAK
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 01:31:29
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 00002 to /oradata/KFPTDB/datafile/o1_mf_sysaux_g1gsg7gs_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /oradata/KFPTDB/datafile/o1_mf_undotbs1_g1gsg7h1_.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oradata/KFPTDB/datafile/TS_DEVOPS_D.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oradata/KFPTDB/datafile/TS_API_D.dbf
channel ORA_DISK_1: restoring datafile 00008 to /oradata/KFPTDB/datafile/TS_ESOP_D.dbf
channel ORA_DISK_1: restoring datafile 00012 to /oradata/KFPTDB/datafile/TS_SJJC_D.dbf
channel ORA_DISK_1: restoring datafile 00013 to /oradata/KFPTDB/datafile/TS_IDS_IMP_D.dbf
channel ORA_DISK_1: restoring datafile 00015 to /oradata/KFPTDB/datafile/TS_ZXBZ_D01.dbf
channel ORA_DISK_1: restoring datafile 00016 to /oradata/KFPTDB/datafile/TS_ZSJ_D01.dbf
channel ORA_DISK_1: restoring datafile 00018 to /oradata/KFPTDB/datafile/TS_ZSJ_BAK_D01.dbf
channel ORA_DISK_1: reading from backup piece /backup/oracle/kfptdb/fullbackup/FULLBAK_KFPTDB_20201222_1310_1
channel ORA_DISK_1: piece handle=/backup/oracle/kfptdb/fullbackup/FULLBAK_KFPTDB_20201222_1310_1 tag=DB_FULL_BAK
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 01:26:45
Finished restore at 27-DEC-20

RMAN> 

执行不完全恢复,指定SCN:

RMAN> list backup;


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1313    3.13G      DISK        00:00:00     22-DEC-20      
        BP Key: 1313   Status: AVAILABLE  Compressed: NO  Tag: ARCH_BAK
        Piece Name: /backup/bak/kfptdb/archbackup/ARCHBAK_KFPTDB_20201222_1312_1

  List of Archived Logs in backup set 1313
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    10654   2311086858 21-DEC-20 2311122674 21-DEC-20
  1    10655   2311122674 21-DEC-20 2311141128 21-DEC-20
  1    10656   2311141128 21-DEC-20 2311158645 21-DEC-20
  1    10657   2311158645 21-DEC-20 2311181293 21-DEC-20
  1    10658   2311181293 21-DEC-20 2311206469 21-DEC-20
  1    10659   2311206469 21-DEC-20 2311231692 21-DEC-20
  1    10660   2311231692 21-DEC-20 2311281063 21-DEC-20
  1    10661   2311281063 21-DEC-20 2311483011 22-DEC-20
  1    10662   2311483011 22-DEC-20 2311483024 22-DEC-20

RMAN> recover database until scn  2311483011;

Starting recover at 27-DEC-20
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=10661
channel ORA_DISK_1: reading from backup piece /backup/bak/kfptdb/archbackup/ARCHBAK_KFPTDB_20201222_1312_1
channel ORA_DISK_1: piece handle=/backup/bak/kfptdb/archbackup/ARCHBAK_KFPTDB_20201222_1312_1 tag=ARCH_BAK
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
archived log file name=/archlog/1_10661_995130124.dbf thread=1 sequence=10661
media recovery complete, elapsed time: 00:00:05
Finished recover at 27-DEC-20

OPEN数据库:

SQL> alter database open resetlogs;

Database altered.

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。