自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Oracle數(shù)據(jù)庫基于用戶管理的備份與恢復(fù)

數(shù)據(jù)庫 Oracle
本文主要介紹了Oracle數(shù)據(jù)庫基于用戶管理的備份與恢復(fù)方式,希望能夠?qū)δ兴鶐椭?/div>

Oracle數(shù)據(jù)庫中,數(shù)據(jù)庫文件的備份與恢復(fù)可以有很多的方式來實(shí)現(xiàn),本文我們介紹一種基于用戶管理的備份與恢復(fù)。基于用戶管理的備份是指使用OS命令來備份數(shù)據(jù)庫物理文件。

 

備份數(shù)據(jù)庫

 

數(shù)據(jù)庫一致性備份:關(guān)閉數(shù)據(jù)庫以后備份數(shù)據(jù)庫物理文件,這時(shí)數(shù)據(jù)文件scn值完全一致,所以稱之為數(shù)據(jù)庫的一致性備份或冷備份,適用于歸檔模式與非歸檔模式。

 

對(duì)基于用戶管理的冷備份的暫時(shí)理解:在數(shù)據(jù)庫shutdown狀態(tài)下使用OS命令直接拷貝數(shù)據(jù)庫物理文件。

數(shù)據(jù)庫非一致性備份:在open狀態(tài)下備份數(shù)據(jù)庫物理文件,這時(shí)數(shù)據(jù)庫內(nèi)容可能會(huì)改變導(dǎo)致數(shù)據(jù)文件scn不一致,所以稱之為數(shù)據(jù)庫的非一致性備份或熱備份,只適用于歸檔模式。

基于用戶管理的完全恢復(fù)(歸檔模式下)

1.在open狀態(tài)下備份數(shù)據(jù)庫物理文件(數(shù)據(jù)庫非一致性備份,熱備份,不影響業(yè)務(wù)運(yùn)行)

2.刪除數(shù)據(jù)文件來模擬文件丟失(只是刪除了所有的數(shù)據(jù)文件;控制文件等其它文件處于正常狀態(tài))

3.對(duì)數(shù)據(jù)文件進(jìn)行恢復(fù)

4.應(yīng)用歸檔日志

