ITPub博客

首页 > 数据库 > Oracle > 【RMAN】RMAN跨版本恢复(中)

【RMAN】RMAN跨版本恢复(中)

Oracle 作者:lhrbest 时间:2015-04-10 10:12:39 0 删除 编辑

RMANRMAN跨版本恢复()--大版本异机恢复

BLOG文档结构图

 

 

wps2987.tmp 

 

 

 

 

 

ORACLE_SID=jiagulun

原机:  OS:Linux x86 64-bit  IP:192.168.59.156  oracle:10.2.0.1.0 归档模式

异机:  OS:Linux x86 64-bit  IP:192.168.59.10   oracle:11.2.0.3.0  归档模式

目的:利用原机的rman备份集将原库恢复到异机。

 

 

注意: 不能成功upgrade,请看本文的最后的小结部分

 

 

关于10g的跨小版本恢复参考:http://blog.chinaunix.net/uid-26736162-id-4942816.html

关于11g的跨小版本恢复参考:http://blog.itpub.net/26736162/viewspace-1561185/

关于在不同版本和平台之间进行还原或复制的常见问题 http://blog.itpub.net/26736162/viewspace-1549041/

 

 

 

一、 全备份原数据库并拷贝到异机

备份脚本如下:

[oracle@redhat4 ~]$ mkdir -p /home/oracle/oracle_bk/orcl/

 

run{

allocate channel c1 type disk;

allocate channel c2 type disk;

backup database filesperset 4 format  '/home/oracle/oracle_bk/orcl/full_%n_%T_%t_%s_%p.bak';

backup spfile format='/home/oracle/oracle_bk/orcl/spfile_%n_%U_%T.bak';

sql 'alter system archive log current';

backup archivelog all format '/home/oracle/oracle_bk/orcl/arch_%d_%T_%s_%p.bak' delete input;

backup current controlfile format '/home/oracle/oracle_bk/orcl/ctl_%d_%T_%s_%p.bak';

release channel c1;

release channel c2;

}

 

 

 

 

[oracle@redhat4 ~]$  sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 4月 9 16:27:13 2015

 

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

 

 

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

 

 

SQL> create pfile from spfile;

 

File created.

 

 

[oracle@redhat4 ~]$ rman target /

 

恢复管理器: Release 10.2.0.1.0 - Production on 星期四 4月 9 16:22:07 2015

 

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

 

连接到目标数据库: JIAGULUN (DBID=2694191837)

 

RMAN> list backupset;

 

使用目标数据库控制文件替代恢复目录

 

RMAN> run{

2>  allocate channel c1 type disk;

3>  allocate channel c2 type disk;

4>  backup database filesperset 4 format  '/home/oracle/oracle_bk/orcl/full_%n_%T_%t_%s_%p.bak';

5>  backup spfile format='/home/oracle/oracle_bk/orcl/spfile_%n_%U_%T.bak';

6>  sql 'alter system archive log current';

7>  backup archivelog all format '/home/oracle/oracle_bk/orcl/arch_%d_%T_%s_%p.bak' delete input;

8>  backup current controlfile format '/home/oracle/oracle_bk/orcl/ctl_%d_%T_%s_%p.bak';

9> release channel c1;

10> release channel c2;

11> }

 

分配的通道: c1

通道 c1: sid=140 devtype=DISK

 

分配的通道: c2

通道 c2: sid=144 devtype=DISK

 

启动 backup 于 09-4月 -15

通道 c1: 启动全部数据文件备份集

通道 c1: 正在指定备份集中的数据文件

输入数据文件 fno=00001 name=/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_system_7p5b14xs_.dbf

输入数据文件 fno=00004 name=/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_users_7p5b157q_.dbf

通道 c1: 正在启动段 1 于 09-4月 -15

通道 c2: 启动全部数据文件备份集

通道 c2: 正在指定备份集中的数据文件

输入数据文件 fno=00003 name=/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_sysaux_7p5b14yl_.dbf

输入数据文件 fno=00005 name=/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_example_7p5b3r36_.dbf

输入数据文件 fno=00002 name=/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_undotbs1_7p5b155m_.dbf

通道 c2: 正在启动段 1 于 09-4月 -15

通道 c1: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_14_1.bak 标记=TAG20150409T162224 注释=NONE

通道 c1: 备份集已完成, 经过时间:00:01:35

通道 c1: 启动全部数据文件备份集

通道 c1: 正在指定备份集中的数据文件

备份集中包括当前控制文件

通道 c1: 正在启动段 1 于 09-4月 -15

通道 c2: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_15_1.bak 标记=TAG20150409T162224 注释=NONE

通道 c2: 备份集已完成, 经过时间:00:01:36

通道 c2: 启动全部数据文件备份集

通道 c2: 正在指定备份集中的数据文件

通道 c1: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587040_16_1.bak 标记=TAG20150409T162224 注释=NONE

通道 c1: 备份集已完成, 经过时间:00:00:02

在备份集中包含当前的 SPFILE

