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

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

數(shù)據(jù)庫 Oracle
本文我們主要介紹了控制文件的備份與恢復的方法,包括三種備份方法和兩種恢復的方法,并給出了詳細的代碼演示,希望能夠?qū)δ兴鶐椭?/div>

Oracle數(shù)據(jù)庫中,控制文件是非常重要的。它用于記錄和維護數(shù)據(jù)庫。當恢復數(shù)據(jù)庫時,服務器進程和后臺進程需要從控制文件中讀取各種備份相關的信息。如果控制文件損壞,則會導致這些備份信息的丟失。盡管使用多元化控制文件可以防止控制文件損壞,但因為控制文件的重要性,應該定期備份控制文件。當數(shù)據(jù)庫配置發(fā)生改變時,一定要備份控制文件。

涉及到數(shù)據(jù)庫配置改變的命令:

 

  1. alter database [add|drop] logfile  
  2.  
  3. alter database [add|drop] logfile member  
  4.  
  5. alter database [add|drop] logfile group  
  6.  
  7. alter database [noarchivelog|archivelog]  
  8.  
  9. alter database rename file  
  10.  
  11. create tablespace  
  12.  
  13. alter tablespace [add|rename] datafile  
  14.  
  15. alter tablespace [read write|read only]  
  16.  
  17. drop tablespace 

 

控制文件的備份,三種方式

1)使用OS命令進行拷貝

1)open狀態(tài)下,使用alter database命令生成控制文件副本

2)open狀態(tài)下,使用alter database backup controlfile to trace命令將控制文件備份到跟蹤文件

控制文件的恢復,兩種方式

1)mount狀態(tài)下,使用RECOVER DATABASE USING BACKUP CONTROLFILE

2)mount狀態(tài)下,生成跟蹤文件并進行恢復

2--2示例:

 

 

  1. [oracle@localhost ~]$ rlsqlplus / as sysdba  
  2.  
  3. SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 1 21:40:03 2011  
  4.  
  5. Copyright (c) 1982, 2005, Oracle.  All rights reserved.  
  6.  
  7. Connected to an idle instance.  
  8.  
  9. SQL> startup  
  10.  
  11. ORACLE instance started.  
  12.  
  13. Total System Global Area  528482304 bytes  
  14.  
  15. Fixed Size                  1220360 bytes  
  16.  
  17. Variable Size             176161016 bytes  
  18.  
  19. Database Buffers          343932928 bytes  
  20.  
  21. Redo Buffers                7168000 bytes  
  22.  
  23. Database mounted.  
  24.  
  25. Database opened. 

 

--open狀態(tài)下生成控制文件副本

 

  1. SQL> alter database backup controlfile to  
  2.  
  3. 2  '/oracle/10g/oracle/bakup/database/oralife.ctl';  
  4.  
  5. alter database backup controlfile to  
  6.  
  7. *  
  8.  
  9. ERROR at line 1:  
  10.  
  11. ORA-01580: error creating control backup file  
  12.  
  13. /oracle/10g/oracle/bakup/database/oralife.ctl  
  14.  
  15. ORA-27038: created file already exists  
  16.  
  17. Additional information: 1  
  18.  
  19. SQL> alter database backup controlfile to  
  20.  
  21. 2  '/oracle/10g/oracle/bakup/database/oralife.ctl' reuse; --reuse用于覆蓋原有控制文件副本  
  22.  
  23. Database altered. 

 

