环境:
OS:Red Hat Linux As 4
DB:10gR2
提前准备:全备份整个数据库.
步骤1:先停掉数据库
shutdown immediate
步骤2.模拟损坏某个数据文件,这里使用vi编辑数据文件hxl01.dbf
步骤3:启动数据库
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed Size 1220360 bytes
Variable Size 163578104 bytes
Database Buffers 356515840 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/u01/app/oracle/oradata/oracl/hxl01.dbf'
步骤4:恢复损坏的数据库
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
restore datafile 5;
recover datafile 5;
sql 'alter database open';
release channel c1;
release channel c2;
}
allocated channel: c1
channel c1: sid=155 devtype=DISK
allocated channel: c2
channel c2: sid=154 devtype=DISK
Starting restore at 28-DEC-11
channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /u01/app/oracle/oradata/oracl/hxl01.dbf
channel c1: reading from backup piece /u01/rman_backup/2011/201112/20111227/df_770980962_46_1.bak
channel c1: restored backup piece 1
piece handle=/u01/rman_backup/2011/201112/20111227/df_770980962_46_1.bak tag=TAG20111227T092240
channel c1: restore complete, elapsed time: 00:00:05
Finished restore at 28-DEC-11
Starting recover at 28-DEC-11
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 28-DEC-11
sql statement: alter database open
released channel: c1
released channel: c2
阅读(206) | 评论(0) | 转发(0) |