`
wsql
  • 浏览: 11795223 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics