[20160905]DUMMY实例.txt

本文介绍在缺少spfile及init*.ora文件的情况下,如何使用Oracle RMAN启动DUMMY实例,并通过备份恢复spfile,最终使数据库能够正常启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[20160905]DUMMY实例.txt

--如果spfile,init*.ora不存在,oracle数据库是无法启动到nomount状态.
--但是rman支持启动DUMMY实例的特殊情用于恢复。做一个记录。

1.建立测试环境:
--测试前做一个spfile的备份
RMAN> backup spfile format '/u01/backup/spfile_%U';
Starting backup at 2016-09-05 09:13:50
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=90 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 2016-09-05 09:13:50
channel ORA_DISK_1: finished piece 1 at 2016-09-05 09:13:51
piece handle=/u01/backup/spfile_03rf1gue_1_1 tag=TAG20160905T091350 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2016-09-05 09:13:51

--关闭数据库。

$ echo $ORACLE_SID
book

$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs
$ mv spfilebook.ora spfilebook.ora_20160905
$ mv initbook.ora initbook.ora_20160905

2.测试:

SYS@book> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initbook.ora'

--//在sqlplus无法启动。而在rman里面

RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initbook.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area    1068937216 bytes
Fixed Size                     2260088 bytes
Variable Size                301990792 bytes
Database Buffers             754974720 bytes
Redo Buffers                   9711616 bytes
--退出在进入。

$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Wed Aug 3 11:34:33 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: DUMMY (not mounted)

--可以发现数据库实例DUMMY.

3.观察OS进程:
$ ps -ef | grep -i  dummy
oracle   26360 48541  0 09:07 pts/2    00:00:00 grep -i dummy

--可以发现没有包含dummy的进程.

$ ps -ef | grep   "_boo[k]"
oracle   26309     1  0 09:06 ?        00:00:00 ora_pmon_book
oracle   26311     1  0 09:06 ?        00:00:00 ora_psp0_book
oracle   26313     1  1 09:06 ?        00:00:01 ora_vktm_book
oracle   26317     1  0 09:06 ?        00:00:00 ora_gen0_book
oracle   26319     1  0 09:06 ?        00:00:00 ora_diag_book
oracle   26321     1  0 09:06 ?        00:00:00 ora_dbrm_book
oracle   26323     1  0 09:06 ?        00:00:00 ora_dia0_book
oracle   26325     1  0 09:06 ?        00:00:00 ora_mman_book
oracle   26327     1  0 09:06 ?        00:00:00 ora_dbw0_book
oracle   26329     1  0 09:06 ?        00:00:00 ora_dbw1_book
oracle   26331     1  0 09:06 ?        00:00:00 ora_dbw2_book
oracle   26333     1  0 09:06 ?        00:00:00 ora_lgwr_book
oracle   26335     1  0 09:06 ?        00:00:00 ora_ckpt_book
oracle   26337     1  0 09:06 ?        00:00:00 ora_smon_book
oracle   26339     1  0 09:06 ?        00:00:00 ora_reco_book
oracle   26341     1  0 09:06 ?        00:00:00 ora_mmon_book
oracle   26343     1  0 09:06 ?        00:00:00 ora_mmnl_book

--反到是存在包含实例名book的进程.

4.恢复spfile文件看看:

RMAN> restore spfile from autobackup ;
Starting restore at 2016-09-05 09:08:10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1345 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/05/2016 09:08:11
RMAN-06495: must explicitly specify DBID with SET DBID command

--要求指定dbid。我感觉主要不知道fast_recovery_area目录在哪里。确定dbid可以看文件头

BBED> set dba 1,1
        DBA             0x00400001 (4194305 1,1)

BBED> p kcvfh.kcvfhhdr.kccfhdbi
ub4 kccfhdbi                                @28       0x4fb7216e

BBED> p /d kcvfh.kcvfhhdr.kccfhdbi
ub4 kccfhdbi                                @28       1337401710
======================================================================

RMAN> restore spfile from '/u01/backup/spfile_03rf1gue_1_1';
Starting restore at 2016-09-05 09:15:59
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/backup/spfile_03rf1gue_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 2016-09-05 09:16:00

$ ls -l  /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfilebook.ora
-rw-r----- 1 oracle oinstall 3584 2016-09-05 09:15:59 /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfilebook.ora

SYS@book> shutdown immediate ;
ORA-01507: database not mounted


ORACLE instance shut down.
SYS@book> startup nomount
ORACLE instance started.

Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes

--oracle通过这个实例DUMMY,解决鸡生蛋,蛋生鸡的问题.有了spfile文件,再执行恢复就简单了.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值