1.备份spfile

  有关控制文件及参数文件备份的几种形式:

  • 单独备份控制文件及参数文件

    RMAN> backup current controlfile;

  • 备份数据文件时包含控制文件

    RMAN> backup datafile 4 include current controlfile;

  • 单独备份spfile

2.恢复spfile

  SPFILE参数文件可以在RMAN中进行备份,因此可以使用RMAN来恢复SPFILE文件。可以自动备份SPFILE,SPFILE的自动备份是随着控制文件的备份一起被完成的,因此可以通过自动备份控制文件来实现自动备份SPFILE文件的目的。

  其次,在备份系统表空间时将引发控制文件的自动备份,而不论是否设置自动备份参数为ON,此时同样也备份SPFILE文件

SPFILE文件恢复步骤

1)  startup nomount [force];

2)  set dbid=dbid_no;

3)  restore spfile from autobackup | '<dir>'

4)  startup;

  下面设定控制文件的自动备份以及设置其备份路径(注意要预先知道目标数据库的DBID,此次事例的DBID为1420421951)。

  本例以单独备份,一般可将RMAN配置信息controlfile 配置为自动备份,则任务备份工作时,都将自动备份controlfile,spfile。

[oracle@ZTE-TEST144239 ~]$ rman target / nocatalog

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Oct 16 11:20:49 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1420421951)
using target database control file instead of recovery catalog RMAN> backup spfile format '/data2/backup/sp_%d_%U'; Starting backup at 16-OCT-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=14 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=5 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=138 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 16-OCT-15
channel ORA_DISK_1: finished piece 1 at 16-OCT-15
piece handle=/data2/backup/sp_ORCL_2hqjrkkt_1_1 tag=TAG20151016T112100 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-OCT-15 Starting Control File and SPFILE Autobackup at 16-OCT-15
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_10_16/o1_mf_s_893244062_c20v8zor_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 16-OCT-15

1.1备份spfile(单独备份)

可指定路径,备份多份
RMAN> backup copies 2 device type disk spfile format '/u01/app/oracle/fast_recovery_area/ORCL/sp_%d_%T_%U'; Starting backup at 16-OCT-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 16-OCT-15
channel ORA_DISK_1: finished piece 1 at 16-OCT-15 with 2 copies and tag TAG20151016T120250
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/sp_ORCL_20151016_2rqjrn3a_1_1 comment=NONE
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/sp_ORCL_20151016_2rqjrn3a_1_2 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-OCT-15 Starting Control File and SPFILE Autobackup at 16-OCT-15
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2015_10_16/o1_mf_s_893246571_c20xqfbk_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 16-OCT-15

1.2备份多份spfile的方法

Recovery Manager complete.
[oracle@ZTE-TEST144239 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 16 14:13:25 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ZTE-TEST144239 ~]$ cd $ORACLE_HOME/dbs
[oracle@ZTE-TEST144239 dbs]$ mv spfileorcl.ora spfileorcl.ora.bak

2.1试验删除spfile

[oracle@ZTE-TEST144239 ~]$ rman target / nocatalog

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Oct 16 14:15:49 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started) RMAN> startup nomount force; startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora' starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started Total System Global Area 158662656 bytes Fixed Size 2226456 bytes
Variable Size 130025192 bytes
Database Buffers 20971520 bytes
Redo Buffers 5439488 bytes RMAN> set DBID=1420421951;
executing command: SET DBID RMAN> restore spfile from '/u01/app/oracle/fast_recovery_area/ORCL/sp_ORCL_20151016_2rqjrn3a_1_1';
Starting restore at 16-OCT-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=429 device type=DISK channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORCL/sp_ORCL_20151016_2rqjrn3a_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 16-OCT-15

2.1恢复spfile

[oracle@TEST144239 /]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 16 14:44:32 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn scott/Sina.2015@study
Connected.
SQL> select * from dual;
D
-
X

3.结果