通道 c2: 正在启动段 1 于 09-4月 -15

通道 c2: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587041_17_1.bak 标记=TAG20150409T162224 注释=NONE

通道 c2: 备份集已完成, 经过时间:00:00:02

完成 backup 于 09-4月 -15

 

启动 backup 于 09-4月 -15

通道 c1: 启动全部数据文件备份集

通道 c1: 正在指定备份集中的数据文件

在备份集中包含当前的 SPFILE

通道 c1: 正在启动段 1 于 09-4月 -15

通道 c1: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak 标记=TAG20150409T162404 注释=NONE

通道 c1: 备份集已完成, 经过时间:00:00:02

完成 backup 于 09-4月 -15

 

sql 语句: alter system archive log current

 

启动 backup 于 09-4月 -15

当前日志已存档

通道 c1: 正在启动存档日志备份集

通道 c1: 正在指定备份集中的存档日志

输入存档日志线程 =1 序列 =12 记录 ID=5 时间戳=876587046

通道 c1: 正在启动段 1 于 09-4月 -15

通道 c2: 正在启动存档日志备份集

通道 c2: 正在指定备份集中的存档日志

输入存档日志线程 =1 序列 =13 记录 ID=6 时间戳=876587046

通道 c2: 正在启动段 1 于 09-4月 -15

通道 c1: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_19_1.bak 标记=TAG20150409T162406 注释=NONE

通道 c1: 备份集已完成, 经过时间:00:00:01

通道 c1: 正在删除存档日志

存档日志文件名 =/u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldfs6o6_.arc 记录 ID=5 时间戳 =876587046

通道 c2: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_20_1.bak 标记=TAG20150409T162406 注释=NONE

通道 c2: 备份集已完成, 经过时间:00:00:02

通道 c2: 正在删除存档日志

存档日志文件名 =/u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_13_bldfs6sp_.arc 记录 ID=6 时间戳 =876587046

完成 backup 于 09-4月 -15

 

启动 backup 于 09-4月 -15

通道 c1: 启动全部数据文件备份集

通道 c1: 正在指定备份集中的数据文件

备份集中包括当前控制文件

通道 c1: 正在启动段 1 于 09-4月 -15

通道 c1: 已完成段 1 于 09-4月 -15

段句柄=/home/oracle/oracle_bk/orcl/ctl_JIAGULUN_20150409_21_1.bak 标记=TAG20150409T162410 注释=NONE

通道 c1: 备份集已完成, 经过时间:00:00:01

完成 backup 于 09-4月 -15

 

释放的通道: c1

 

释放的通道: c2

 

RMAN>

 

 

 

 

 

[root@redhat4 ~]# cd /home/oracle/oracle_bk/orcl/

[root@redhat4 orcl]# ll

总用量 653796

-rw-r-----  1 oracle oinstall    103936  4月  9 16:24 arch_JIAGULUN_20150409_19_1.bak

-rw-r-----  1 oracle oinstall      2560  4月  9 16:24 arch_JIAGULUN_20150409_20_1.bak

-rw-r-----  1 oracle oinstall   7110656  4月  9 16:24 ctl_JIAGULUN_20150409_21_1.bak

-rw-r-----  1 oracle oinstall 392822784  4月  9 16:23 full_JIAGULUN_20150409_876586944_14_1.bak

-rw-r-----  1 oracle oinstall 261447680  4月  9 16:23 full_JIAGULUN_20150409_876586944_15_1.bak

-rw-r-----  1 oracle oinstall   7110656  4月  9 16:24 full_JIAGULUN_20150409_876587040_16_1.bak

-rw-r-----  1 oracle oinstall     98304  4月  9 16:24 full_JIAGULUN_20150409_876587041_17_1.bak

-rw-r-----  1 oracle oinstall     98304  4月  9 16:24 spfile_JIAGULUN_0iq3va14_1_1_20150409.bak

[root@redhat4 orcl]#

 

[root@redhat4 orcl]# su - oracle

[oracle@redhat4 ~]$ cd /home/oracle/oracle_bk/

[oracle@redhat4 oracle_bk]$ scp -r orcl oracle@192.168.59.10:/tmp/

The authenticity of host '192.168.59.10 (192.168.59.10)' can't be established.

RSA key fingerprint is 77:e6:11:1a:7c:c7:81:7c:88:c9:21:18:51:2a:84:d1.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.59.10' (RSA) to the list of known hosts.

oracle@192.168.59.10's password:

ctl_JIAGULUN_20150409_21_1.bak                                                                                                                                                  100% 6944KB   6.8MB/s   00:00   

full_JIAGULUN_20150409_876586944_14_1.bak                                                                                                                                       100%  375MB  19.7MB/s   00:19   

arch_JIAGULUN_20150409_20_1.bak                                                                                                                                                 100% 2560     2.5KB/s   00:00   

full_JIAGULUN_20150409_876587041_17_1.bak                                                                                                                                       100%   96KB  96.0KB/s   00:00   

