登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

飞哥的技术博客

世上无难事,只怕有心人!

 
 
 

日志

 
 
 
 

RMAN备份时出现RMAN-06056: could not access datafile 6 错误,解决方法!  

2009-06-28 21:37:16|  分类: Oracle |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
不去追随别人,也不去张扬自己!

RMAN备份时出现RMAN-06056: could not access datafile 6 错误,解决方法!!

用rman备份数据库时出现以下错误:
[oracle@mzl orcl]$ rman target/

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Feb 13 15:36:06

Copyright (c) 1982, 2005, .  All rights reserved.

connected to target database: ORCL (DBID=1172558471)

RMAN> backup database;

Starting backup at 13-FEB-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=137 devtype=DISK
could not read file header for datafile 6 error reason 1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 02/13/2008 15:36:14
RMAN-06056: could not access datafile 6


也就是说不能访问数据6的文件。


1   查看数据6文件是什么
SQL> select file#,name from v$datafile;

     FILE#
----------
NAME
--------------------------------------------------------------------------------
         1
/u01/app/oracle/oradata/orcl/system01.dbf

         2
/u01/app/oracle/oradata/orcl/undotbs01.dbf

         3
/u01/app/oracle/oradata/orcl/sysaux01.dbf


     FILE#
----------
NAME
--------------------------------------------------------------------------------
         4
/u01/app/oracle/oradata/orcl/users01.dbf

         5
/u01/app/oracle/oradata/orcl/example01.dbf

         6
/u01/app/oracle/product/10.2.0/db_1/dbs/MISSING00006


6 rows selected.
看来是MISSING00006文件,不是系统,也不是用户的数据。

2   看MISSING00006基于那个表空间,然后删除该表空间
     SQL> select TS#,name from v$tablespace;

       TS# NAME
---------- ------------------------------
         0 SYSTEM
         1 UNDOTBS1
         2 SYSAUX
         4 USERS
         6 EXAMPLE
         3 TEMP
         7 TS_RMAN

7 rows selected.

SQL> drop tablespace TS_RMAN;

Tablespace dropped.


3    进行rman备份

RMAN> backup database;

Starting backup at 13-FEB-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 >input datafile fno=00003 >input datafile fno=00005 >input datafile fno=00002 >input datafile fno=00004 >channel ORA_DISK_1: starting piece 1 at 13-FEB-08
channel ORA_DISK_1: finished piece 1 at 13-FEB-08
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_nnndf_TAG20080213T154843_3v586w6h_.bkp tag=TAG20080213T154843 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 13-FEB-08
channel ORA_DISK_1: finished piece 1 at 13-FEB-08
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_ncnnf_TAG20080213T154843_3v588n15_.bkp tag=TAG20080213T154843 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-FEB-08

RMAN> list backup;


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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    581.19M    DISK        00:00:52     13-FEB-08     
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20080213T154843
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_nnndf_TAG20080213T154843_3v586w6h_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 726487     13-FEB-08 /u01/app/oracle/oradata/orcl/system01.dbf
  2       Full 726487     13-FEB-08 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  3       Full 726487     13-FEB-08 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  4       Full 726487     13-FEB-08 /u01/app/oracle/oradata/orcl/users01.dbf
  5       Full 726487     13-FEB-08 /u01/app/oracle/oradata/orcl/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    7.08M      DISK        00:00:01     13-FEB-08     
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20080213T154843
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_ncnnf_TAG20080213T154843_3v588n15_.bkp
  Control File Included: Ckp SCN: 726506       Ckp time: 13-FEB-08

4    关闭数据库,模拟丢失数据,删除users数据文件
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> !
[oracle@mzl orcl]$ ls
control01.ctl  example01.dbf  sqlnet.log    undotbs01.dbf
control02.ctl  redo01.log     sysaux01.dbf  users01.dbf
control03.ctl  redo02.log     system01.dbf
create.sql     redo03.log     temp01.dbf
[oracle@mzl orcl]$ rm users01.dbf

5  启动数据库到mount状态
[oracle@mzl orcl]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 13 15:58:37 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  268435456 bytes
Fixed Size                  1218868 bytes
Variable Size              88082124 bytes
Database Buffers          171966464 bytes
Redo Buffers                7168000 bytes
Database mounted.

6   用rman恢复数据
SQL> !
[oracle@mzl orcl]$ rman target/

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Feb 13 15:59:12 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1172558471, not open)

RMAN> restore database;

Starting restore at 13-FEB-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK

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/app/oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_nnndf_TAG20080213T154843_3v586w6h_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2008_02_13/o1_mf_nnndf_TAG20080213T154843_3v586w6h_.bkp tag=TAG20080213T154843
channel ORA_DISK_1: restore complete, elapsed time: 00:00:57
Finished restore at 13-FEB-08


7  需要recover database之后才能打开数据库
RMAN> recover database;

Starting recover at 13-FEB-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK

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

Finished recover at 13-FEB-08


RMAN> exit


Recovery Manager complete.
[oracle@mzl orcl]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 13 16:02:30 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database open;

Database altered.

SQL> select * from test;

         A
----------
         1
         2
         5
         3
         4
         8

6 rows selected.


用rman备份与恢复完毕!!


引文来源  RMAN备份时出现RMAN-06056: could not access datafile 6 错误,解决方法!! - 蒙昭良的个人空间 - ITPUB个人空间 - powered by X-Space
  评论这张
 
阅读(1386)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018