??? RMAN> Recover datafile 7;
??? from dba_tablespaces ts, dba_data_files df, dba_temp_files tf
??? and ts.tablespace_name = tf.tablespace_name(+)
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release
Copyright (c) 1982, 2002, Oracle Corporation.? All rights reserved.
SQL> conn jss/jss
已連接。
SQL> create table tmp3(col varchar2(50));
###### 創(chuàng)建一個(gè)臨時(shí)表并插入一些數(shù)據(jù)
表已創(chuàng)建。
SQL> insert into tmp3 values ('test1');
已創(chuàng)建 1 行。
SQL> insert into tmp3 values ('test2');
已創(chuàng)建 1 行。
SQL> insert into tmp3 values ('test3');
已創(chuàng)建 1 行。
SQL> select *from tmp3;
COL
--------------------------------------------------
test1
test2
test3
SQL> commit;
提交完成。
SQL> conn / as sysdba??? #### 已 dba 用戶連接并關(guān)閉數(shù)據(jù)庫(kù)
已連接。
SQL> shutdown immediate;
數(shù)據(jù)庫(kù)已經(jīng)關(guān)閉。
已經(jīng)卸載數(shù)據(jù)庫(kù)。
ORACLE 例程已經(jīng)關(guān)閉。
SQL> host del F:\OraHome1\oradata\jssweb\jweb.ora
###### 手動(dòng)刪除數(shù)據(jù)文件
SQL> startup
ORACLE 例程已經(jīng)啟動(dòng)。
Total System Global Area? 143727516 bytes
Fixed Size?????????????????? 453532 bytes
Variable Size???????????? 109051904 bytes
Database Buffers?????????? 33554432 bytes
Redo Buffers???????????????? 667648 bytes
數(shù)據(jù)庫(kù)裝載完畢。
ORA-01157: 無(wú)法標(biāo)識(shí) / 鎖定數(shù)據(jù)文件 10 - 請(qǐng)參閱 DBWR 跟蹤文件
ORA-01110: 數(shù)據(jù)文件 10: 'F:\ORAHOME1\ORADATA\JSSWEB\JWEB.ORA'
####### 看看,啟動(dòng)報(bào)錯(cuò)了吧
SQL> select instance_name,status from v$instance;
####### 看看當(dāng)前數(shù)據(jù)庫(kù)狀態(tài),應(yīng)該是處于 mount
INSTANCE_NAME??? STATUS
---------------- ------------
jssweb?????????? MOUNTED
OK, 下面該 RMAN 出馬了。
SQL>exit
C:\Documents and Settings\Administrator>set oracle_sid=jssweb
C:\Documents and Settings\Administrator>rman target /
恢復(fù)管理器
:
版本
Copyright (c) 1995, 2002, Oracle Corporation.? All rights reserved.
連接到目標(biāo)數(shù)據(jù)庫(kù) : JSSWEB (DBID=3391142503)
RMAN> restore datafile 'F:\ORAHOME1\ORADATA\JSSWEB\JWEB.ORA';
#### 首先修復(fù)數(shù)據(jù)文件。 是不是有疑問(wèn),為什么不像上面第三節(jié)講的那樣先將該數(shù)據(jù)文件置為脫機(jī),笨啊你,數(shù)據(jù)庫(kù)都沒(méi)打開(kāi),脫什么機(jī)啊,整個(gè)數(shù)據(jù)庫(kù)現(xiàn)在都是脫機(jī)的。
啟動(dòng) restore 于 18-7 月 -07
正在使用目標(biāo)數(shù)據(jù)庫(kù)控制文件替代恢復(fù)目錄
分配的通道 : ORA_DISK_1
通道 ORA_DISK_1: sid=11 devtype=DISK
通道 ORA_DISK_1: 正在開(kāi)始恢復(fù)數(shù)據(jù)文件備份集
通道 ORA_DISK_1: 正在指定從備份集恢復(fù)的數(shù)據(jù)文件
正將數(shù)據(jù)文件 00010 恢復(fù)到 F:\ORAHOME1\ORADATA\JSSWEB\JWEB.ORA
通道 ORA_DISK_1: 已恢復(fù)備份段 1
段 handle=D:\BACKUP\1AIN4JU5_1_1 tag=TAG20070718T092837 params=NULL
通道 ORA_DISK_1: 恢復(fù)完成
完成 restore 于 18-7 月 -07
RMAN> recover datafile 'F:\ORAHOME1\ORADATA\JSSWEB\JWEB.ORA';
######## 恢復(fù)數(shù)據(jù)文件
啟動(dòng) recover 于 18-7 月 -07
使用通道 ORA_DISK_1
正在開(kāi)始介質(zhì)的恢復(fù)
完成介質(zhì)的恢復(fù)
完成 recover 于 18-7 月 -07
RMAN> alter database open;?? ######## 看起來(lái)很順利,打開(kāi)數(shù)據(jù)庫(kù)看看
數(shù)據(jù)庫(kù)已打開(kāi)
RMAN> host;
Microsoft Windows [ 版本 5.2.3790]
(C) 版權(quán)所有 1985-2003 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus jss/jss? #### 連到該用戶
SQL*Plus: Release
Copyright (c) 1982, 2002, Oracle Corporation.? All rights reserved.
連接到 :
Oracle9i Enterprise Edition Release
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release
SQL> select *from tmp3;???? ######查詢我們備份后創(chuàng)建的表
COL
--------------------------------------------------
test1
test2
test3
#######yeah, 成功恢復(fù),沒(méi)有數(shù)據(jù)丟失。