ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【实验】从RMAN备份中恢复spfile文件

【实验】从RMAN备份中恢复spfile文件

原创 Linux操作系统 作者:secooler 时间:2009-03-13 11:07:36 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE 总监,阿里云MVP,北京大学理学硕士,恩墨学院创始人,教育专家,中国区 Cloudera 首位官方授权大数据讲师,金牌培训专家,BDA大数据联盟创始人,OCM联盟创始人,ACCUG创始人、ACOUG核心专家,Blogger。

注册时间:2008-03-16

  • 博文量
    797
  • 访问量
    8007738