控制檔案的備份和恢復
控制檔案有兩種常用的備份和恢復方法:
方法一:引數檔案轉儲:
SQL>create pfile='/oracle/pfile.txt' from spfile;
當資料庫不能啟動的時候,可以使用
SQL>startup pfile='/oracle/pfile.txt' 就可以使資料庫啟動。
方法二:RMAN自動備份的辦法:
1、配置RMAN的自動備份(預設情況下是關閉的)
RMAN>configure controlfile autobackup on;
2、察看是否有自動備份功能:
SQL> select * from v$rman_configuration;
CONF# NAME
---------- -----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 CONTROLFILE AUTOBACKUP
ON
3、備份資料庫:
RMAN> backup database;
Starting backup at 15-SEP-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=39 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/dg1/system01.dbf
input datafile fno=00003 name=/oracle/oradata/dg1/sysaux01.dbf
input datafile fno=00005 name=/oracle/oradata/dg1/example01.dbf
input datafile fno=00002 name=/oracle/oradata/dg1/undotbs01.dbf
input datafile fno=00004 name=/oracle/oradata/dg1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 15-SEP-08
channel ORA_DISK_1: finished piece 1 at 15-SEP-08
piece handle=/oracle/product/10.2.0/dbs/03jqleub_1_1 tag=TAG20080915T131659 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26
Finished backup at 15-SEP-08
Starting Control File and SPFILE Autobackup at 15-SEP-08
piece handle=/oracle/product/10.2.0/dbs/c-1646839347-20080915-00 comment=NONE
Finished Control File and SPFILE Autobackup at 15-SEP-08
注意控制檔案的命名方法:
C-IIIIIIIIII-YYYYMMDD-QQ
C表示“控制檔案”
IIIIIIIIII表示資料庫的DBID
YYYYMMDD表示時間
QQ表示序號00-FF(16進位制)
4、設定資料庫不能啟動的情況:
SQL> alter system set db_block_buffers=10000000 scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-00371: not enough shared pool memory, should be atleast 2568715059 bytes
5、編輯PFILE檔案:
[oracle@dg1 dbs]$ mv spfiledg1.ora spfiledg1.orabak
[oracle@dg1 dbs]$ mv init.ora initdg1.ora
為什麼要這麼做:因為資料庫首先查詢$ORALCE_HOME/dbs 下spfile
編輯init.ora中db_name='dg1'
6.啟動RMAN(以前有備份的檔案)
[oracle@dg1 dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 15 14:08:15 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: dg1 (not mounted)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 100663296 bytes
Fixed Size 1217908 bytes
Variable Size 92277388 bytes
Database Buffers 4194304 bytes
Redo Buffers 2973696 bytes
RMAN> restore spfile to '/oracle/spfile1.ora' from autobackup;
Starting restore at 15-SEP-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=46 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/15/2008 14:08:59
RMAN-06495: must explicitly specify DBID with SET DBID command
當不能指定DBID的情況下,自動恢復是不能成功的!
7、手工指定恢復的檔案集:
[oracle@dg1 dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Sep 15 13:52:51 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 100663296 bytes
Fixed Size 1217908 bytes
Variable Size 92277388 bytes
Database Buffers 4194304 bytes
Redo Buffers 2973696 bytes
RMAN> restore spfile to '/oracle/spfile.ora' from 'c-1646839347-20080915-00';
Starting restore at 15-SEP-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=47 devtype=DISK
channel ORA_DISK_1: autobackup found: c-1646839347-20080915-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 15-SEP-08
最後,成功將控制檔案恢復。。。。。。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8334342/viewspace-448477/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 12 使用RMAN備份和恢復檔案
- 檔案的基本管理和XFS檔案系統備份恢復
- 實戰:xfs檔案系統的備份和恢復
- XFS檔案系統的備份、恢復、修復
- 備份和恢復
- Oracle-無備份情況下,如何手動恢復控制檔案Oracle
- Linux中XFS檔案系統的備份,恢復,修復Linux
- Oracle為什麼使用備份的控制檔案恢復後一定要resetlogsOracle
- KunlunDB備份和恢復
- redis 備份和恢復Redis
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- 如何從Active Backup for Business備份中恢復檔案
- 如何備份及恢復Linux檔案許可權Linux
- SqlServer備份和恢復(二)SQLServer
- SqlServer 備份和恢復(一)SQLServer
- 【MySQL】MySQL備份和恢復MySql
- RAC備份恢復之Voting備份與恢復
- gitlab的資料備份和恢復Gitlab
- 【RMAN】Oracle中如何備份控制檔案?備份控制檔案的方式有哪幾種?Oracle
- 與控制檔案有關的恢復
- innobackupex 部分表備份和恢復
- Oracle 備份和恢復介紹Oracle
- 備份與恢復:polardb資料庫備份與恢復資料庫
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- DBV:冷備份的校驗和恢復
- 2.6.1 CDB中備份和恢復的概述
- Jira/Confluence的備份、恢復和遷移
- PostgreSql資料庫的備份和恢復SQL資料庫
- 【RMAN】如果控制檔案損壞那麼如何恢復?恢復控制檔案的方式有哪幾種?
- RMAN備份恢復典型案例——資料檔案存在壞快
- mydumper備份恢復
- Mysql備份恢復MySql
- 【備份】RMAN中對控制檔案的幾種備份方法
- 與控制檔案有關的恢復(二)
- 工具推薦:開源免費的檔案備份恢復工具:Kopia
- 九 GBase 8a備份和恢復
- MySQL日誌管理,備份和恢復MySql
- MySQL備份和恢復方法彙總MySql
- DB的備份與恢復