arch_JIAGULUN_20150409_19_1.bak                                                                                                                                                 100%  102KB 101.5KB/s   00:00   

full_JIAGULUN_20150409_876586944_15_1.bak                                                                                                                                       100%  249MB  16.6MB/s   00:15   

spfile_JIAGULUN_0iq3va14_1_1_20150409.bak                                                                                                                                       100%   96KB  96.0KB/s   00:00   

full_JIAGULUN_20150409_876587040_16_1.bak                                                                                                                                       100% 6944KB   6.8MB/s   00:01   

[oracle@redhat4 oracle_bk]$ scp $ORACLE_HOME/dbs/initjiagulun.ora oracle@192.168.59.10:/tmp/orcl/

oracle@192.168.59.10's password:

initjiagulun.ora                                                                                                                                                                100% 1171     1.1KB/s   00:00   

[oracle@redhat4 oracle_bk]$

 

 

 

 

 

二、 在异机的操作 1、 恢复spfile

 

这里不采用rman恢复了,因为要实验异机不同路径的恢复,所以直接修改pfile文件吧。

 

[oracle@testdb orcl]$ cd /tmp/orcl

[oracle@testdb orcl]$ cp initjiagulun.ora $ORACLE_HOME/dbs/

[oracle@testdb orcl]$ vi $ORACLE_HOME/dbs/initjiagulun.ora

 

 

修改pfile文件之后:

[oracle@testdb orcl]$ more  $ORACLE_HOME/dbs/initjiagulun.ora

*.audit_file_dest='/u01/app/oracle/admin/jiagulun/adump'

*.compatible='10.2.0.1.0'

*.control_files='/u01/app/oracle/oradata/jiagulun/control01.ctl','/u01/app/oracle/oradata/jiagulun/control02.ctl'

*.db_block_size=8192

