第一范文网 - 专业文章范例文档资料分享平台

oracle数据库RMAN的全备份和还原及恢复

来源:用户分享 时间:2020-06-17 本文由你奈我何 分享 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

RMAN的全备份和还原及恢复

RMAN> backup database format '/u01/oracle/backup/full_%d_%s_%U_bak plus archivelog all delete all input';

Starting backup at 22-SEP-12

using target database control file instead of recovery catalog allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=143 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00001 name=/u01/oradata/oracl/system01.dbf input datafile fno=00003 name=/u01/oradata/oracl/sysaux01.dbf input datafile fno=00005 name=/u01/oradata/oracl/example01.dbf input datafile fno=00002 name=/u01/oradata/oracl/undotbs01.dbf input datafile fno=00004 name=/u01/oradata/oracl/users01.dbf channel ORA_DISK_1: starting piece 1 at 22-SEP-12 channel ORA_DISK_1: finished piece 1 at 22-SEP-12

piece handle=/u01/oracle/backup/full_ORACL_28_0snlrk28_1_1_bak plus archivelog all delete all input tag=TAG20120922T154200 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16 Finished backup at 22-SEP-12

Starting Control File and SPFILE Autobackup at 22-SEP-12 piece

handle=/u01/flash_recovery_area/ORACL/autobackup/2012_09_22/o1_mf_s_794677398_85tv0r42_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 22-SEP-12

RMAN>

RMAN> backup database format '/u01/oracle/backup/full_%d_S_%U_bak plus archivelo g all delete all input';

Starting backup at 13-NOV-12 allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=141 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/u01/oradata/orcl/system01.dbf input datafile fno=00003 name=/u01/oradata/orcl/sysaux01.dbf input datafile fno=00005 name=/u01/oradata/orcl/example01.dbf input datafile fno=00002 name=/u01/oradata/orcl/undotbs01.dbf

input datafile fno=00004 name=/u01/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 13-NOV-12 channel ORA_DISK_1: finished piece 1 at 13-NOV-12

piece handle=/u01/oracle/backup/full_ORCL_S_01nq87ga_1_1_bak plus archivelog all delete all input tag=TAG20121113T233226 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 Finished backup at 13-NOV-12

Starting Control File and SPFILE Autobackup at 13-NOV-12 piece handle=/u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_7992847 71_8b4t14gc_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 13-NOV-12

RMAN> list backup of database;

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ---------------

1 Full 599.70M DISK 00:00:24 13-NOV-12

BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20121113T233226

Piece Name: /u01/oracle/backup/full_ORCL_S_01nq87ga_1_1_bak plus archive log all delete all input

List of Datafiles in backup set 1

File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ----

1 Full 640399 13-NOV-12 /u01/oradata/orcl/system01.dbf 2 Full 640399 13-NOV-12 /u01/oradata/orcl/undotbs01.dbf 3 Full 640399 13-NOV-12 /u01/oradata/orcl/sysaux01.dbf 4 Full 640399 13-NOV-12 /u01/oradata/orcl/users01.dbf 5 Full 640399 13-NOV-12 /u01/oradata/orcl/example01.dbf RMAN> shutdown immediate

database closed

database dismounted

Oracle instance shut down

用DBCA删除数据库开始还原 参数文件

RMAN> restore spfile to '/u01/oracle/product/10.2.0/db_1/dbs/spfileorcl.ora' from

'/u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp';

Starting restore at 13-NOV-12 using channel ORA_DISK_1

channel ORA_DISK_1: autobackup found: /u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp RMAN-00571:

=========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571:

=========================================================== RMAN-03002: failure of restore command at 11/13/2012 23:54:01

ORA-32011: cannot restore SPFILE to location already being used by the instance

RMAN> restore spfile to '/u01/oracle/product/10.2.0/db_1/spfileorcl.ora' from '/u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp';

Starting restore at 13-NOV-12 using channel ORA_DISK_1

channel ORA_DISK_1: autobackup found: /u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp channel ORA_DISK_1: SPFILE restore from autobackup complete Finished restore at 13-NOV-12

[oracle@host db_1]$ cp 'spfileorcl.ora' 'dbs/' (再将spfileorcl.ora复制到dbs目录下)

还原控制文件 RMAN> restore controlfile from '/u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp'; Starting restore at 14-NOV-12 using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 output filename=/u01/oradata/orcl/control01.ctl output filename=/u01/oradata/orcl/control02.ctl output filename=/u01/oradata/orcl/control03.ctl Finished restore at 14-NOV-12

RMAN> alter database mount;(启动数据库到mount状态)

database mounted

released channel: ORA_DISK_1

RMAN> restore database; (还原数据库)

Starting restore at 14-NOV-12

Starting implicit crosscheck backup at 14-NOV-12 allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK Crosschecked 1 objects

Finished implicit crosscheck backup at 14-NOV-12

Starting implicit crosscheck copy at 14-NOV-12 using channel ORA_DISK_1

Finished implicit crosscheck copy at 14-NOV-12

searching for all files in the recovery area cataloging files... cataloging done

List of Cataloged Files

======================= File Name: /u01/flash_recovery_area/ORCL/autobackup/2012_11_13/o1_mf_s_799284771_8b4t14gc_.bkp

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/oradata/orcl/system01.dbf restoring datafile 00002 to /u01/oradata/orcl/undotbs01.dbf restoring datafile 00003 to /u01/oradata/orcl/sysaux01.dbf restoring datafile 00004 to /u01/oradata/orcl/users01.dbf restoring datafile 00005 to /u01/oradata/orcl/example01.dbf channel ORA_DISK_1: reading from backup piece /u01/oracle/backup/full_ORCL_S_01nq87ga_1_1_bak plus archivelog all delete all input channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/oracle/backup/full_ORCL_S_01nq87ga_1_1_bak plus archivelog all delete all input tag=TAG20121113T233226

channel ORA_DISK_1: restore complete, elapsed time: 00:00:35 Finished restore at 14-NOV-12

不用还原归档日志,恢复database时,归档日志就自动恢复了 RMAN> recover database;

Starting recover at 14-NOV-12 using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 9 is already on disk as file /u01/oradata/orcl/redo02.log archive log filename=/u01/oradata/orcl/redo02.log thread=1 sequence=9 media recovery complete, elapsed time: 00:00:03 Finished recover at 14-NOV-12 打开数据库

RMAN> alter database open resetlogs;

database opened sqlplus 进去看一下

SQL> select status,instance_name from v$instance;

STATUS INSTANCE_NAME ------------ ---------------- OPEN orcl 至此完成。

搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新经管营销oracle数据库RMAN的全备份和还原及恢复 全文阅读和word下载服务。

oracle数据库RMAN的全备份和还原及恢复 .doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/wenku/1081719.html(转载请注明文章来源)
热门推荐
Copyright © 2018-2022 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top