RMAN备份与恢复之spfile的更多相关文章

  1. RMAN备份与恢复之DataBase

    1   准备 [oracle@TEST144239 /]$ sqlplus /nolog SQL Production :: Copyright (c) , , Oracle. All rights ...

  2. Oracle备份恢复之rman备份oracle数据库

    备份需求和rman备份 oracle数据库的备份相关问答: 1)备份时数据库处于何种状态? 备份时数据库处于OPEN状态,这样数据库可以正常工作. 2)备份的数据备份在什么地方? 备份在本地磁盘. 3 ...

  3. RMAN备份脚本一列分享

    在ORACLE数据库中,RMAN备份的脚本非常多,下面介绍一例shell脚本如何通过RMAN备份,以及FTP上传RMAN备份文件以及归档日志文件的脚本. fullback.sh 里面调用RMAN命令做 ...

  4. oracle数据库rman备份计划及恢复

    1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog. 2.rman备份脚本: a.RMAN 0级备份 ...

  5. RMAN备份演练初级篇

    前面我们已经知道了如何进入rman,以及rman的一些基本命令,相信大家定会觉着rman操作的简单,事实也确实如此,但万不要因此小视rman的强大,简单往往意味着灵活,灵活对于那些有心人则意味着主动权 ...

  6. RMAN备份数据库与恢复数据库(整库)

    1 准备 2 1.1 检查数据库归档状态 2 1.2 RMAN登陆目标 2 2 备份全库 2 2.1 创建备份数据存储目录 2 2.2 RMAN备份全库 2 2.3 试验(备份后,改变数据) 5 2. ...

  7. Oracle RMAN备份恢复指导书

    目 录 1 目的与范围... 1 2 术语和定义... 1 3 角色和职责... 2 4 使用RMAN备份数据库... 2 4.1.1 检查数据库模式... 2 4.1.2 连接到target数据库. ...

  8. RAC 之 RMAN 备份

    这篇主要介绍的是RAC 环境下的RMAN 备份. 关于Oracle 备份与恢复的一些理论知识参考我的Blog:       Oracle 备份 与 恢复 概述 http://blog.csdn.net ...

  9. RMAN 备份详解

    一.数据库备份与RMAN备份的概念 1.数据库完全备份:按归档模式分为归档和非归档 归档模式 打开状态,属于非一致性备份        关闭状态,可以分为一致性和非一致性 非归档模式 打开状态,非一致 ...

随机推荐

  1. 清除浮动4-插入多余的div

    <!doctype html><html> <head> <meta charset="UTF-8"> <meta name= ...

  2. 把input类型剔出来

    <!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. JS实现Tab选项卡

    http://www.jb51.net/article/24694.htm http://www.sunsean.com/idTabs/#t1 http://www.cnblogs.com/sskse ...

  4. MINIX3 内核时钟分析

    MINIX3 内核时钟分析  4.1 内核时钟概要  先想想为什么 OS 需要时钟?时钟是异步的一个非常重要的标志,设想一下,如 果我们的应用程序需要在多少秒后将触发某个程序或者进程,我们该怎么做到? ...

  5. yii弹出层

    Yii弹出层,包装了JQuery的JDialog,使用很方便.Yii组件功能太强大,强大到无法自拔 $this->beginWidget('zii.widgets.jui.CJuiDialog' ...

  6. 互联网保险O2O平台微服务架构设计(转)

    非常感谢http://www.cnblogs.com/skyblog/p/5044486.html 关于架构,笔者认为并不是越复杂越好,而是相反,简单就是硬道理也提现在这里.这也是微服务能够流行的原因 ...

  7. 九 EJB

    一 EJB 1. 定义:EJB 就是一组用 Java 语言编写的包含字段和方法的代码体,而这些代码的核心任务就是实现纯粹的业务逻辑. 2. EJB 和 JavaBean 的相同点: a) 都有 get ...

  8. vcf_filter.py

    pyvcf 中带的一个工具 比其他工具用着好些 其他filter我很信不过~~  自己写的功能又很有限 所以转投vcf_filter.py啦 Filtering a VCF file based on ...

  9. 自动构建Makefile(1)--C/C++编译流程&Makefile规则简介

      前言: 大家在Windows上使用VS构建C/C++程序时,不需要自己编辑略显晦涩的Makefile文件,而对于初学者而言, 他们甚至没意识到它的存在.VS是自动生成Makefile文件, 并构建 ...

  10. Brainstorm in one sentence

    [1]佚名|台湾学生占领立法院 人會長大三次 第一次是發現世界不是為自己而轉的時候. 第二次是在發現即使再怎麼努力,終究還是有些事令人無能為力的時候. 第三次是在,明知道有些事可能會無能為力,但還是會 ...