« Oracle9i新特点-判断是否使用了spfile | Blog首页 | 应对Gmail威胁 新版Hotmail正式公测 »
Oracle9i新特点-从自动备份中恢复spfile和控制文件
链接:https://www.eygle.com/archives/2005/10/oracle9i_feature_spfile04.html
本文发表于itpub技术丛书《Oracle数据库DBA专题技术精粹》,未经许可,严禁转载本文.
六. SPFILE的备份与恢复
在本文开篇我们提到,Oracle把Spfile也纳入到Rman的备份恢复策略当中,如果你配置了控制文件自动备份(autoback),那么Oracle会
在数据库发生重大变化(如增减表空间)时自动进行控制文件及Spfile文件的备份。
下面我们来看一下这个过程:
a. 设置控制文件自动备份:
|
[oracle@jumper oracle]$ rman target / Recovery Manager: Release 9.2.0.3.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected to target database: HSJF (DBID=1052178311) RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; using target database controlfile instead of recovery catalog RMAN> exit |
这个设置可以在数据库中通过如下方式查询得到:
[oracle@jumper bdump]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.3.0 - Production on Sat Jan 17 01:08:05 2004 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: SQL> select * from v$rman_configuration;
|
b. 记录数据库变化
|
SQL> create tablespace eygle Tablespace created.
|
如果新创建一个表空间,这时候检查alert<sid>.log文件,你可以在其中发现这样的备份信息:
Sat Jan 17 00:55:57 2004 |
如果使用rman进行备份,在提示中你可以看到如下信息:
RMAN> configure controlfile autobackup on; old RMAN configuration parameters: RMAN> run allocated channel: ch1 Starting backup at 02-DEC-03 Starting Control File and SPFILE Autobackup at 02-DEC-03 released channel: ch1
|
我们简单看一下自动备份的控制文件及spfile文件的格式及命名规则:
c-IIIIIIIIII-YYYYMMDD-QQ
c ------------------------控制文件
IIIIIIIIII---------DBID
YYYYMMDD------------时间戳
QQ----------------------序号00-FF,16进制表示
c. 使用自动备份恢复spfile文件
[oracle@jumper bdump]$ rman target / Recovery Manager: Release 9.2.0.3.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected to target database: HSJF (DBID=1052178311) RMAN> restore spfile to '/tmp/spfileeygle.ora' from autobackup; Starting restore at 17-JAN-04 using target database controlfile instead of recovery catalog RMAN> exit Recovery Manager complete.
|
你同样可以通过这种方法恢复控制文件,示例如下:
[oracle@jumper bdump]$ rman target / Recovery Manager: Release 9.2.0.3.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected to target database: HSJF (DBID=1052178311) RMAN> restore controlfile to '/tmp/control01.ctl' from autobackup; Starting restore at 17-JAN-04 using target database controlfile instead of recovery catalog RMAN> exit Recovery Manager complete.
|
Oracle9i自动备份控制文件的功能给我们带来了极大的收益,通过自动备份,在数据库出现紧急状况的时候,你可能可以从这个自动备份中获得更
为有效及时的控制文件.
缺省的,这个自动备份功能是关闭的,你可以用我们上面提到的方法打开该功能.
历史上的今天...
>> 2016-10-10文章:
>> 2012-10-10文章:
>> 2008-10-10文章:
>> 2006-10-10文章:
By eygle on 2005-10-10 19:59 | Comments (0) | FAQ | 473 |