spfile 和pfile 在数据库open和shutdown 的两种情况下的恢复成功。

2023-11-29 13:18

本文主要是介绍spfile 和pfile 在数据库open和shutdown 的两种情况下的恢复成功。,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本实验室做当数据库在 open 和shutdown 的两种情况下spfile 和pfile 丢失的情况下的恢复。

oracle@aoracle dbs]$ rman target rman_user/rman_user;

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Dec 8 19:21:38 2011

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

connected to target database: EZHOU (DBID=4046377924, not open)

RMAN> restore spfile;

Starting restore at 08-DEC-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=149 devtype=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/08/2011 19:21:56
RMAN-06564: must use the TO clause when the instance is started with SPFILE

RMAN> restore spfile to '/u02/rman/spfile.ora' from autobackup;

Starting restore at 08-DEC-11
using channel ORA_DISK_1

channel ORA_DISK_1: looking for autobackup on day: 20111208
channel ORA_DISK_1: autobackup found: /u02/rman/ctl_c-4046377924-20111208-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 08-DEC-11

RMAN>

把spfile 拷贝到$ORACLE_HOME/dbs下就可以了。

===================

下面进行:数据库处于关闭状态,丢失spfile,pfile

[oracle@aoracle dbs]$ mv spfileezhou.ora spfileezhou.ora_b
[oracle@aoracle dbs]$ mv initezhou.ora initezhou.ora_b

[oracle@aoracle dbs]$ ls -l *ezhou*.ora*
-rw-r--r-- 1 oracle oinstall  986 Dec  6 19:27 initezhou.ora_b
-rw-r----- 1 oracle oinstall 2560 Dec  8 19:38 spfileezhou.ora_b

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

[oracle@aoracle admin]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 8 20:01:33 2011

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

Connected to an idle instance.

SQL> startup;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/pp/oracle/product/10.2/db_1/dbs/initezhou.ora'
SQL> startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/pp/oracle/product/10.2/db_1/dbs/initezhou.ora'
SQL> startup force nomount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/pp/oracle/product/10.2/db_1/dbs/initezhou.ora'
SQL> !
[oracle@aoracle admin]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Thu Dec 8 20:04:10 2011

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

connected to target database (not started)

RMAN> restore spfile from '/u02/rman/ctl_c-4046377924-20111208-00'
2> ;

Starting restore at 08-DEC-11
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/08/2011 20:05:29
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

RMAN> startup force nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/pp/oracle/product/10.2/db_1/dbs/initezhou.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area     159383552 bytes

Fixed Size                     1218268 bytes
Variable Size                 54528292 bytes
Database Buffers             100663296 bytes
Redo Buffers                   2973696 bytes

RMAN> restore spfile from autobackup;

Starting restore at 08-DEC-11
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 12/08/2011 20:06:44
RMAN-06495: must explicitly specify DBID with SET DBID command

RMAN> set dbid 4046377924

executing command: SET DBID

RMAN> restore spfile from autobackup;

Starting restore at 08-DEC-11
using channel ORA_DISK_1

channel ORA_DISK_1: looking for autobackup on day: 20111208
channel ORA_DISK_1: looking for autobackup on day: 20111207
channel ORA_DISK_1: looking for autobackup on day: 20111206
channel ORA_DISK_1: looking for autobackup on day: 20111205
channel ORA_DISK_1: looking for autobackup on day: 20111204
channel ORA_DISK_1: looking for autobackup on day: 20111203
channel ORA_DISK_1: looking for autobackup on day: 20111202
channel ORA_DISK_1: no autobackup in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/08/2011 20:07:18
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece

RMAN> restore spfile from '/u02/rman/ctl_c-4046377924-20111208-00';

Starting restore at 08-DEC-11
using channel ORA_DISK_1

channel ORA_DISK_1: autobackup found: /u02/rman/ctl_c-4046377924-20111208-00
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 08-DEC-11

RMAN>

pfile 从spfile create 就可以了。

