成都创新互联网站制作重庆分公司

NBULinux上oracle单实例恢复到单实例

注意:本文档操作系统环境以Linux为主,假设要恢复金融数据库;

创新互联公司是一家做网站、成都网站制作,提供网页设计,网站设计,网站制作,建网站,按需网站开发,网站开发公司,自2013年创立以来是互联行业建设者,服务者。以提升客户品牌价值为核心业务,全程参与项目的网站策划设计制作,前端开发,后台程序制作以及后期项目运营并提出专业建议和思路。

本文当主要以数据库恢复为主,操作系统安装、数据库安装配置和NBU客户端安装配置忽略;

要恢复的数据库信息:

1. 确定要恢复的数据库信息,如果数据库和操作系统可以正常访问,则可以登录数据库和操作系统查看和恢复信息相关的信息,如果数据库甚至是操作系统不可访问,则可以参考《oracle数据库信息收集》文档,里面记录了oracle数据库恢复的相关信息;

2. 为了确保恢复后的数据库可以尽快使用,尽量减少应用程序的修改,恢复完以后修改主机IP地址和原数据库地址保持一致;

准备环境:

1. 根据《oracle数据库信息收集》文档,安装操作系统和数据库软件,其中操作系统的版本尽量相同,数据库版本则需要一致;

2. 根据《oracle数据库信息收集》文档,挂载合适的存储,主要是存储的大小,所挂载的存储不可小于要恢复的数据库总容量大小,并配置合适的ASM磁盘组,磁盘组的大小和名称建议原来一样,磁盘组的容量可以大于原磁盘组;

3. 在客户端安装好NBU client,并保证通过NBU client可以正常访问备份文件;

恢复步骤:
恢复文件说明:

在操作系统上执行如下命令:

/usr/openv/netbackup/bin/bplist -C fxzmd -t 4 -l -R /

列出数据库备份信息,部分信息如下:

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-02

-rw-rw---- oracle oinstall 11796480 Aug 26 2014 /cntrl_365_1_856616015

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-01

-rw-rw---- oracle oinstall 262144 Aug 26 2014 /al_363_1_856615969

-rw-rw---- oracle oinstall 45088768 Aug 26 2014 /al_362_1_856615942

-rw-rw---- oracle oinstall 52166656 Aug 26 2014 /al_361_1_856615942

-rw-rw---- oracle oinstall 12058624 Aug 26 2014 /c-1492422082-20140826-00

-rw-rw---- oracle oinstall 10640128K Aug 26 2014 /bk_358_1_856615605

-rw-rw---- oracle oinstall 9893632K Aug 26 2014 /bk_359_1_856615605

-rw-rw---- oracle oinstall 12058624 Aug 25 19:19 /c-1492422082-20140825-02

信息说明:

cntrl_365_1_856616015 表示控制文件

c-1492422082-20140826-01 表示参数文件

al_362_1_856615942 表示归档文件

bk_359_1_856615605 表示数据文件

c-1492422082-20140826-01 表示dbid

恢复spfile文件:

本文档选取 c-1492422082-20140826-02作为恢复对象,设置数据库DBID,并把数据库启动到nomount状态:

