oracle rman备份spfile,RMAN备份恢复之SPFILE的恢复(一)
缺少初始化文件,數據庫是無法啟動的。如果通過RMAN備份了初始化參數,那么可以通過RMAN對初始化參數進行恢復。
這篇文章簡單介紹CATALOG方式下初始化參數的恢復問題。
初始化參數的丟失和損壞,并不會造成太嚴重的問題,即使是最壞的情況,導致無法進行恢復,也是可以通過手工編輯一個新的PFILE文件,來啟動實例的。
而且,在數據庫的alert文件中包含了每次數據庫啟動使用的所有非默認值初始化參數,因此重新編寫一個初始化參數并不困難。
不過,既然對SPFILE進行了備份,那么完全可以采用恢復的方式來還原SPFILE。
對于CATALOG方式,SPFILE的恢復相對簡單很多。不過Oracle文檔上對于SPFILE的恢復的描述有些小問題:SET DBID這個步驟是不能省略的,否則會報錯。
$ rman target / catalog "rman/rman@testcen"
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/ora9/product/9.2/dbs/inittestdata.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> restore spfile;
Starting restore at 27-6月-07
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/27/2007 10:36:46
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20001: target database not found in recovery catalog
正確的方式如下:
$ rman target / catalog "rman/rman@testcen"
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: DUMMY (not mounted)
connected to recovery catalog database
RMAN> set dbid 2270762593;
executing command: SET DBID
RMAN> startup force nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/ora9/product/9.2/dbs/inittestdata.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 46137344 bytes
Database Buffers 50331648 bytes
Redo Buffers 667648 bytes
RMAN> restore spfile;
Starting restore at 27-6月-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=10 devtype=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: sid=11 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/opt/ora9/product/9.2/dbs/spfiletestdata.ora
channel ORA_DISK_1: restored backup piece 1
piece handle=/data1/backup/testdata/c-2270762593-20070626-01 tag=null params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 27-6月-07
RMAN> startup force
Oracle instance started
database mounted
database opened
Total System Global Area 1175525576 bytes
Fixed Size 452808 bytes
Variable Size 335544320 bytes
Database Buffers 838860800 bytes
Redo Buffers 667648 bytes
starting full resync of recovery catalog
full resync complete
SET DBID這個步驟是必須的。對于CATALOG模式,如果不知道數據庫的ID,可以通過CATALOG用戶登陸到CATALOG數據庫中進行查詢:
$ sqlplus rman/rman@testcen
SQL*Plus: Release 9.2.0.4.0 - Production on星期三6月27 15:36:30 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Session altered.
SQL> select dbid from rc_database where name = 'TESTDATA';
DBID
----------
2270762593
恢復之后,重啟數據庫實例,使得SPFILE生效。
總結
以上是生活随笔為你收集整理的oracle rman备份spfile,RMAN备份恢复之SPFILE的恢复(一)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: IOC操作Bean管理XML方式(bea
- 下一篇: 炫界 (795) -(脸兵马俑)_秦兵马