引數檔案的恢復方法

kuqlan發表於2012-06-12

[oracle@dbserv ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 12 01:51:22 2012

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

connected to target database: TEST (DBID=2083742440)

RMAN> restore spfile to '/tmp/spfiletest.ora' from autobackup;

Starting restore at 12-JUN-12

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=157 devtype=DISK

channel ORA_DISK_1: looking for autobackup on day: 20120612

channel ORA_DISK_1: looking for autobackup on day: 20120611

channel ORA_DISK_1: looking for autobackup on day: 20120610

channel ORA_DISK_1: autobackup found: c-2083742440-20120610-00

channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 12-JUN-12

RMAN>

[@more@]

[oracle@dbserv ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 12 02:07:27 2012

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

SQL> create pfile='/tmp/pfiletest.ora' from spfile='/tmp/spfiletest.ora';

File created.

SQL>

[oracle@dbserv tmp]$ more pfiletest.ora

test.__db_cache_size=1644167168

test.__java_pool_size=16777216

test.__large_pool_size=16777216

test.__shared_pool_size=452984832

test.__streams_pool_size=0

*.audit_file_dest='/opt/oracle/admin/test/adump'

*.background_dump_dest='/opt/oracle/admin/test/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/opt/oracle/oradata/test/control01.ctl','/opt/oracle/oradata/test/control02.ctl','/opt/oracle/oradata/test/control03.ctl'

*.core_dump_dest='/opt/oracle/admin/test/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='test'

*.job_queue_processes=10

*.log_archive_dest_1='location=/opt/backup'

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=300

*.pga_aggregate_target=839909376

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=2147483648

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/admin/test/udump'

[oracle@dbserv tmp]$

以上操作的前提是,開啟rman的空中檔案自動備份功能。開啟後oracle在$ORACLE_HOME/dbs下會預設生成控制檔案和spfile的自動備份;

這個備份就是以上恢復的來源。以上過程中也可以指定該備份名稱,具體$ORACLE_HOME/dbs語法如下:

RMAN> restore spfile to '/tmp/spfiletest.ora' from 'c-2083742440-20120610-00';

因控制檔案重要性,Oracle也會在$ORACLE_HOME/dbs下自動生成一個控制檔案和spfile的快照備份。這個也可以用於恢復,具體語法如下:

RMAN> restore spfile to '/tmp/spfiletest.ora' from 'snapcf_test.f';

RMAN> show all;

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/product/10.2.0/dbs/snapcf_test.f'; # default

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

old RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/product/10.2.0/dbs/snapcf_test.f'; # default

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

相關文章