--手動刪除所有控制文件模擬文件丟失

 

  1. SQL> ho rm /oracle/10g/oracle/product/10.2.0/oradata/oralife/*.ctl; 

 

--使用evan登錄,并添加數(shù)據(jù)

 

  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. spring  
  16.  
  17. hibernate  
  18.  
  19. hibernate  
  20.  
  21. SQL> insert into t_evan values('added');  
  22.  
  23. 1 row created.  
  24.  
  25. SQL> commit;  
  26.  
  27. Commit complete.  
  28.  
  29. SQL> conn / as sysdba  
  30.  
  31. Connected.  
  32.  
  33. SQL> shutdown immediate  
  34.  
  35. ORA-00210: cannot open the specified control file  
  36.  
  37. ORA-00202: control file: '/oracle/10g/oracle/product/10.2.0/oradata/oralife/control01.ctl'  
  38.  
  39. ORA-27041: unable to open file  
  40.  
  41. Linux Error: 2: No such file or directory  
  42.  
  43. Additional information: 3  
  44.  
  45. SQL> shutdown abort  
  46.  
  47. ORACLE instance shut down. 

 

--alter_oralife.log出現(xiàn)這樣的信息:

 

  1. Mon Aug  1 23:13:51 2011  
  2.  
  3. ORA-00202: control file: '/oracle/10g/oracle/product/10.2.0/oradata/oralife/control01.ctl'  
  4.  
  5. ORA-27037: unable to obtain file status  
  6.  
  7. Linux Error: 2: No such file or directory  
  8.  
  9. Additional information: 3 

 

--拷貝控制文件到目標路徑

 

  1. SQL>ho cp /oracle/10g/oracle/bakup/database/oralife.ctl /oracle/10g/oracle/product/10.2.0/oradata/oralife/control01.ctl  
  2.  
  3. SQL> alter system set control_files='/oracle/10g/oracle/product/10.2.0/oradata/oralife/control01.ctl' scope = spfile; --修改control_files參數(shù),指定可用的控制文件  
  4.  
  5. System altered.  
  6.  
  7. SQL> startup force mount  
  8.  
  9. ORACLE instance started.  
  10.  
  11. Total System Global Area  528482304 bytes  
  12.  
  13. Fixed Size                  1220360 bytes  
  14.  
  15. Variable Size             138412280 bytes  
  16.  
  17. Database Buffers          381681664 bytes  
  18.  
  19. Redo Buffers                7168000 bytes  
  20.  
  21. Database mounted. 

 

--生成trace文件

 

  1. SQL> alter database backup controlfile to trace noresetlogs;  
  2.  
  3. Database altered.  
  4.  
  5. SELECT c.VALUE || '/' || d.instance_name || '_ora_' || a.spid || '.trc' TRACE  
  6.  
  7. FROM v$process a, v$session b, v$parameter c, v$instance d  
  8.  
  9. WHERE a.addr = b.paddr  
  10.  
  11. AND b.audsid = USERENV ('sessionid')  
  12.  
  13. AND c.NAME = 'user_dump_dest';  
  14.  
  15. TRACE  
  16.  
  17. --------------------------------------------------------------------------------  
  18.  
  19. /oracle/10g/oracle/product/10.2.0/db_1/admin/oralife/udump/oralife_ora_4558.trc  
  20.  
  21. SQL> shutdown immediate  
  22.  
  23. ORA-01109: database not open  
  24.  
  25. Database dismounted.  
  26.  
  27. ORACLE instance shut down. 

 

--打開trace文件,去掉注釋,在shutdown狀態(tài)下執(zhí)行腳本,創(chuàng)建控制文件

--用evan登錄驗證數(shù)據(jù)

 

  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. spring  
  16.  
  17. hibernate  
  18.  
  19. hibernate  
  20.  
  21. added  
  22.  
  23. 6 rows selected. 

 

可見數(shù)據(jù)沒有丟失。

 

  1. SQL> select name from v$controlfile;  
  2.  
  3. NAME  
  4.  
  5. --------------------------------------------------------------------------------  
  6.  
  7. /oracle/10g/oracle/product/10.2.0/oradata/oralife/control01.ctl 

 

這時就需要重建多個控制文件了,以確保數(shù)據(jù)庫配置的安全性。

關于Oracle數(shù)據(jù)庫控制文件的備份與恢復就介紹到這里了,希望本次的介紹能夠帶給您一些收獲!

【編輯推薦】

  1. ASP.NET連接Oracle數(shù)據(jù)庫的步驟詳解
  2. Oracle 9i在AIX5L系統(tǒng)上的詳細安裝過程
  3. MySQL數(shù)據(jù)庫各種存儲引擎及其作用簡介
  4. 只需兩步即可實現(xiàn)SQL Server數(shù)據(jù)庫降級的方法
  5. 介紹幾種大型的Oracle/SQL Server數(shù)據(jù)庫免費版
責任編輯:趙鵬 來源: CSDN博客
相關推薦

2011-08-01 12:44:25

Oracle基于用戶管理備份與恢復

2011-08-03 18:42:21

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

2009-03-17 16:00:47

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

2011-05-20 09:35:24

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

2011-08-04 10:31:43

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

2010-04-13 11:09:21

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

2009-04-03 10:54:49

Oracle備份恢復

2009-10-13 09:43:43

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

2010-04-12 10:40:49

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

2023-11-15 09:38:49

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

2011-04-11 13:46:17

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

2009-04-17 11:28:16

Oracle備份恢復

2010-04-12 14:19:00

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

2011-07-26 13:55:01

MongoDB備份與恢復

2010-03-30 10:05:02

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

2010-10-26 10:24:06

Oracle控制文件

2011-05-26 15:27:08

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

2011-08-02 16:03:47

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

2011-08-29 16:41:14

OracleRMAN恢復數(shù)據(jù)文件的恢復

2011-05-17 11:33:43

oracle數(shù)據(jù)庫
點贊
收藏

51CTO技術棧公眾號