The standard way to recover the lost file.

SQL> startup
ORACLE instance started.

Total System Global Area 1224736768 bytes
Fixed Size                  1279916 bytes
Variable Size             503318612 bytes
Database Buffers          704643072 bytes
Redo Buffers               15495168 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/home/oracle/test01.dbf'

The standard way to recover the lost datafile:

-bash-3.00$ rman target /

Recovery Manager: Release 10.2.0.2.0 - Production on Thu Apr 9 11:11:57 2009

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

connected to target database: ORCL (DBID=1203857279)

RMAN> Recover copy of datafile 6;

Starting recover at 09-APR-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=120 devtype=DISK
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00006 name=/home/oracle/backup/orcl_data_D-ORCL_I-1203857279_TS-TEST_FNO-6_0qkc1b85.bak
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/orcl_0ukc1gpo_1_1.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/backup/orcl_0ukc1gpo_1_1.bak tag=TAG20090409T103848
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished recover at 09-APR-09

Starting Control File and SPFILE Autobackup at 09-APR-09
piece handle=/export/home/workzone/database/oracle/10g/flash_recovery_area/ORCL/autobackup/2009_04_09/o1_mf_s_683723525_4xtsw5c3_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 09-APR-09
see the change to image copy:

bash-3.00$ ls -lrt
total 224704
-rw-r-----   1 oracle   oinstall 10108928 Apr  9 10:40 orcl_0ukc1gpo_1_1.bak
-rw-r-----   1 oracle   oinstall 104865792 Apr  9 11:12 orcl_data_D-ORCL_I-1203857279_TS-TEST_FNO-6_0qkc1b85.bak
bash-3.00$

go on the rman recover.
RMAN> switch datafile 6 to copy;

datafile 6 switched to datafile copy "/home/oracle/backup/orcl_data_D-ORCL_I-1203857279_TS-TEST_FNO-6_0qkc1b85.bak"
RMAN> recover datafile 6;

Starting recover at 09-APR-09
using channel ORA_DISK_1

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

Finished recover at 09-APR-09
From SQLPLUS side:
SQL> conn / as sysdba
Connected.

SQL> select * from v$recover_file;

no rows selected

SQL> alter database datafile 6 online;

Database altered.

SQL> conn test/test
Connected.
SQL> select count(*) from test;

  COUNT(*)
----------
         3
  SQL> select file_name,file_id from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
   FILE_ID
----------
/export/home/workzone/database/oracle/oradata/orcl/users01.dbf
         4

/export/home/workzone/database/oracle/oradata/orcl/sysaux01.dbf
         3

/export/home/workzone/database/oracle/oradata/orcl/undotbs01.dbf
         2


FILE_NAME
--------------------------------------------------------------------------------
   FILE_ID
----------
/export/home/workzone/database/oracle/oradata/orcl/system01.dbf
         1

/export/home/workzone/database/oracle/oradata/orcl/example01.dbf
         5

/home/oracle/backup/orcl_data_D-ORCL_I-1203857279_TS-TEST_FNO-6_0qkc1b85.bak
         6


6 rows selected.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值