【备份恢复】归档模式下丢失系统关键数据文件 利用RMAN备份恢复

ARCHIVELOG 模式下丢失了系统关键数据文件

1.查看数据库为归档模式

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     11

Next log sequence to archive   13

Current log sequence           13

SQL>

2.通过RMAN备份system表空间

[oracle@wang FRA]$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 2 10:36:00 2016

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: ORA11GR2 (DBID=237843809)

 

RMAN> backup tablespace system;

 

Starting backup at 02-OCT-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=46 device type=DISK

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=/u01/app/oracle/oradata/ORA11GR2/system01.dbf

channel ORA_DISK_1: starting piece 1 at 02-OCT-16

channel ORA_DISK_1: finished piece 1 at 02-OCT-16

piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp tag=TAG20161002T103616 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

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 02-OCT-16

channel ORA_DISK_1: finished piece 1 at 02-OCT-16

piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_ncsnf_TAG20161002T103616_cz0wojgw_.bkp tag=TAG20161002T103616 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 02-OCT-16

 

3.删除system表空间

——查看表空间对应的路径及文件名:

SYS@ORA11GR2>select file_name from dba_data_files where tablespace_name='SYSTEM';

 

FILE_NAME

----------------------------------------------------------------------------

/u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/system01.dbf

/u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>

SYS@ORA11GR2>!rm  /u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/system01.dbf

ls: /u01/app/oracle/oradata/ORA11GR2/system01.dbf: No such file or directory

 

4.此时重启数据库后,会因为system数据文件丢失而提示错误

SYS@ORA11GR2>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@ORA11GR2>

SYS@ORA11GR2>startup

ORACLE instance started.

 

Total System Global Area  830930944 bytes

Fixed Size                  2257800 bytes

Variable Size             503319672 bytes

Database Buffers          322961408 bytes

Redo Buffers                2392064 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'

 

 

5.通过RMAN恢复system表空间

[oracle@wang FRA]$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 2 10:45:04 2016

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: ORA11GR2 (DBID=237843809, not open)

 

RMAN> restore tablespace system;(重储)

Starting restore at 02-OCT-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=21 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 /u01/app/oracle/oradata/ORA11GR2/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp

channel ORA_DISK_1: piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp tag=TAG20161002T103616

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 02-OCT-16

 

RMAN> recover tablespace system;(恢复)

 

Starting recover at 02-OCT-16

using channel ORA_DISK_1

 

starting media recovery

media recovery complete, elapsed time: 00:00:00

 

Finished recover at 02-OCT-16

 

RMAN> alter database open;(开库)

 

database opened
恢复成功!!!!!!!!!!!1


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2126535/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31397003/viewspace-2126535/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值