dataifle誤刪除的模擬recover

2021-09-01 17:28:06 字數 2125 閱讀 1400

oracle 恢復試習一:

1. 熱備份tablespace users.

2. a) scott login,

b) create table tt( seq number);

c) declare

i number;

begin

for i in 1..20

loop

insert into tt values(i);

end loop;

commit;

end;

d) alter system switch logfile;

e) insert into tt values(21);

alter system switch logfile;

...直到所有online redo file都做了archived(測試archived log的應用)

f) commit;

3. shutdown immediate;

4. rm datafile users;

恢復如下:

sql> startup

oracle instance started.

total system global area 285212672 bytes

fixed size 1218992 bytes

variable size 121636432 bytes

database buffers 159383552 bytes

redo buffers 2973696 bytes

database mounted.

ora-01157: cannot identify/lock data file 4 - see dbwr trace file

ora-01110: data file 4: '/oracle/oracle/product/10.2.0/oradata/orcl/users01.dbf'

sql> host cp /oracle/backup/users01.dbf /oracle/oracle/product/10.2.0/oradata/orcl/

sql> alter database open;

alter database open

*error at line 1:

ora-01113: file 4 needs media recovery

ora-01110: data file 4: '/oracle/oracle/product/10.2.0/oradata/orcl/users01.dbf'

sql> recover tablespace users;

ora-00279: change 546700 generated at 05/14/2013 20:51:07 needed for thread 1

ora-00289: suggestion : /oracle/oracle/product/10.2.0/db_1/flash_recovery_area/orcl/archivelog/2013_05_14/o1_mf_1_6_%u_.arc

ora-00280: change 546700 for thread 1 is in sequence #6

--- ora-00289 :尋archived log file恢復...因為

specify log:

media recovery complete.

sql> alter database open;

database altered.

注:scn的檢視:

1.select file#,checkpoint_change# from v$datafile_header;

2.select file#,checkpoint_change# from v$datafile;

v$datafile_header的資訊來自各資料檔案的檔案頭.

v$datafile的資訊則來自control file

3.select sequence#,first_change#,next_change# from v$archived_log;

4.select dbms_flashback.get_system_change_number from dual;-- system scn

ORACLEFLASHBACK 恢復誤刪除資料

啟動錶行移動功能 alter table ds.zw file enable row movement 按時間閃回表 flashback table ds.zw file to timestamp to date 201412011100 yyyymmddhh24mi 啟動資料庫閃回功能 alter...

誤刪除恢復 (extundelete)

了解誤刪除恢復原理 檔案系統構成 檔名,inode,block file inode block 檔名 存放檔案資訊 真正存放資料 對於系統,檔名是inode號碼便於識別的別稱或綽號。inode,存放檔案檔案建立者,大小,建立日期。ls i file 檢視inode號 stat file 檢視檔案詳...

PLsql oracle 誤刪除 恢復

在我們實際工作中,誤刪除或者修改oracle資料庫中的資料,怎麼辦呢?這裡給大家分享一種解決辦法。假如你誤操作的時間不超過30分鐘 資料庫預設的回滾保持段裡的資料時間,可以在pl sql執行視窗按ctrl e檢視你最近的操作 就是可以使用以下方法恢復資料。1.樣例表test 171205 資料如下圖...