*.db_create_file_dest='/u01/app/oracle/oradata'

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='jiagulun'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP) (SERVICE=jiagulunXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=170

*.memory_target=500572800

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

[oracle@testdb orcl]$

[oracle@testdb orcl]$

 

 

创建相关路径:

[oracle@testdb orcl]$ mkdir -p /u01/app/oracle/admin/jiagulun/adump

[oracle@testdb orcl]$ mkdir -p /u01/app/oracle/oradata/jiagulun/

[oracle@testdb orcl]$

 

---创建原库的相关路径

[oracle@testdb dbs]$ mkdir -p /u01/app/oracle/oradata/JIAGULUN/datafile/

[oracle@testdb dbs]$ mkdir -p /u01/app/oracle/oradata/JIAGULUN/onlinelog/

[oracle@testdb dbs]$ mkdir -p /u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/

[oracle@testdb dbs]$

 

 

 

 

 

[oracle@testdb dbs]$ ORACLE_SID=jiagulun

[oracle@testdb dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 9 16:54:26 2015

 

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

 

Connected to an idle instance.

 

SQL>  create spfile from pfile;

 

File created.

 

SQL>

 

 

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area  501059584 bytes

Fixed Size                  2229744 bytes

Variable Size             310381072 bytes

Database Buffers          180355072 bytes

Redo Buffers                8093696 bytes

SQL>

 

 

 

 

 

2、  恢复控制文件

 

 

[oracle@testdb dbs]$ rman target /

 

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Apr 9 16:55:37 2015

 

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

 

connected to target database: JIAGULUN (not mounted)

 

RMAN> restore controlfile to '/u01/app/oracle/oradata/jiagulun/control01.ctl' from '/tmp/orcl/ctl_JIAGULUN_20150409_21_1.bak';

 

Starting restore at 09-APR-15

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=134 device type=DISK

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 09-APR-15

 

RMAN>

 

Recovery Manager complete.

[oracle@testdb orcl]$ cp  /u01/app/oracle/oradata/jiagulun/control01.ctl /u01/app/oracle/oradata/jiagulun/control02.ctl

[oracle@testdb dbs]$ rman target /

 

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Apr 9 16:57:53 2015

 

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

 

connected to target database: JIAGULUN (not mounted)

 

RMAN> alter database mount;

 

using target database control file instead of recovery catalog

 

 

 

database mounted

 

RMAN>

RMAN>

 

 

3、 恢复归档文件

 

RMAN> catalog start with '/tmp/orcl/';

 

Starting implicit crosscheck backup at 09-APR-15

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK

Crosschecked 7 objects

Finished implicit crosscheck backup at 09-APR-15

 

Starting implicit crosscheck copy at 09-APR-15

using channel ORA_DISK_1

Finished implicit crosscheck copy at 09-APR-15

 

searching for all files in the recovery area

cataloging files...

no files cataloged

 

searching for all files that match the pattern /tmp/orcl/

 

List of Files Unknown to the Database

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

File Name: /tmp/orcl/arch_JIAGULUN_20150409_20_1.bak

File Name: /tmp/orcl/initjiagulun.ora

File Name: /tmp/orcl/full_JIAGULUN_20150409_876587040_16_1.bak

File Name: /tmp/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876587041_17_1.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876586944_15_1.bak

File Name: /tmp/orcl/arch_JIAGULUN_20150409_19_1.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876586944_14_1.bak

File Name: /tmp/orcl/ctl_JIAGULUN_20150409_21_1.bak

 

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

 

List of Cataloged Files

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

File Name: /tmp/orcl/arch_JIAGULUN_20150409_20_1.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876587040_16_1.bak

File Name: /tmp/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876587041_17_1.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876586944_15_1.bak

File Name: /tmp/orcl/arch_JIAGULUN_20150409_19_1.bak

File Name: /tmp/orcl/full_JIAGULUN_20150409_876586944_14_1.bak

File Name: /tmp/orcl/ctl_JIAGULUN_20150409_21_1.bak

 

List of Files Which Where Not Cataloged

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

File Name: /tmp/orcl/initjiagulun.ora

  RMAN-07517: Reason: The file header is corrupted

 

RMAN>

 

RMAN>  crosscheck archivelog all;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK

specification does not match any archived log in the repository

 

RMAN>

using channel ORA_DISK_1

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_15_1.bak RECID=14 STAMP=876586944

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/full_JIAGULUN_20150409_876586944_15_1.bak RECID=25 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_14_1.bak RECID=15 STAMP=876586944

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/full_JIAGULUN_20150409_876586944_14_1.bak RECID=27 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587040_16_1.bak RECID=16 STAMP=876587040

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/full_JIAGULUN_20150409_876587040_16_1.bak RECID=22 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587041_17_1.bak RECID=17 STAMP=876587042

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/full_JIAGULUN_20150409_876587041_17_1.bak RECID=24 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak RECID=18 STAMP=876587045

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak RECID=23 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_19_1.bak RECID=19 STAMP=876587048

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/arch_JIAGULUN_20150409_19_1.bak RECID=26 STAMP=876589228

crosschecked backup piece: found to be 'EXPIRED'

backup piece handle=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_20_1.bak RECID=20 STAMP=876587048

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/arch_JIAGULUN_20150409_20_1.bak RECID=21 STAMP=876589228

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/tmp/orcl/ctl_JIAGULUN_20150409_21_1.bak RECID=28 STAMP=876589228

Crosschecked 15 objects

 

 

RMAN> delete noprompt obsolete;

 

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 1

using channel ORA_DISK_1

Deleting the following obsolete backups and copies:

Type                 Key    Completion Time    Filename/Handle

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

Backup Set           16     09-APR-15        

  Backup Piece       16     09-APR-15          /home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587040_16_1.bak

Backup Set           17     09-APR-15        

  Backup Piece       17     09-APR-15          /home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587041_17_1.bak

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587040_16_1.bak RECID=16 STAMP=876587040

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876587041_17_1.bak RECID=17 STAMP=876587042

Deleted 2 objects

 

 

RMAN>

 

RMAN> crosscheck archivelog all;

 

released channel: ORA_DISK_1

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=125 device type=DISK

specification does not match any archived log in the repository

 

RMAN> 

 

RMAN> delete EXPIRED backupset;

 

using channel ORA_DISK_1

 

List of Backup Pieces

BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name

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

14      14      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_15_1.bak

15      15      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_14_1.bak

18      18      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak

19      19      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_19_1.bak

20      20      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_20_1.bak

 

Do you really want to delete the above objects (enter YES or NO)? yes

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_15_1.bak RECID=14 STAMP=876586944

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/full_JIAGULUN_20150409_876586944_14_1.bak RECID=15 STAMP=876586944

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/spfile_JIAGULUN_0iq3va14_1_1_20150409.bak RECID=18 STAMP=876587045

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_19_1.bak RECID=19 STAMP=876587048

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/arch_JIAGULUN_20150409_20_1.bak RECID=20 STAMP=876587048

Deleted 5 EXPIRED objects

 

 

RMAN>

 

RMAN> list backup of archivelog all;

 

 

List of Backup Sets

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

 

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

19      101.00K    DISK        00:00:01     09-APR-15     

        BP Key: 26   Status: AVAILABLE  Compressed: NO  Tag: TAG20150409T162406

        Piece Name: /tmp/orcl/arch_JIAGULUN_20150409_19_1.bak

 

  List of Archived Logs in backup set 19

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

  1   12      694289     09-APR-15 694583     09-APR-15

 

BS Key  Size       Device Type Elapsed Time Completion Time

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

20      2.00K      DISK        00:00:01     09-APR-15     

        BP Key: 21   Status: AVAILABLE  Compressed: NO  Tag: TAG20150409T162406

        Piece Name: /tmp/orcl/arch_JIAGULUN_20150409_20_1.bak

 

  List of Archived Logs in backup set 20

  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

  1    13      694583     09-APR-15 694588     09-APR-15

 

RMAN>

RMAN> restore archivelog sequence between 12 and 13;

 

Starting restore at 09-APR-15

using channel ORA_DISK_1

 

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=12

channel ORA_DISK_1: reading from backup piece /tmp/orcl/arch_JIAGULUN_20150409_19_1.bak

channel ORA_DISK_1: piece handle=/tmp/orcl/arch_JIAGULUN_20150409_19_1.bak tag=TAG20150409T162406

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=13

channel ORA_DISK_1: reading from backup piece /tmp/orcl/arch_JIAGULUN_20150409_20_1.bak

channel ORA_DISK_1: piece handle=/tmp/orcl/arch_JIAGULUN_20150409_20_1.bak tag=TAG20150409T162406

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished restore at 09-APR-15

 

RMAN>

 

 

 

4、 恢复数据文件

 

由于恢复路径不同,所以需要set newname

 

set pagesize  200 linesize 200

select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'

  from v$datafile a

union all

select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'

  from v$tempfile a

union all

SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || '''''  to  ''''' ||

       a.MEMBER || ''''' ";'

  FROM v$logfile a;

 

SQL> set pagesize  200 linesize 200

SQL> select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'

  2    from v$datafile a

  3  union all

  4  select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'

  5    from v$tempfile a

  6  union all

  7  SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || '''''  to  ''''' ||

  8         a.MEMBER || ''''' ";'

  9    FROM v$logfile a;

 

'SETNEWNAMEFORDATAFILE'||A.FILE#||'TO"'||A.NAME||'";'

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

set newname for datafile 1 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_system_7p5b14xs_.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_undotbs1_7p5b155m_.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_sysaux_7p5b14yl_.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_users_7p5b157q_.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_example_7p5b3r36_.dbf";

set newname for tempfile 1 to "/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_temp_7p5b3loz_.tmp";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log''  to  ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log''  to  ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log'' "

;

 

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log''  to  ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log''  to  ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log'' "

;

 

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log''  to  ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log''  to  ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log'' "

;

 

 

已选择12行。

SQL>

 

 

修改脚本:

RUN

{

  ALLOCATE CHANNEL c1 DEVICE TYPE DISK;

set newname for datafile 1 to "/u01/app/oracle/oradata/jiagulun/system01.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/jiagulun/undotbs01.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/jiagulun/sysaux01.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/jiagulun/users01.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/jiagulun/example01.dbf";

set newname for tempfile 1 to "/u01/app/oracle/oradata/jiagulun/temp01.dbf";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03_1.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02_1.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01_1.log'' ";

 

  SET UNTIL sequence 13 thread 1;

  RESTORE DATABASE;

  SWITCH DATAFILE ALL;

  RECOVER DATABASE;

}

 

 

 

启动数据库到mount状态:

 

 

 

RMAN> shutdown abort;

 

Oracle instance shut down

 

RMAN> startup mount;

 

connected to target database (not started)

Oracle instance started

database mounted

 

Total System Global Area     501059584 bytes

 

Fixed Size                     2229744 bytes

Variable Size                310381072 bytes

Database Buffers             180355072 bytes

Redo Buffers                   8093696 bytes

 

RMAN>

 

RMAN> RUN

2> {

3>   ALLOCATE CHANNEL c1 DEVICE TYPE DISK;

4> set newname for datafile 1 to "/u01/app/oracle/oradata/jiagulun/system01.dbf";

5> set newname for datafile 2 to "/u01/app/oracle/oradata/jiagulun/undotbs01.dbf";

6> set newname for datafile 3 to "/u01/app/oracle/oradata/jiagulun/sysaux01.dbf";

7> set newname for datafile 4 to "/u01/app/oracle/oradata/jiagulun/users01.dbf";

8> set newname for datafile 5 to "/u01/app/oracle/oradata/jiagulun/example01.dbf";

9> set newname for tempfile 1 to "/u01/app/oracle/oradata/jiagulun/temp01.dbf";

10> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03.log'' ";

11> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03_1.log'' ";

12> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02.log'' ";

13> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02_1.log'' ";

14> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01.log'' ";

15> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01_1.log'' ";

16>

17>   SET UNTIL sequence 13 thread 1;

18>   RESTORE DATABASE;

19>   SWITCH DATAFILE ALL;

20>   RECOVER DATABASE;

21> }

 

released channel: ORA_DISK_1

allocated channel: c1

channel c1: SID=133 device type=DISK

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03.log''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo03_1.log''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02.log''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo02_1.log''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01.log''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log''  to  ''/u01/app/oracle/oradata/jiagulun/redo01_1.log''

 

executing command: SET until clause

 

Starting restore at 09-APR-15

 

channel c1: starting datafile backup set restore

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

channel c1: restoring datafile 00002 to /u01/app/oracle/oradata/jiagulun/undotbs01.dbf

channel c1: restoring datafile 00003 to /u01/app/oracle/oradata/jiagulun/sysaux01.dbf

channel c1: restoring datafile 00005 to /u01/app/oracle/oradata/jiagulun/example01.dbf

channel c1: reading from backup piece /tmp/orcl/full_JIAGULUN_20150409_876586944_15_1.bak

channel c1: piece handle=/tmp/orcl/full_JIAGULUN_20150409_876586944_15_1.bak tag=TAG20150409T162224

channel c1: restored backup piece 1

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

channel c1: starting datafile backup set restore

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

channel c1: restoring datafile 00001 to /u01/app/oracle/oradata/jiagulun/system01.dbf

channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/jiagulun/users01.dbf

channel c1: reading from backup piece /tmp/orcl/full_JIAGULUN_20150409_876586944_14_1.bak

channel c1: piece handle=/tmp/orcl/full_JIAGULUN_20150409_876586944_14_1.bak tag=TAG20150409T162224

channel c1: restored backup piece 1

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

Finished restore at 09-APR-15

 

datafile 1 switched to datafile copy

input datafile copy RECID=7 STAMP=876591796 file name=/u01/app/oracle/oradata/jiagulun/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=8 STAMP=876591796 file name=/u01/app/oracle/oradata/jiagulun/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=9 STAMP=876591796 file name=/u01/app/oracle/oradata/jiagulun/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=10 STAMP=876591796 file name=/u01/app/oracle/oradata/jiagulun/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=11 STAMP=876591796 file name=/u01/app/oracle/oradata/jiagulun/example01.dbf

 

Starting recover at 09-APR-15

 

starting media recovery

 

archived log for thread 1 with sequence 12 is already on disk as file /u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldjk2wt_.arc

archived log file name=/u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldjk2wt_.arc thread=1 sequence=12

media recovery complete, elapsed time: 00:00:01

Finished recover at 09-APR-15

released channel: c1

 

RMAN>

 

 

 

 

 

 

 

告警日志:

Thu Apr 09 17:42:45 2015

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo03.log'

Deleted Oracle managed file /u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_3_7p5b35yp_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo03.log'

ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo03_1.log'

Deleted Oracle managed file /u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_3_7p5b36x4_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo03_1.log'

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo02.log'

Deleted Oracle managed file /u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_2_7p5b33sx_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo02.log'

ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo02_1.log'

Deleted Oracle managed file /u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_2_7p5b34v6_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo02_1.log'

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo01.log'

Deleted Oracle managed file /u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/JIAGULUN/onlinelog/o1_mf_1_7p5b30lb_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo01.log'

ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo01_1.log'

Deleted Oracle managed file /u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/flash_recovery_area/JIAGULUN/onlinelog/o1_mf_1_7p5b31mg_.log'  to  '/u01/app/oracle/oradata/jiagulun/redo01_1.log'

Thu Apr 09 17:42:47 2015

Full restore complete of datafile 2 to datafile copy /u01/app/oracle/oradata/jiagulun/undotbs01.dbf.  Elapsed time: 0:00:00

  checkpoint is 694528

Full restore complete of datafile 5 to datafile copy /u01/app/oracle/oradata/jiagulun/example01.dbf.  Elapsed time: 0:00:02

  checkpoint is 694528

Full restore complete of datafile 3 to datafile copy /u01/app/oracle/oradata/jiagulun/sysaux01.dbf.  Elapsed time: 0:00:05

  checkpoint is 694528

Thu Apr 09 17:43:01 2015

Full restore complete of datafile 4 to datafile copy /u01/app/oracle/oradata/jiagulun/users01.dbf.  Elapsed time: 0:00:00

  checkpoint is 694529

Thu Apr 09 17:43:04 2015

Time drift detected. Please check VKTM trace file for more details.

Thu Apr 09 17:43:15 2015

Full restore complete of datafile 1 to datafile copy /u01/app/oracle/oradata/jiagulun/system01.dbf.  Elapsed time: 0:00:13

  checkpoint is 694529

Thu Apr 09 17:43:17 2015

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_ora_13658.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_system_7p5b14xs_.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Switch of datafile 1 complete to datafile copy

  checkpoint is 694529

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_ora_13658.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_undotbs1_7p5b155m_.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Switch of datafile 2 complete to datafile copy

  checkpoint is 694528

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_ora_13658.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_sysaux_7p5b14yl_.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Switch of datafile 3 complete to datafile copy

  checkpoint is 694528

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_ora_13658.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_users_7p5b157q_.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Switch of datafile 4 complete to datafile copy

  checkpoint is 694529

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_ora_13658.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_example_7p5b3r36_.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Switch of datafile 5 complete to datafile copy

  checkpoint is 694528

alter database recover datafile list clear

Completed: alter database recover datafile list clear

alter database recover datafile list

1 , 2 , 3 , 4 , 5

Completed: alter database recover datafile list

1 , 2 , 3 , 4 , 5

alter database recover if needed

start until cancel using backup controlfile

Media Recovery Start

started logmerger process

Parallel Media Recovery started with 2 slaves

ORA-279 signalled during: alter database recover if needed

start until cancel using backup controlfile

...

alter database recover logfile '/u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldjk2wt_.arc'

Media Recovery Log /u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldjk2wt_.arc

ORA-279 signalled during: alter database recover logfile '/u01/app/oracle/flash_recovery_area/JIAGULUN/archivelog/2015_04_09/o1_mf_1_12_bldjk2wt_.arc'...

alter database recover cancel

Media Recovery Canceled

Completed: alter database recover cancel

 

 

 

5、 startup upgrade打开数据库

注意:startup upgrade打开数据库之前应该首先采用alter database open resetlogs;打开数据库一次,然后执行startup upgrade重新打开数据库,或者直接运行alter database open resetlogs upgrade;

 

[oracle@testdb dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 9 17:44:46 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> select open_mode from v$database;

 

OPEN_MODE

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

MOUNTED

 

SQL>  alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01092: ORACLE instance terminated. Disconnection forced

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

Process ID: 11035

Session ID: 59 Serial number: 29

 

 

SQL>

SQL> shutdown abort;

ORA-24324: service handle not initialized

ORA-01041: internal error. hostdef extension doesn't exist

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

 

 

 

--因为相同平台的数据库软件版本不一样,所以需要upgrade选项打开。

 

--shutdown数据库用upgrade选项打开数据库:

 

[oracle@testdb orcl]$ sqlplus / as sysdba

 

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 9 17:47:31 2015

 

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

 

Connected to an idle instance.

 

 

SQL> startup upgrade;

ORACLE instance started.

 

Total System Global Area  313159680 bytes

Fixed Size                  2227944 bytes

Variable Size             230687000 bytes

Database Buffers           75497472 bytes

Redo Buffers                4747264 bytes

Database mounted.

Database opened.

SQL> 

 

 

告警日志:

ALTER DATABASE   MOUNT

Successful mount of redo thread 1, with mount id 2792694741

Database mounted in Exclusive Mode

Lost write protection disabled

Completed: ALTER DATABASE   MOUNT

Thu Apr 09 17:48:09 2015

ALTER DATABASE OPEN MIGRATE

Beginning crash recovery of 1 threads

parallel recovery started with 2 processes

Started redo scan

Completed redo scan

read 0 KB redo, 0 data blocks need recovery

Started redo application at

Thread 1: logseq 1, block 2, scn 694587

Recovery of Online Redo Log: Thread 1 Group 1 Seq 1 Reading mem 0

  Mem# 0: /u01/app/oracle/oradata/jiagulun/redo01.log

  Mem# 1: /u01/app/oracle/oradata/jiagulun/redo01_1.log

Completed redo application of 0.00MB

Completed crash recovery at

Thread 1: logseq 1, block 3, scn 714589

0 data blocks read, 0 data blocks written, 0 redo k-bytes read

LGWR: STARTING ARCH PROCESSES

Thu Apr 09 17:48:09 2015

ARC0 started with pid=20, OS id=14074

ARC0: Archival started

LGWR: STARTING ARCH PROCESSES COMPLETE

ARC0: STARTING ARCH PROCESSES

Thu Apr 09 17:48:10 2015

ARC1 started with pid=23, OS id=14076

Thread 1 advanced to log sequence 2 (thread open)

Thu Apr 09 17:48:10 2015

ARC2 started with pid=24, OS id=14078

Thread 1 opened at log sequence 2

  Current log# 2 seq# 2 mem# 0: /u01/app/oracle/oradata/jiagulun/redo02.log

  Current log# 2 seq# 2 mem# 1: /u01/app/oracle/oradata/jiagulun/redo02_1.log

Successful open of redo thread 1

MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set

SMON: enabling cache recovery

Thu Apr 09 17:48:10 2015

ARC1: Archival started

ARC3 started with pid=25, OS id=14080

ARC2: Archival started

ARC2: Becoming the 'no FAL' ARCH

ARC2: Becoming the 'no SRL' ARCH

ARC1: Becoming the heartbeat ARCH

Archived Log entry 9 added for thread 1 sequence 1 ID 0xa67589a0 dest 1:

[14064] Successfully onlined Undo Tablespace 1.

Undo initialization finished serial:0 start:62795144 end:62795464 diff:320 (3 seconds)

Dictionary check beginning

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_dbw0_14007.trc:

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

ORA-01110: data file 201: '/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_temp_7p5b3loz_.tmp'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Errors in file /u01/app/oracle/diag/rdbms/jiagulun/jiagulun/trace/jiagulun_dbw0_14007.trc:

ORA-01186: file 201 failed verification tests

ORA-01157: cannot identify/lock data file 201 - see DBWR trace file

ORA-01110: data file 201: '/u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_temp_7p5b3loz_.tmp'

File 201 not verified due to error ORA-01157

Dictionary check complete

SMON: enabling tx recovery

Re-creating tempfile /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_temp_7p5b3loz_.tmp as /u01/app/oracle/oradata/JIAGULUN/datafile/o1_mf_temp_bldlptwz_.tmp

Database Characterset is ZHS16GBK

Updating 10.2.0.1.0 NLS parameters in sys.props$

-- adding 11.2.0.3.0 NLS parameters.

ARC3: Archival started

ARC0: STARTING ARCH PROCESSES COMPLETE

Stopping background process MMNL

Stopping background process MMON

Starting background process MMON

Thu Apr 09 17:48:15 2015

MMON started with pid=15, OS id=14082

Starting background process MMNL

Thu Apr 09 17:48:15 2015

MMNL started with pid=16, OS id=14084

ALTER SYSTEM enable restricted session;

ALTER SYSTEM SET _system_trig_enabled=FALSE SCOPE=MEMORY;

Autotune of undo retention is turned off.

ALTER SYSTEM SET _undo_autotune=FALSE SCOPE=MEMORY;

ALTER SYSTEM SET undo_retention=900 SCOPE=MEMORY;

ALTER SYSTEM SET aq_tm_processes=0 SCOPE=MEMORY;

ALTER SYSTEM SET enable_ddl_logging=FALSE SCOPE=MEMORY;

Resource Manager disabled during database migration: plan '' not set

ALTER SYSTEM SET resource_manager_plan='' SCOPE=MEMORY;

ALTER SYSTEM SET recyclebin='OFF' DEFERRED SCOPE=MEMORY;

Resource Manager disabled during database migration

replication_dependency_tracking turned off (no async multimaster replication found)

XDB UNINITIALIZED: XDB$SCHEMA not accessible

LOGSTDBY: Validating controlfile with logical metadata

LOGSTDBY: Validation complete

Completed: ALTER DATABASE OPEN MIGRATE

Thu Apr 09 17:48:17 2015

Starting background process CJQ0

Thu Apr 09 17:48:17 2015

CJQ0 started with pid=26, OS id=14087

 

 

 

6、 执行升级脚本catupgrd.sql  并编译失效对象

 

SQL> SELECT d.owner, count(1)

  2    FROM dba_objects d

  3   where status = 'INVALID'

  4   GROUP BY d.owner;

 

OWNER                            COUNT(1)

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

PUBLIC                                396

CTXSYS                                  1

SYS                                    93

 

SQL>

 

SQL> select  INSTANCE_NAME,version,status from  v$instance;

 

INSTANCE_NAME    VERSION           STATUS

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

jiagulun         11.2.0.3.0       OPEN MIGRATE

 

 

 

$ORACLE_HOME\RDBMS\ADMIN\catupgrd.sql 

--执行这个脚本。这个脚本调用catlog.sqlcatproc.sql来重建字典对象等,在执行完这个脚本之后,我们可以关闭数据库后,正常打开数据库:

 

 

spool /tmp/upgrade.log

set echo on

@$ORACLE_HOME/rdbms/admin/catupgrd.sql;

spool off

Shutdown immediate

 

执行之前可以把以下参数设置大点,否则可能导致升级脚本不能正常执行,如果脚本执行失败可以关闭数据库重新startup upgrade后再重新执行该脚本:

wps29A7.tmp 

Thu Apr 09 14:40:46 2015

Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_11151.trc  (incident=2870):

ORA-04031: unable to allocate 4096 bytes of shared memory ("java pool","unknown object","JOXLE^5e8bb91c",":SGAClass")

Use ADRCI or Support Workbench to package the incident.

See Note 411.1 at My Oracle Support for error and packaging details.

Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_11151.trc  (incident=2871):

ORA-04031: unable to allocate 4096 bytes of shared memory ("java pool","unknown object","JOXLE^5e8bb91c",":SGAClass")

Use ADRCI or Support Workbench to package the incident.

See Note 411.1 at My Oracle Support for error and packaging details.

 

但是这里执行的时候就报错了,不能完整的执行升级脚本,后来网上查了下是因为10.2.0.1不能直接升级到11g的版本,10g的版本必须大于10.2.0.2.晕死人,╮(╯▽╰)╭,,,,不过回想一下这样的数据库可以作为找回一些由于误操作导致丢失了的数据,其实也是一种办法。

SELECT TO_NUMBER('MUST_HAVE_RUN_PRE-UPGRADE_TOOL_FOR_TIMEZONE') 
   *  ERROR at line 1: 
   ORA-01722: invalid number

 

算了,再找个高版本实验吧,请看下一篇文章。。。。。

 

 

7、 小结

10g Restore 11g 2个关键内容:

1.     必须在10g库上先执行@?/rdbms/admin/utlu112i.sql脚本,然后在备份,否则Restore之后的升级将失败。

2.     10g的版本必须大于10.2.0.2.

 

参考文档:http://blog.csdn.net/tianlesoftware/article/details/7311352#t13

 

 

 

 

 

 

 

 

...........................................................................................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

ITPUB BLOG:http://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1561352/

QQ:642808185 注明:ITPUB的文章标题

<版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任!>

...........................................................................................................................................................................................

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-1561352/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
QQ:646634621| 网名:小麦苗| 微信公众号:xiaomaimiaolhr| 11g OCM| QQ群:618766405 微信群:私聊| 《数据库笔试面试宝典》作者| OCP、OCM、高可用(RAC+DG+OGG)网络班开讲啦,有需要的小伙伴可以私聊我。

注册时间:2012-09-23

  • 博文量
    1367
  • 访问量
    8351727