DM7使用dmrestore工具利用歸檔日誌還原
使用dmrestore工具利用歸檔日誌還原
利用備份檔案,DM可以將資料庫、表空間和表還原到備份時的狀態。但使用者可能更希望將資料還原到最新的狀態。這點不用擔心,事實上系統足夠智慧,在利用備份完成還原後,會去歸檔目錄搜尋歸檔日誌,並分析歸檔日誌是否與還原的資料庫匹配,若存在匹配的歸檔日誌,則系統會重做這部分日誌,將資料庫還原到最新的狀態;若沒有可用的歸檔日誌,則只能還原到備份時的狀態。
利用指定歸檔目錄下歸檔日誌還原資料庫jydm
1.對資料庫jydm執行完全備份
SQL> backup database full to full_bak_for_arch_restor bakfile '/dm_home/dmdba/dmdbms/backup/full_bak_for_arch_restor.bak'; executed successfully used time: 00:00:25.113. Execute id is 977781. SQL> select * from t1; LINEID C1 C2 ---------- ----------- ----------- 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 used time: 0.744(ms). Execute id is 977816. SQL> insert into t1 values(6,6); affect rows 1 used time: 49.901(ms). Execute id is 977842. SQL> commit; executed successfully used time: 21.340(ms). Execute id is 977845. SQL> select * from t1; LINEID C1 C2 ---------- ----------- ----------- 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 6 rows got used time: 25.205(ms). Execute id is 977846.
2.異常終止資料庫例項
[root@shard1 oracle]# ps -ef | grep dmserver dmdba 3129 1 4 19:51 ? 00:00:02 /dm_home/dmdba/dmdbms/bin/dmserver /dm_home/dmdba/dmdbms/data/jydm/dm.ini -noconsole root 3371 32007 0 19:52 pts/9 00:00:00 grep --color=auto dmserver [root@shard1 oracle]# kill -9 3129 [root@shard1 oracle]# ps -ef | grep dmserver root 3532 32007 0 19:53 pts/9 00:00:00 grep --color=auto dmserver
3.執行還原
[dmdba@shard1 backup]$ dmrestore ini_path=/dm_home/dmdba/dmdbms/data/jydm/dm.ini file=/dm_home/dmdba/dmdbms/backup/full_bak_for_arch_restor.bak archive_dir=/dm_home/dmdba/dmdbms/data/arch restore V7.1.6.46-Build(2018.02.08-89107)ENT file dm.key not found, use default license! backup sig: BA backup tool version: 12595 backup db name: jydm backup db magic: 1371967312 backup pemnt magic: 1250320462 backup name: FULL_BAK_FOR_ARCH_RESTOR backup type: full backup level: online backup range: database backup description: compressed level: 0 encrypt_type: 0 encrypt_id: 2052 rac node: 0 page check: 0 rlog encrypt: 0 external cipher id: 0 external hash id: 0 length in char: 0 use new hash: 1 backup time: 2020-07-21 19:52:09 page size: 8 KB extent size: 16 case sensitive: 1 log page size: 512 B charset: 0 data version: 0x7000A sys version: V7.1.6.46-Build(2018.02.08-89107)ENT enable policy: 0 mpp_timestamp: 1595332328 crc_check: TRUE parallel type: 0 parallel info len: 0 backup db fil num: 9 archive flag: 1 backup with log: Yes before backup LSN: 30040400 after backup LSN: 30040406 $bak_seq |$file_path |$size(K) |$used(K) 1|/dm_home/dmdba/dmdbms/backup/full_bak_for_arch_restor.bak| 393216.00| 362036.00 $file_seq |$type|$ts_name |$state |$size(K) |$seq_in_bak |$off_in_bak(B) |$len_in_bak(B) |$file_path |$mirror_path 1|DBF |SYSTEM |ONLINE | 23552| 1| 43008| 6766592|/dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF | 2|DBF |ROLL |ONLINE | 229376| 1| 6809600| 10887168|/dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF | 3|DBF |MAIN |ONLINE | 276480| 1| 17696768| 240287744|/dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF | 4|DBF |BOOKSHOP |ONLINE | 153600| 1| 257984512| 933888|/dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF | 5|DBF |DMHR |ONLINE | 131072| 1| 258918400| 425984|/dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF | 6|DBF |USERS |ONLINE | 51200| 1| 259344384| 1105920|/dm_home/dmdba/dmdbms/data/jydm/users01.dbf | 7|DBF |SYSAUX |ONLINE | 179200| 1| 260450304| 110256128|/dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF | 8|DBF |FG_PERSON |ONLINE | 131072| 1| 370706432| 16384|/dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF | 9|LOG |ARCHLOG |ONLINE | 0| 1| 370722816| 2048| | Continue?[Y/N]:Y can't find useable archive file when search assigned archive directory restore bak_file: /dm_home/dmdba/dmdbms/backup/full_bak_for_arch_restor.bak ... start restore database... start restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF(SYSTEM), pages: 826 end restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSTEM.DBF(SYSTEM) start restore file: /dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF(ROLL), pages: 1329 end restore file: /dm_home/dmdba/dmdbms/data/jydm/ROLL.DBF(ROLL) start restore file: /dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF(MAIN), pages: 29332 end restore file: /dm_home/dmdba/dmdbms/data/jydm/MAIN.DBF(MAIN) start restore file: /dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF(BOOKSHOP), pages: 114 end restore file: /dm_home/dmdba/dmdbms/data/jydm/BOOKSHOP.DBF(BOOKSHOP) start restore file: /dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF(DMHR), pages: 52 end restore file: /dm_home/dmdba/dmdbms/data/jydm/DMHR.DBF(DMHR) start restore file: /dm_home/dmdba/dmdbms/data/jydm/users01.dbf(USERS), pages: 135 end restore file: /dm_home/dmdba/dmdbms/data/jydm/users01.dbf(USERS) start restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF(SYSAUX), pages: 13459 end restore file: /dm_home/dmdba/dmdbms/data/jydm/SYSAWR.DBF(SYSAUX) start restore file: /dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF(FG_PERSON), pages: 2 end restore file: /dm_home/dmdba/dmdbms/data/jydm/FG_PERSON.DBF(FG_PERSON) redo tmp arch file: /dm_home/dmdba/dmdbms/backup/RES_TMP_ARCH_20200721195311007_0.log, rpages: 16 end restore database data files. Apply archive log LSN from 30040407 to 30040406, time used:0.000s. restore finished, code = 0! restore successfully! restore time used: 8601.260(ms)
4.驗證資料
SQL> select * from t1; LINEID C1 C2 ---------- ----------- ----------- 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 6 rows got used time: 0.454(ms). Execute id is 97.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2762169/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DM7使用dmrestore工具還原資料庫REST資料庫
- DM7使用dmrestore工具利用不同資料庫的歸檔恢復資料庫REST資料庫
- DM7使用dmrestore執行並行對映檔案還原REST並行
- DM7使用DMRMAN執行歸檔還原
- rman 還原歸檔日誌(restore archivelogRESTHive
- DM7使用dmrestore執行指定時間點或LSN還原REST
- 【Oracle】歸檔日誌管理-設定歸檔日誌路徑以及歸檔日誌冗餘Oracle
- PostgreSQL 歸檔日誌SQL
- 歸檔日誌挖掘
- oracle歸檔日誌Oracle
- Oracle歸檔日誌清理Oracle
- 歸檔oracle alert日誌Oracle
- 14. 日誌歸檔
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- 批量註冊歸檔日誌
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- DM7使用DMRMAN執行歸檔備份
- DM7使用DMRAMN執行歸檔恢復
- DM7使用DMRMAN執行歸檔修復
- DM7配置本地歸檔
- DM7使用Disql執行表還原SQL
- ArgoWorkflow教程(四)---Workflow & 日誌歸檔Go
- logminer異機挖掘歸檔日誌
- DG歸檔日誌缺失恢復
- 【REDO】Oracle 日誌挖掘,分析歸檔日誌線上日誌主要步驟Oracle
- DM7配置遠端歸檔
- oracle11G歸檔日誌管理Oracle
- DM7使用DMRMAN工具執行加密備份與設定跟蹤日誌加密
- oracle rman備份歸檔日誌需要先切換日誌嗎Oracle
- DM7使用Disql執行表空間還原SQL
- DM7使用DMRMAN執行表空間還原
- DM7使用DMRMAN對資料庫執行指定對映檔案還原資料庫
- Oracle歸檔日誌暴增排查優化Oracle優化
- PostgreSQL的xlog/Wal歸檔及日誌清理SQL
- 【SQL】Oracle 歸檔日誌暴增原因分析SQLOracle
- oracle dg 歸檔日誌恢復情況Oracle
- oracle 刪除過期的歸檔日誌Oracle