========
总结: spfile 和pfile 在数据库open和shutdown 的两种情况下的恢复成功。

 

这篇关于spfile 和pfile 在数据库open和shutdown 的两种情况下的恢复成功。的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/432964

相关文章

SpringBoot实现数据库读写分离的3种方法小结

《SpringBoot实现数据库读写分离的3种方法小结》为了提高系统的读写性能和可用性,读写分离是一种经典的数据库架构模式,在SpringBoot应用中,有多种方式可以实现数据库读写分离,本文将介绍三... 目录一、数据库读写分离概述二、方案一:基于AbstractRoutingDataSource实现动态

C# WinForms存储过程操作数据库的实例讲解

《C#WinForms存储过程操作数据库的实例讲解》:本文主要介绍C#WinForms存储过程操作数据库的实例,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、存储过程基础二、C# 调用流程1. 数据库连接配置2. 执行存储过程(增删改)3. 查询数据三、事务处

mysql数据库重置表主键id的实现

《mysql数据库重置表主键id的实现》在我们的开发过程中,难免在做测试的时候会生成一些杂乱无章的SQL主键数据,本文主要介绍了mysql数据库重置表主键id的实现,具有一定的参考价值,感兴趣的可以了... 目录关键语法演示案例在我们的开发过程中,难免在做测试的时候会生成一些杂乱无章的SQL主键数据,当我们

Docker镜像pull失败两种解决办法小结

《Docker镜像pull失败两种解决办法小结》有时候我们在拉取Docker镜像的过程中会遇到一些问题,:本文主要介绍Docker镜像pull失败两种解决办法的相关资料,文中通过代码介绍的非常详细... 目录docker 镜像 pull 失败解决办法1DrQwWCocker 镜像 pull 失败解决方法2总

在C#中调用Python代码的两种实现方式

《在C#中调用Python代码的两种实现方式》:本文主要介绍在C#中调用Python代码的两种实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录C#调用python代码的方式1. 使用 Python.NET2. 使用外部进程调用 Python 脚本总结C#调

Spring Boot 整合 MyBatis 连接数据库及常见问题

《SpringBoot整合MyBatis连接数据库及常见问题》MyBatis是一个优秀的持久层框架,支持定制化SQL、存储过程以及高级映射,下面详细介绍如何在SpringBoot项目中整合My... 目录一、基本配置1. 添加依赖2. 配置数据库连接二、项目结构三、核心组件实现(示例)1. 实体类2. Ma

使用Python实现网络设备配置备份与恢复

《使用Python实现网络设备配置备份与恢复》网络设备配置备份与恢复在网络安全管理中起着至关重要的作用,本文为大家介绍了如何通过Python实现网络设备配置备份与恢复,需要的可以参考下... 目录一、网络设备配置备份与恢复的概念与重要性二、网络设备配置备份与恢复的分类三、python网络设备配置备份与恢复实

IDEA中Git版本回退的两种实现方案

《IDEA中Git版本回退的两种实现方案》作为开发者,代码版本回退是日常高频操作,IntelliJIDEA集成了强大的Git工具链,但面对reset和revert两种核心回退方案,许多开发者仍存在选择... 目录一、版本回退前置知识二、Reset方案:整体改写历史1、IDEA图形化操作(推荐)1.1、查看提

Android自定义Scrollbar的两种实现方式

《Android自定义Scrollbar的两种实现方式》本文介绍两种实现自定义滚动条的方法,分别通过ItemDecoration方案和独立View方案实现滚动条定制化,文章通过代码示例讲解的非常详细,... 目录方案一:ItemDecoration实现(推荐用于RecyclerView)实现原理完整代码实现

浅析CSS 中z - index属性的作用及在什么情况下会失效

《浅析CSS中z-index属性的作用及在什么情况下会失效》z-index属性用于控制元素的堆叠顺序,值越大,元素越显示在上层,它需要元素具有定位属性(如relative、absolute、fi... 目录1. z-index 属性的作用2. z-index 失效的情况2.1 元素没有定位属性2.2 元素处