分享
 
 
 

Oracle9i新特点-SPFILE的使用

王朝oracle·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

Oracle9i新特点:SPFILE的使用

--How to backup and restore spfile and controlfile using autobackup option

Last Updated: Wednesday, 2004-10-27 0:40 Eygle

本文发表于itpub技术丛书《Oracle数据库DBA专题技术精粹》,未经许可,严禁转载本文.

原文出处:

http://www.eygle.com/faq/Oracle9i.New.Feature.Spfile.04.htm

六. 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

old RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP OFF;

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored

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:

Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.3.0 - Production

SQL> select * from v$rman_configuration;

CONF# NAME VALUE

---------- ------------------------- ----------

1 CONTROLFILE AUTOBACKUP ON

b. 记录数据库变化

SQL> create tablespace eygle

2 datafile '/data1/oracle/oradata/eygle01.dbf'

3 size 5M;

Tablespace created.

假如新创建一个表空间,这时候检查alert<sid>.log文件,你可以在其中发现这样的备份信息:

Sat Jan 17 00:55:57 2004

Starting control autobackup

Control autobackup written to DISK device

handle '/opt/oracle/product/9.2.0/dbs/c-1052178311-20040117-00'

Completed: create tablespace eygle

datafile '/data1/oracle/oradata/eygle01.dbf’

假如使用rman进行备份,在提示中你可以看到如下信息:

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> run

2> {

3> allocate channel ch1 type disk format='e:\oracle\orabak\penny%t.arc';

4> backup archivelog all delete all input;

5> release channel ch1;

6> }

allocated channel: ch1

channel ch1: sid=13 devtype=DISK

Starting backup at 02-DEC-03

current log archived

channel ch1: starting archive log backupset

channel ch1: specifying archive log(s) in backup set

input archive log thread=1 sequence=63 recid=168 stamp=511712617

input archive log thread=1 sequence=64 recid=169 stamp=511712620

input archive log thread=1 sequence=65 recid=170 stamp=511712626

input archive log thread=1 sequence=66 recid=171 stamp=511712690

channel ch1: starting piece 1 at 02-DEC-03

channel ch1: finished piece 1 at 02-DEC-03

piece handle=E:\ORACLE\ORABAK\PENNY511712693.ARC comment=NONE

channel ch1: backup set complete, elapsed time: 00:00:03

channel ch1: deleting archive log(s)

archive log filename=E:\ORACLE\ORADATA\PENNY\ARCHIVE\1_63.DBF recid=168 stamp=511712617

archive log filename=E:\ORACLE\ORADATA\PENNY\ARCHIVE\1_64.DBF recid=169 stamp=511712620

archive log filename=E:\ORACLE\ORADATA\PENNY\ARCHIVE\1_65.DBF recid=170 stamp=511712626

archive log filename=E:\ORACLE\ORADATA\PENNY\ARCHIVE\1_66.DBF recid=171 stamp=511712690

Finished backup at 02-DEC-03

Starting Control File and SPFILE Autobackup at 02-DEC-03

piece handle=E:\ORACLE\ORA92\DATABASE\C-3627775766-20031202-01 comment=NONE

Finished 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

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=18 devtype=DISK

channel ORA_DISK_1: looking for autobackup on day: 20040117

channel ORA_DISK_1: autobackup found: c-1052178311-20040117-01

channel ORA_DISK_1: SPFILE restore from autobackup complete

Finished restore at 17-JAN-04

RMAN>

exit

Recovery Manager complete.

[oracle@jumper bdump]$ ls -l /tmp/spfileeygle.ora

-rw-r----- 1 oracle dba 3584 1月 17 09:34 /tmp/spfileeygle.ora

你同样可以通过这种方法恢复控制文件,示例如下:

[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

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=10 devtype=DISK

channel ORA_DISK_1: looking for autobackup on day: 20040117

channel ORA_DISK_1: autobackup found: c-1052178311-20040117-02

channel ORA_DISK_1: controlfile restore from autobackup complete

Finished restore at 17-JAN-04

RMAN> exit

Recovery Manager complete.

[oracle@jumper bdump]$ ls -l /tmp/control*

-rw-r----- 1 oracle dba 1892352 1月 17 09:44 /tmp/control01.ctl

Oracle9i自动备份控制文件的功能给我们带来了极大的收益,通过自动备份,在数据库出现紧急状况的时候,你可能可以从这个自动备份中获得更

为有效及时的控制文件.

缺省的,这个自动备份功能是关闭的,你可以用我们上面提到的方法打开该功能.

<<上一页 下一页>>

本文作者:

eygle,Oracle技术关注者,来自中国最大的Oracle技术论坛itpub.

www.eygle.com是作者的个人站点.你可通过Guoqiang.Gai@gmail.com来联系作者.欢迎技术探讨交流以及链接交换.

原文出处:

http://www.eygle.com/faq/Oracle9i.New.Feature.Spfile.04.htm

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有