[oracle@FXZMD ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Aug 26 12:47:21 2014

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

connected to target database (not started)

RMAN> set DBID=1492422082

executing command: SET DBID

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/app/oracle/product/10.2/db_1/dbs/initREPORT.ora'

starting Oracle instance without parameter file for retrival of spfile

Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 2094736 bytes

Variable Size 71305584 bytes

Database Buffers 79691776 bytes

Redo Buffers 6291456 bytes

RMAN> run {

2> allocate channel c1 type 'SBT_TAPE';

3> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT= FXZMD';

4> restore spfile from 'c-1492422082-20140826-02';

5> release channel c1;

6> }

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=35 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

Starting restore at 27-AUG-14

channel c1: autobackup found: c-1492422082-20140826-02

channel c1: SPFILE restore from autobackup complete

Finished restore at 27-AUG-14

released channel: c1

RMAN>

Spfile

创建pfile 修改pfile文件:

SQL> create pfile='/home/oracle/initfxzmd.ora' from spfile;

File created.

编辑pfile:

根据$ORACLE_BASE、$ORACLE_HOME创建相应的目录:

mkdir –p /app/oracle/admin/fxzmd/adump

mkdir –p /app/oracle/admin/fxzmd/bdump

mkdir –p /app/oracle/admin/fxzmd/cdump

mkdir –p /app/oracle/admin/fxzmd/udump

用修改过的pfile 创建spfile:

关闭数据库:

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

用新的pfile启动数据库到nomount:

SQL> startup nomount pfile='/home/oracle/initfxzmd.ora';

ORACLE instance started.

Total System Global Area 4.2446E+10 bytes

Fixed Size 2174824 bytes

Variable Size 3422552216 bytes

Database Buffers 3.9007E+10 bytes

Redo Buffers 14602240 bytes

SQL>

创建spfile:

SQL> create spfile from pfile='/home/oracle/initfxzmd.ora';

File created.

关闭数据库并启动数据库到nomount状态:

SQL> shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 4.2446E+10 bytes

Fixed Size 2174824 bytes

Variable Size 3422552216 bytes

Database Buffers 3.9007E+10 bytes

Redo Buffers 14602240 bytes

SQL>

恢复控制文件:

[oracle@bridge ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Aug 27 14:40:44 2014

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

connected to target database: fxzmd (not mounted)

RMAN> run

2> {

3> allocate channel c1 type 'SBT_TAPE';

4> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=FXZMD';

5> restore controlfile from 'cntrl_365_1_856616015';

6> release channel c1;

7> }

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=870 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

Starting restore at 27-AUG-14

channel c1: restoring control file

channel c1: restore complete, elapsed time: 00:00:52

output filename=+DGROUP1/fxzmd/controlfile/current.256.856708891

Finished restore at 27-AUG-14

released channel: c1

RMAN>

恢复数据库文件:

启动数据库到mount状态:

RMAN> alter database mount;

database mounted

恢复数据文件:

RMAN> run

2> {

3> allocate channel c1 type 'SBT_TAPE';

4> allocate channel c2 type 'SBT_TAPE';

5> allocate channel c3 type 'SBT_TAPE';

6> send 'NB_ORA_SERV=NBUServer,NB_ORA_CLIENT=FXZMD';

7> restore database;

8> recover database;

9> release channel c1;

10> release channel c2;

11> release channel c3;

12> }

allocated channel: c1

channel c1: sid=870 devtype=SBT_TAPE

channel c1: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

allocated channel: c2

channel c2: sid=866 devtype=SBT_TAPE

channel c2: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

allocated channel: c3

channel c3: sid=865 devtype=SBT_TAPE

channel c3: Veritas NetBackup for Oracle - Release 7.5 (2012020801)

sent command to channel: c1

sent command to channel: c2

sent command to channel: c3

Starting restore at 27-AUG-14

channel c1: starting datafile backupset restore

channel c1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to +DGROUP1/fxzmd/datafile/system.260.851643721

restoring datafile 00004 to +DGROUP1/fxzmd/datafile/users.264.851643735

restoring datafile 00005 to +DGROUP1/fxzmd/datafile/fxzmd_data.266.851768783

restoring datafile 00007 to +DGROUP1/fxzmd/datafile/fxzmd_data.268.851768825

restoring datafile 00010 to +DGROUP1/fxzmd/datafile/tbs_ogg.276.852039351

channel c1: reading from backup piece bk_359_1_856615605

channel c2: starting datafile backupset restore

channel c2: specifying datafile(s) to restore from backup set

restoring datafile 00002 to +DGROUP1/fxzmd/datafile/undotbs1.261.851643729

restoring datafile 00003 to +DGROUP1/fxzmd/datafile/sysaux.262.851643729

restoring datafile 00006 to +DGROUP1/fxzmd/datafile/fxzmd_data.267.851768799

restoring datafile 00008 to +DGROUP1/fxzmd/datafile/fxzmd_ndx.269.851768923

restoring datafile 00009 to +DGROUP1/fxzmd/datafile/fxzmd_ndx.270.851768943

channel c2: reading from backup piece bk_358_1_856615605

channel c1: restored backup piece 1

piece handle=bk_359_1_856615605 tag=HOT_DB_BK_LEVEL0

channel c1: restore complete, elapsed time: 00:02:35

channel c2: restored backup piece 1

piece handle=bk_358_1_856615605 tag=HOT_DB_BK_LEVEL0

channel c2: restore complete, elapsed time: 00:05:20

Finished restore at 27-AUG-14

Starting recover at 27-AUG-14

starting media recovery

channel c1: starting archive log restore to default destination

channel c1: restoring archive log

archive log thread=1 sequence=1221

channel c1: restoring archive log

archive log thread=1 sequence=1222

channel c1: reading from backup piece al_363_1_856615969

channel c1: restored backup piece 1

piece handle=al_363_1_856615969 tag=TAG20140826×××25222

channel c1: restore complete, elapsed time: 00:00:26

archive log filename=+DGROUP1/fxzmd/archivelog/2014_08_27/thread_1_seq_1221.264.856710143 thread=1 sequence=1221

archive log filename=+DGROUP1/fxzmd/archivelog/2014_08_27/thread_1_seq_1222.258.856710143 thread=1 sequence=1222

unable to find archive log

archive log thread=1 sequence=1223

released channel: c1

released channel: c2

released channel: c3

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 08/27/2014 15:02:36

RMAN-06054: media recovery requesting unknown log: thread 1 seq 1223 lowscn 64299772758

RMAN> alter database open;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 08/27/2014 15:03:57

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened

最后重启下数据库,恢复完成;

数据库正常恢复后配置:
修改主机的IP地址:
启动监听:

lsnrctl start

把spfile从文件系统放到ASM磁盘组中:

1. 创建pfile:

SQL> create pfile='/home/oracle/initfxzmd.ora' from spfile;

2. 创建spfile:

SQL> create spfile='+DGROUP1' from pfile='/home/oracle/initfxzmd.ora';

3. 修改pfile:

在$ORACLE_HOME/dbs下创建initfxzmd.ora文件,内容如下:

SPFILE='+DGROUP1/FXZMD/PARAMETERFILE/spfile.259.856714109'

4. 删除$ORACLE_HOME/dbs下的spfile,重启数据库:

SQL> show parameter spfile;

NAME TYPE VALUE

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

spfile string +DGROUP1/fxzmd/parameterfile/spfile.259.856714109

修改成功,spfile成功放入ASM磁盘组中;

5. 为了才dbca中能正常看到恢复过来的数据库,需要在

/etc/oratab 文件结尾添加如下内容:
fxzmd:/app/oracle/product/10.2/db_1:N

6. 最后做一个数据库全备!

###############################恢复20140827结束#######################


网页名称:NBULinux上oracle单实例恢复到单实例
文章地址:http://cxhlcq.com/article/jdgegg.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部