【實驗】從RMAN備份中恢復spfile檔案

secooler發表於2009-03-13
1.使用自動備份恢復spfile
ora10g@linux5 /home/oracle$ rman target /


Recovery Manager: Release 10.2.0.4.0 - Production on Sat Mar 14 03:00:39 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ORA10G (DBID=3998073128)

RMAN> list backup summary;

using target database control file instead of recovery catalog

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1       B  F  A DISK        13-MAR-09       1       1       NO         TAG20090313T082236
2       B  F  A DISK        13-MAR-09       1       1       NO         TAG20090313T082344

RMAN> restore spfile to '/home/oracle/spfileora10g.ora' from autobackup;

Starting restore at 14-MAR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=527 devtype=DISK

recovery area destination: /oracle/u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORA10G
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /oracle/u01/app/oracle/flash_recovery_area/ORA10G/autobackup/2009_03_13/o1_mf_s_681380624_4vm9wko2_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 14-MAR-09

RMAN> exit


Recovery Manager complete.
ora10g@linux5 /home/oracle$ ls -l spfile*
-rw-r----- 1 oracle oinstall 3584 Mar 14 03:01 spfileora10g.ora
ora10g@linux5 /home/oracle$ strings spfileora10g.ora
ora10g.__db_cache_size=58720256
ora10g.__java_pool_size=4194304
ora10g.__large_pool_size=4194304
ora10g.__shared_pool_size=92274688
ora10g.__streams_pool_size=4194304
*.audit_file_dest='/oracle/u01/app/oracle/admin/ora10g/adump'
*.background_dump_dest='/oracle/u01/app/oracle/admin/ora10g/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/oracle/u02/oradata/ORA10G/controlfile/o1_mf_4srph8fv_.ctl','/oracle/u01/app/oracle/flash_recovery_area/ORA10G/controlfile/o1_mf_4srph96b_.ctl'
*.core_dump_dest='/oracle/u01/app/oracle/admin/ora10g/cdump'
*.cursor_sharing='EXACT'
*.db_block_size=8192
*.db_create_file_dest='/oracle/u02/oradata'
*.db_create_online_log_dest_1='/oracle/u01'
*.db_create_online_log_dest_2='/oracle/u02'
*.db_create_online_log_dest_3='/oracle/u02'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ora10g'
*.db_recovery_file_dest='/oracle/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4294967296
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/u01/app/oracle/admin/ora10g/udump'

2.透過指定備份檔案的方法進行恢復
RMAN> restore spfile to '/home/oracle/spfileora10g.ora' from '/oracle/u01/app/oracle/flash_recovery_area/ORA10G/autobackup/2009_03_13/o1_mf_s_681380624_4vm9wko2_.bkp';

3.資料庫無法啟動,恢復spfile的第一種方法:透過建立一個臨時的pfile啟動資料庫到nomount,然後使用上述方法透過RMAN恢復spfile

4.
資料庫無法啟動,恢復spfile的第二種方法:使用RMAN啟動預設例項(DUMMY),進行spfile的恢復

ora10g@linux5 /home/oracle$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Mar 14 08:34:08 2009

Copyright (c) 1982, 2007, 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 '/oracle/u01/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area     159383552 bytes

Fixed Size                     1266344 bytes
Variable Size                 54529368 bytes
Database Buffers             100663296 bytes
Redo Buffers                   2924544 bytes

RMAN> exit


Recovery Manager complete.
ora10g@linux5 /home/oracle$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Mar 14 08:35:28 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: DUMMY (not mounted)

RMAN> restore spfile to '/home/oracle/spfileora10g.ora' from autobackup;

Starting restore at 14-MAR-09
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 03/14/2009 08:35:50
RMAN-06495: must explicitly specify DBID with SET DBID command

RMAN>

RMAN> restore spfile to '/home/oracle/spfileora10g.ora' from '/oracle/u01/app/oracle/flash_recovery_area/ORA10G/autobackup/2009_03_13/o1_mf_s_681380624_4vm9wko2_.bkp';

Starting restore at 14-MAR-09
using channel ORA_DISK_1

channel ORA_DISK_1: autobackup found: /oracle/u01/app/oracle/flash_recovery_area/ORA10G/autobackup/2009_03_13/o1_mf_s_681380624_4vm9wko2_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 14-MAR-09

RMAN> exit

5.小結
建議定期對spfile進行備份,如果使用RMAN作為日常的備份方法,需要將控制檔案自動備份功能開啟。
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;


-- The End --

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-567145/,如需轉載,請註明出處,否則將追究法律責任。

相關文章