-rw-r----- 1 oracle oinstall 10493952 Jan 6 09:09 app1_01.dbf
sys@DENVER> ALTER TABLESPACE app1 END BACKUP;
Tablespace altered.
第一种情况:Complete Recovery of a Closed DatabaseClosed database reocvery is used for : 1. System tablespace datafiles 2. Rollback segment datafiles 3. Whole databaseSteps: shut down the instance -----> Restore dtafile -----> Apply archvied log and redo log files -------> Open the databse以下实验模拟了数据库的损坏: [sql]
sys@DENVER> conn /as sysdba
Connected.
sys@DENVER> conn user1/user1
Connected.
user1@DENVER> SELECT * FROM t;
ID NAME
---------- ----------
0 bbk
1 bbk
2 rows selected.
user1@DENVER> INSERTINTO t VALUES(2,"bbk");
1 row created.
user1@DENVER> COMMIT;
Commit complete.
user1@DENVER> SELECT * FROM t;
ID NAME
---------- ----------
0 bbk
1 bbk
2 bbk
3 rows selected.
user1@DENVER> conn /as sysdba
Connected.
sys@DENVER> !ls -l /u01/admin/denver/archdest
total 10752
-rw-r----- 1 oracle oinstall 1778688 Jan 6 07:43 1_1_771835295.arc
-rw-r----- 1 oracle oinstall 1638400 Jan 6 09:11 1_2_771835295.arc
-rw-r----- 1 oracle oinstall 1536 Jan 6 09:11 1_3_771835295.arc
-rw-r----- 1 oracle oinstall 1536 Jan 6 09:11 1_4_771835295.arc
sys@DENVER> ALTER SYSTEM SWITCH LOGFILE;
System altered.
sys@DENVER> ALTER SYSTEM SWITCH LOGFILE;
System altered.
sys@DENVER> ALTER SYSTEM SWITCH LOGFILE;
System altered.
sys@DENVER> !ls -l /u01/admin/denver/archdest
total 11340
-rw-r----- 1 oracle oinstall 1778688 Jan 6 07:43 1_1_771835295.arc
-rw-r----- 1 oracle oinstall 1638400 Jan 6 09:11 1_2_771835295.arc
-rw-r----- 1 oracle oinstall 1536 Jan 6 09:11 1_3_771835295.arc
-rw-r----- 1 oracle oinstall 1536 Jan 6 09:11 1_4_771835295.arc
-rw-r----- 1 oracle oinstall 571904 Jan 6 09:13 1_5_771835295.arc
-rw-r----- 1 oracle oinstall 1024 Jan 6 09:13 1_6_771835295.arc
-rw-r----- 1 oracle oinstall 5632 Jan 6 09:13 1_7_771835295.arc
sys@DENVER> !rm -f /u01/oradata/md/*.dbf
> !ls -l /u01/oradata/md/
total 163444
-rw-r----- 1 oracle oinstall 9846784 Jan 6 09:22 control01.ctl
drwx------ 2 oracle oinstall 16384 Jan 6 05:18 lost+found
-rw-r----- 1 oracle oinstall 52429312 Jan 6 09:13 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Jan 6 09:22 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Jan 6 09:13 redo03.log
针对以上情况进行Recovery [sql]
sys@DENVER> shutdown immediate
ORA-01116: error in opening database file 2
ORA-01110: data file 2: "/u01/oradata/md/sysaux01.dbf"