5.查看數(shù)據(jù)是否完全恢復(fù)

 

  1. SQL> conn evan/evan  
  2.  
  3. Connected.  
  4.  
  5. SQL> insert into t_evan values('oracle');  
  6.  
  7. 1 row created.  
  8.  
  9. SQL> insert into t_evan values('java');  
  10.  
  11. 1 row created.  
  12.  
  13. SQL> commit;  
  14.  
  15. Commit complete.  
  16.  
  17. SQL> select * from t_evan;  
  18.  
  19. TEXT  
  20.  
  21. --------------------------------------------------------------------------------  
  22.  
  23. oracle  
  24.  
  25. java  
  26.  
  27. --sysdba執(zhí)行備份  
  28.  
  29. SQL> conn / as sysdba  
  30.  
  31. Connected.  
  32.  
  33. SQL> select name from v$datafile;  
  34.  
  35. NAME  
  36.  
  37. --------------------------------------------------------------------------------  
  38.  
  39. /oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf  
  40.  
  41. /oracle/10g/oracle/product/10.2.0/oradata/oralife/undotbs01.dbf  
  42.  
  43. /oracle/10g/oracle/product/10.2.0/oradata/oralife/sysaux01.dbf  
  44.  
  45. /oracle/10g/oracle/product/10.2.0/oradata/oralife/users01.dbf  
  46.  
  47. /oracle/10g/oracle/product/10.2.0/oradata/oralife/example01.dbf  
  48.  
  49. SQL> alter database begin backup;  
  50.  
  51. Database altered.  
  52.  
  53. SQL> host cp /oracle/10g/oracle/product/10.2.0/oradata/oralife/*.dbf /oracle/10g/oracle/bakup/database/   --備份所有數(shù)據(jù)文件  
  54.  
  55. SQL> alter database backup controlfile to '/oracle/10g/oracle/bakup/database/oralife.ctl';  --備份控制文件  
  56.  
  57. Database altered.  
  58.  
  59. -----------------------------------------------------------------------------------------------------------------------------------------  
  60.  
  61. 忘記了alter database end backup;  
  62.  
  63. -----------------------------------------------------------------------------------------------------------------------------------------  
  64.  
  65. SQL> alter system archive log current; --歸檔當(dāng)前日志組  
  66.  
  67. System altered. 

 

使用rm刪除所有數(shù)據(jù)文件(*.dbf);

 

  1. SQL> conn evan/evan  
  2.  
  3. Connected.  
  4.  
  5. SQL> select * from t_evan;  
  6.  
  7. TEXT  
  8.  
  9. --------------------------------------------------------------------------------  
  10.  
  11. oracle  
  12.  
  13. java  
  14.  
  15. SQL> insert into t_evan values('spring');  
  16.  
  17. 1 row created.  
  18.  
  19. SQL> commit;  
  20.  
  21. Commit complete.  
  22.  
  23. SQL> ALTER SYSTEM CHECKPOINT; --將已修改的數(shù)據(jù)從高速緩存刷新到磁盤,并更新控制文件和數(shù)據(jù)文件  
  24.  
  25. System altered.  
  26.  
  27. SQL> ALTER SYSTEM SWITCH LOGFILE;  --日志切換  
  28.  
  29. System altered. 

 

查看alter_oralife.log出現(xiàn)錯(cuò)誤信息:某些文件不存在

進(jìn)行完全恢復(fù)

copy備份的數(shù)據(jù)文件到指定的目標(biāo)位置,進(jìn)行恢復(fù):

 

  1. SQL> recover database --open狀態(tài)  
  2.  
  3. ORA-00283: recovery session canceled due to errors  
  4.  
  5. ORA-01124: cannot recover data file 1 - file is in use or recovery  
  6.  
  7. ORA-01110: data file 1:  
  8.  
  9. '/oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf'  
  10.  
  11. SQL> shutdown immediate --open狀態(tài)  
  12.  
  13. ORA-01122: database file 1 failed verification check  
  14.  
  15. ORA-01110: data file 1: '/oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf'  
  16.  
  17. ORA-01208: data file is an old version - not accessing current version  
  18.  
  19. SQL> startup force mount;  --進(jìn)入mount狀態(tài)進(jìn)行恢復(fù)  
  20.  
  21. ORACLE instance started.  
  22.  
  23. Total System Global Area  528482304 bytes  
  24.  
  25. Fixed Size                  1220360 bytes  
  26.  
  27. Variable Size             163578104 bytes  
  28.  
  29. Database Buffers          356515840 bytes  
  30.  
  31. Redo Buffers                7168000 bytes  
  32.  
  33. Database mounted.  
  34.  
  35. SQL> recover database  
  36.  
  37. Media recovery complete.  
  38.  
  39. SQL> alter database open;  
  40.  
  41. Database altered.  
  42.  
  43. SQL> conn evan/evan --使用evan登錄查看恢復(fù)情況  
  44.  
  45. Connected.  
  46.  
  47. SQL> select * from t_evan;  
  48.  
  49. TEXT  
  50.  
  51. --------------------------------------------------------------------------------  
  52.  
  53. oracle  
  54.  
  55. java  
  56.  
  57. spring 

 

沒有出現(xiàn)應(yīng)用歸檔日志,應(yīng)用歸檔日志有幾種方式:

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

當(dāng)在open狀態(tài)下對(duì)數(shù)據(jù)文件進(jìn)行恢復(fù)時(shí),應(yīng)該將其offline,恢復(fù)完成后,再將其online;所有的恢復(fù)應(yīng)該盡量在open狀態(tài)下完成。

要理解checkpoint, alter system archive log current;,ALTER SYSTEM SWITCH LOGFILE。

關(guān)于Oracle數(shù)據(jù)庫基于用戶管理的備份與恢復(fù)就介紹到這里,希望通過本次的介紹能夠帶給您一些收獲。

【編輯推薦】

  1. SQL Server 2008的BI組件SSAS使用詳解
  2. Oracle數(shù)據(jù)庫如何增加scott用戶與相關(guān)的表
  3. 關(guān)于SQL Server數(shù)據(jù)庫主鍵與索引的幾點(diǎn)區(qū)別
  4. SQL Server數(shù)據(jù)同步Merge的一個(gè)BUG及解決方法
  5. 如何將SQL Server 2008的數(shù)據(jù)降級(jí)到SQL Server 2005
責(zé)任編輯:趙鵬 來源: CSDN博客
相關(guān)推薦

2011-08-03 18:42:21

Oracle數(shù)據(jù)庫重做日志

2011-08-02 08:59:52

Oracle控制文件

2009-04-03 10:54:49

Oracle備份恢復(fù)

2009-10-13 09:43:43

Oracle數(shù)據(jù)庫備份

2010-04-13 11:09:21

Oracle數(shù)據(jù)庫

2009-03-17 16:00:47

Oracle數(shù)據(jù)庫備份

2011-05-20 09:35:24

Oracle數(shù)據(jù)庫恢復(fù)備份

2011-08-04 10:31:43

歸檔日志參數(shù)文件

2010-04-12 10:40:49

Oracle數(shù)據(jù)庫

2023-11-15 09:38:49

Oracle數(shù)據(jù)庫

2010-04-12 14:19:00

Oracle數(shù)據(jù)庫備份

2009-04-17 11:28:16

Oracle備份恢復(fù)

2011-04-11 13:46:17

Oracle數(shù)據(jù)庫備份

2011-07-26 13:55:01

MongoDB備份與恢復(fù)

2010-03-30 10:05:02

Oracle數(shù)據(jù)庫

2011-08-02 16:03:47

Oracle數(shù)據(jù)庫冷備份冷備份異地恢復(fù)

2010-03-31 10:39:40

RMANOracle

2010-08-12 09:18:48

DB2用戶密碼修改

2019-02-28 21:20:50

MySQL備份與恢復(fù)數(shù)據(jù)庫

2011-08-30 09:50:22

OracleRMAN不完全恢復(fù)基于SCN恢復(fù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)