oracle rman之丟失spfile恢復
現在我們只說spfile丟失的恢復方法,spfile 是一個二進位制檔案不可以手工修改,例項啟動時查詢順序為spfile>pfile>init,
1,如果有pfile 當然可以用pfile 啟動,然後create spfile from pfile;
2,如果沒有pfile 也可以去alter日誌copy一段內容,新建個pfile用上面的方法建spfile;
3,如果以前用rman 做過備份且備了spfile,就可以用rman 來恢復一個
下面實驗第3條用rman
rman 分catalog和非catalog備份,非catalog存放在控制檔案中,catalog是存放在catalog資料庫中,catalog database可以和target database 在一臺機器上不過不建議。
CONFIGURE CONTROLFILE AUTOBACKUP ON; 預設為off
實驗步驟是用rman nocatalog先做個資料庫全備,然後在os刪掉spfile,用rman 恢復spfile
–綠字為註釋
[oracle@orazhang dbs]$ rman nocatalog nocatalog可帶可不帶為rman預設
Recovery Manager: Release 10.2.0.1.0 - Production on 星期二 2月 22 11:56:37 2011 紅色部分為rman版本資訊
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> list backup 無顯示為當前沒有備份集
2> ;
RMAN> backup format ‘/rmanbackup/%d_%s_%p_%T.bak’ database; –全備 路徑可帶可不帶
Starting backup at 21-2月 -11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
input datafile fno=00007 name=+ASMDATA/asmts01.dbf
input datafile fno=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_6cgckx9p_.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_6cgckx9x_.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
input datafile fno=00010 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs1_6okmoslq_.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/ORCL/datafile/tt.dbf
input datafile fno=00009 name=/u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
channel ORA_DISK_1: starting piece 1 at 21-2月 -11
channel ORA_DISK_1: finished piece 1 at 21-2月 -11
piece handle=/rmanbackup/ORCL_189_1_20110221.bak tag=TAG20110221T195210 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:25
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00008 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs4_6cgcmnfg_.dbf
channel ORA_DISK_1: starting piece 1 at 21-2月 -11
channel ORA_DISK_1: finished piece 1 at 21-2月 -11
piece handle=/rmanbackup/ORCL_190_1_20110221.bak tag=TAG20110221T195210 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 21-2月 -11
Starting Control File and SPFILE Autobackup at 21-2月 -11
piece handle=/home/oracle/c-1246063822-20110221-01.ctl comment=NONE
Finished Control File and SPFILE Autobackup at 21-2月 -11
RMAN> list backupset;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
133 Full 3.64G DISK 00:05:16 21-2月 -11
BP Key: 133 Status: AVAILABLE Compressed: NO Tag: TAG20110221T195210
Piece Name: /rmanbackup/ORCL_189_1_20110221.bak
List of Datafiles in backup set 133
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ———- —-
1 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_6cgckx95_.dbf
2 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_6cgckx9x_.dbf
3 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_6cgckx9p_.dbf
4 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_6cgckxds_.dbf
5 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_6cgckxc7_.dbf
6 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/tt.dbf
7 Full 43500349 21-2月 -11 +ASMDATA/asmts01.dbf
9 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/tt1.dbf
10 Full 43500349 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs1_6okmoslq_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
134 Full 76.00K DISK 00:00:02 21-2月 -11
BP Key: 134 Status: AVAILABLE Compressed: NO Tag: TAG20110221T195210
Piece Name: /rmanbackup/ORCL_190_1_20110221.bak
List of Datafiles in backup set 134
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ———- —-
8 Full 43500496 21-2月 -11 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_tbs4_6cgcmnfg_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
135 Full 6.83M DISK 00:00:01 21-2月 -11
BP Key: 135 Status: AVAILABLE Compressed: NO Tag: TAG20110221T195739
Piece Name: /home/oracle/c-1246063822-20110221-01.ctl –這路徑是我在rman config中配置的
Control File Included: Ckp SCN: 43500507 Ckp time: 21-2月 -11
SPFILE Included: Modification time: 21-2月 -11
[oracle@orazhang dbs]$ mv spfileorcl.ora spfileorcl.ora_bak
[oracle@orazhang dbs]$ ls
ab_+ASM.dat init+ASM.ora lkORCL run_grant.sql
alert_orcl.log initdw.ora orapw+ASM snapcf_orcl.f
hc_+ASM.dat init.ora orapworcl spfile+ASM.ora
hc_orcl.dat lk+ASM reorg21.sql spfileorcl.ora_bak
[oracle@orazhang dbs]$ ora
SQL*Plus: Release 10.2.0.1.0 – Production on 星期二 2月 22 10:19:53 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
SQL> shudown immediate
SP2-0734: unknown command beginning “shudown im…” – rest of line ignored.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora’
SQL>
--不要在sqlplus裡startup ,去rman 裡 startup 到nomount
oracle@orazhang dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 – Production on 星期二 2月 22 10:24:22 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora’
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218244 bytes
Variable Size 58722620 bytes
Database Buffers 92274688 bytes
Redo Buffers 7168000 bytes
RMAN> restore spfile from autobackup;
Starting restore at 22-2月 -11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/22/2011 10:43:06
RMAN-06495: must explicitly specify DBID with SET DBID command
–提示如果要用 autobackup,就要指定dbid, 要先在 rman 中set dbid=xxxx,dbid在rman備份時會顯示,也可以在資料庫狀態開啟時,用
SQL> select dbid from v$database;
DBID
———-
1246063822
如果知道dbid就可以
RMAN> startup nomount
Oracle instance started
Total System Global Area 562036736 bytes
Fixed Size 1220556 bytes
Variable Size 176160820 bytes
Database Buffers 377487360 bytes
Redo Buffers 7168000 bytes
RMAN> set dbid=1246063822
executing command: SET DBID
RMAN> restore spfile from autobackup;
現在是假如我dbid不知道怎麼辦?直接指定備份的控制檔案
RMAN> restore spfile from ‘/home/oracle/c-1246063822-20110221-01.ctl’;
Starting restore at 22-2月 -11
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: autobackup found: /home/oracle/c-1246063822-20110221-01.ctl
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 22-2月 -11
RMAN> shutdown immediate
using target database control file instead of recovery catalog
Oracle instance shut down
RMAN> startup
connected to target database (not started)
Oracle instance started
database mounted
database opened
Total System Global Area 562036736 bytes
Fixed Size 1220556 bytes
Variable Size 176160820 bytes
Database Buffers 377487360 bytes
Redo Buffers 7168000 bytes
好,spfile恢復成功了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-709588/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Redo丟失恢復方案Oracle
- dg丟失歸檔,使用rman增量備份恢復
- Oracle 備份恢復篇之RMAN catalogOracle
- Oracle RMAN恢復測試Oracle
- 2.7.10 恢復丟失或損壞的伺服器引數檔案(SPFILE)伺服器
- Oracle 目錄許可權丟失故障恢復Oracle
- 【ASK_ORACLE】Oracle表決磁碟丟失後的恢復方法Oracle
- Oracle RMAN 表空間恢復Oracle
- RMAN恢復之RMAN-06555處理
- Oracle閃回功能恢復偶然丟失的資料(轉)Oracle
- ORACLE 11.2.0.4 RAC RMAN異機恢復之ORA-15001Oracle
- 伺服器資料丟失了怎麼恢復/分割槽丟失恢復教程伺服器
- 分割槽丟失資料恢復資料恢復
- 硬碟資料丟失如何恢復?硬碟
- ORACLE DG從庫 Rman備份恢復Oracle
- 伺服器資料恢復案例之RAID資訊丟失資料恢復伺服器資料恢復AI
- Oracle 12C新特性-RMAN恢復表Oracle
- RMAN增量恢復
- oracle控制檔案的損壞或完全丟失的恢復辦法Oracle
- 電腦檔案丟失資料恢復資料恢復
- 伺服器RAID資料丟失恢復伺服器AI
- OMV資料恢復NAS陣列丟失資料恢復陣列
- 如何恢復伺服器資料丟失伺服器
- chkdsk 後資料丟失的恢復方法
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- Oracle-真實環境的丟失current redo log file的故障恢復Oracle
- 【DATAGUARD】Oracle 通過Dataguard指定恢復時間用於找回丟失資料Oracle
- RMAN恢復實踐
- 丟失的隨身碟檔案如何恢復?
- oracle ORA-01180 ORA-01110(rman恢復問題)Oracle
- NBU恢復Oracle通道完成後RMAN沒有進度Oracle
- 【RMAN】Oracle12c之後,rman備份Dataguard備端恢復可能出現邏輯錯誤Oracle
- 【資料庫資料恢復】斷電導致Oracle資料庫資料丟失的資料恢復案例資料庫資料恢復Oracle
- 剪下的檔案還能恢復嗎,恢復剪貼丟失的檔案
- u盤資料丟失怎麼恢復?有效的恢復方法在這裡
- 伺服器(RAID1)資料丟失恢復伺服器AI
- 伺服器(RAID)資料丟失瞭如何恢復?伺服器AI
- 【BBED】丟失歸檔檔案情況下的恢復
- RMAN備份恢復技巧