【RMAN】RMAN跨版本恢复(下)--大版本异机恢复

【RMAN】RMAN跨版本恢复(下)--大版本异机恢复

BLOG文档结构图

ORACLE_SID=ORA1024G

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

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

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

前言:

在上一篇blog中(【RMAN】RMAN跨版本恢复(中):http://blog.itpub.net/26736162/viewspace-1561352/)中由10.2.0.1.0的备份集恢复到11.2.0.3.0 的时候失败了,今天又用10.2.0.4.0 的版本来实验了下,虽然坎坷,但是还是成功了。

简单的来说就是2个步骤:

1.     将10g 数据库 还原11g上

2.     升级还原的10g数据库到11g。

一、 迁移前需要注意的地方

随着Oracle 版本的升级,RMAN 也得到增强,在Oracle11g中的RMAN 支持不同操作系统和不同DB 之前的使用,但是Oracle 10.2.0.1 不能直接升级到11gR2,至少需要先升级到10.2.0.2 以后才可以升级到11gR2,也就是需要遵循oracle的升级路线图,由下图可以看出升级到11gR2必须是10.2.0.2以上,或者是10.1.0.5版本。

二、 rman全备份source数据库并拷贝到异机

①、 在Source 库上执行utlu112i.sql脚本

在Source 备份之前,需要执行一下utlu112i.sql 脚本,如果不执行,那么在升级时执行  @?/rdbms/admin/catupgrd.sqDOC>  The following error is generated if the pre-upgrade tool has not been

DOC>  run in the old ORACLE_HOME home prior to upgrading a pre-11.2 database:

DOC>

DOC>  SELECT TO_NUMBER('MUST_HAVE_RUN_PRE-UPGRADE_TOOL_FOR_TIMEZONE')

DOC>                       *

DOC>     ERROR at line 1:

DOC>     ORA-01722: invalid number

DOC>

DOC>    o Action:

DOC>       Shutdown database ("alter systemcheckpoint" and then "shutdown abort").

DOC>       Revert to the original oracle home andstart the database.

DOC>       Run pre-upgrade tool against thedatabase.

DOC>       Review and take appropriate actionsbased on the pre-upgrade

DOC>       output before opening the datatabase inthe new software version.

DOC>

将11g $ORACLE_HOME/rdbms/admin 下的target库操作:

[oracle@testdb dbs]$ The authenticity of host '192.168.59.130 (192.168.59.130)' can't be established.

RSA key fingerprint is e5:3a:87:f2:a8:5a:a7:80:da:b3:63:b9:72:92:5a:a9.

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

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

oracle@192.168.59.130's password:

utlu112i.sql                                                                                                                                                                    100%  209KB 208.9KB/s   00:00

[oracle@testdb dbs]$

source库操作:

[oracle@rhel6_lhr dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 10 10:45:47 2015

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> Oracle Database 11.2 Pre-Upgrade Information Tool 04-10-2015 10:48:23

Script Version: 11.2.0.3.0 Build: 001

.

**********************************************************************

Database:

**********************************************************************

--> name:          ORA1024G

--> version:       10.2.0.4.0

--> compatible:    10.2.0.3.0

--> blocksize:     8192

--> platform:      Linux x86 64-bit

--> timezone file: V4

.

**********************************************************************

Tablespaces: [make adjustments in the current environment]

**********************************************************************

--> SYSTEM tablespace is adequate for the upgrade.

.... minimum required size: 725 MB

--> UNDOTBS1 tablespace is adequate for the upgrade.

.... minimum required size: 400 MB

--> SYSAUX tablespace is adequate for the upgrade.

.... minimum required size: 463 MB

--> TEMP tablespace is adequate for the upgrade.

.... minimum required size: 60 MB

--> EXAMPLE tablespace is adequate for the upgrade.

.... minimum required size: 69 MB

.

**********************************************************************

Flashback: OFF

**********************************************************************

**********************************************************************

Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]

Note: Pre-upgrade tool was run on a lower version 64-bit database.

**********************************************************************

--> If Target Oracle is 32-Bit, refer here for Update Parameters:

-- No update parameter changes are required.

.

--> If Target Oracle is 64-Bit, refer here for Update Parameters:

WARNING: --> "sga_target" needs to be increased to at least 596 MB

.

**********************************************************************

Renamed Parameters: [Update Oracle Database 11.2 init.ora or spfile]

**********************************************************************

-- No renamed parameters found. No changes are required.

.

**********************************************************************

Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]

**********************************************************************

--> user_dump_dest               11.1       DEPRECATED   replaced by  "diagnostic_dest"

.

**********************************************************************

Components: [The following database components will be upgraded or installed]

**********************************************************************

--> Oracle Catalog Views         [upgrade]  VALID

--> Oracle Packages and Types    [upgrade]  VALID

--> JServer JAVA Virtual Machine [upgrade]  VALID

--> Oracle XDK for Java          [upgrade]  VALID

--> Oracle Workspace Manager     [upgrade]  VALID

--> OLAP Analytic Workspace      [upgrade]  VALID

--> OLAP Catalog                 [upgrade]  VALID

--> EM Repository                [upgrade]  VALID

--> Oracle Text                  [upgrade]  VALID

--> Oracle XML Database          [upgrade]  VALID

--> Oracle Java Packages         [upgrade]  VALID

--> Oracle interMedia            [upgrade]  VALID

--> Spatial                      [upgrade]  VALID

--> Data Mining                  [upgrade]  VALID

--> Expression Filter            [upgrade]  VALID

--> Rule Manager                 [upgrade]  VALID

--> Oracle OLAP API              [upgrade]  VALID

.

**********************************************************************

Miscellaneous Warnings

**********************************************************************

WARNING: --> Database is using a timezone file older than version 14.

.... After the release migration, it is recommended that DBMS_DST package

.... be used to upgrade the 10.2.0.4.0 database timezone version

.... to the latest version which comes with the new release.

WARNING: --> EM Database Control Repository exists in the database.

.... Direct downgrade of EM Database Control is not supported. Refer to the

.... Upgrade Guide for instructions to save the EM data prior to upgrade.

WARNING: --> Your recycle bin is turned on and currently contains no objects.

.... Because it is REQUIRED that the recycle bin be empty prior to upgrading

.... and your recycle bin is turned on, you may need to execute the command:

PURGE DBA_RECYCLEBIN

.... prior to executing your upgrade to confirm the recycle bin is empty.

.

**********************************************************************

Recommendations

**********************************************************************

Oracle recommends gathering dictionary statistics prior to

upgrading the database.

To gather dictionary statistics execute the following command

while connected as SYSDBA:

EXECUTE dbms_stats.gather_dictionary_stats;

**********************************************************************

Oracle recommends reviewing any defined events prior to upgrading.

To view existing non-default events execute the following commands

while connected AS SYSDBA:

Events:

SELECT (translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2

WHERE  UPPER(name) ='EVENT' AND  isdefault='FALSE'

Trace Events:

SELECT (translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2

WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'

Changes will need to be made in the init.ora or spfile.

**********************************************************************

SQL>

②、 source库执行备份

备份脚本如下:

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

[oracle@rhel6_lhr dbs]$ sqlplus / as sysdba

SQL*Plus: Release

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:

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

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

File created.

SQL>

[oracle@rhel6_lhr dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Apr 10 10:55:56 2015

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

connected to target database:

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=147 devtype=DISK

allocated channel: c2

channel c2: sid=145 devtype=DISK

Starting backup at 2015-04-10 10:56:04

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

input datafile fno=00001 name=/u03/app/oracle/oradata/ora1024g/system01.dbf

input datafile fno=00004 name=/u03/app/oracle/oradata/ora1024g/users01.dbf

input datafile fno=00006 name=/u03/app/oracle/oradata/ora1024g/undotbs02.dbf

channel c1: starting piece 1 at 2015-04-10 10:56:04

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

input datafile fno=00003 name=/u03/app/oracle/oradata/ora1024g/sysaux01.dbf

input datafile fno=00005 name=/u03/app/oracle/oradata/ora1024g/example01.dbf

input datafile fno=00002 name=/u03/app/oracle/oradata/ora1024g/undotbs01.dbf

channel c2: starting piece 1 at 2015-04-10 10:56:04

channel c1: finished piece 1 at 2015-04-10 10:57:30

piece handle=/home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653764_4_1.bak tag=TAG20150410T105604 comment=NONE

channel c1: backup set complete, elapsed time: 00:01:26

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

including current control file in backupset

channel c1: starting piece 1 at 2015-04-10 10:57:31

channel c2: finished piece 1 at 2015-04-10 10:57:31

piece handle=/home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653764_5_1.bak tag=TAG20150410T105604 comment=NONE

channel c2: backup set complete, elapsed time: 00:01:27

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

including current SPFILE in backupset

channel c2: starting piece 1 at 2015-04-10 10:57:31

channel c1: finished piece 1 at 2015-04-10 10:57:32

piece handle=/home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653850_6_1.bak tag=TAG20150410T105604 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:02

channel c2: finished piece 1 at 2015-04-10 10:57:32

piece handle=/home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653851_7_1.bak tag=TAG20150410T105604 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-04-10 10:57:32

Starting backup at 2015-04-10 10:57:33

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

including current SPFILE in backupset

channel c1: starting piece 1 at 2015-04-10 10:57:33

channel c1: finished piece 1 at 2015-04-10 10:57:34

piece handle=/home/oracle/oracle_bk/orcl/spfile_ORA1024G_08q41b8t_1_1_20150410.bak tag=TAG20150410T105733 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-04-10 10:57:34

sql statement: alter system archive log current

Starting backup at 2015-04-10 10:57:35

current log archived

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=28 recid=30 stamp=874180665

input archive log thread=1 sequence=29 recid=31 stamp=874181151

input archive log thread=1 sequence=30 recid=32 stamp=874181383

input archive log thread=1 sequence=31 recid=33 stamp=874182798

input archive log thread=1 sequence=32 recid=34 stamp=874182798

input archive log thread=1 sequence=33 recid=35 stamp=874182839

input archive log thread=1 sequence=34 recid=36 stamp=874182920

input archive log thread=1 sequence=35 recid=37 stamp=874182980

input archive log thread=1 sequence=36 recid=38 stamp=874183040

input archive log thread=1 sequence=37 recid=39 stamp=874183248

input archive log thread=1 sequence=38 recid=40 stamp=874183429

input archive log thread=1 sequence=39 recid=41 stamp=874183550

input archive log thread=1 sequence=40 recid=42 stamp=874183707

input archive log thread=1 sequence=41 recid=43 stamp=874183933

input archive log thread=1 sequence=42 recid=44 stamp=874229749

input archive log thread=1 sequence=43 recid=45 stamp=874231410

input archive log thread=1 sequence=44 recid=46 stamp=874232006

input archive log thread=1 sequence=45 recid=47 stamp=874232523

input archive log thread=1 sequence=46 recid=48 stamp=874232539

input archive log thread=1 sequence=47 recid=49 stamp=874232587

input archive log thread=1 sequence=48 recid=50 stamp=874257695

input archive log thread=1 sequence=49 recid=51 stamp=876653024

channel c1: starting piece 1 at 2015-04-10 10:57:37

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=1 recid=3 stamp=874146061

input archive log thread=1 sequence=2 recid=4 stamp=874173997

input archive log thread=1 sequence=3 recid=5 stamp=874174578

input archive log thread=1 sequence=4 recid=6 stamp=874174964

input archive log thread=1 sequence=5 recid=7 stamp=874175135

input archive log thread=1 sequence=6 recid=8 stamp=874176567

input archive log thread=1 sequence=7 recid=9 stamp=874176642

input archive log thread=1 sequence=8 recid=10 stamp=874176813

input archive log thread=1 sequence=9 recid=11 stamp=874176891

input archive log thread=1 sequence=10 recid=12 stamp=874176944

input archive log thread=1 sequence=11 recid=13 stamp=874177001

input archive log thread=1 sequence=12 recid=14 stamp=874177192

input archive log thread=1 sequence=13 recid=15 stamp=874177339

input archive log thread=1 sequence=14 recid=16 stamp=874178193

input archive log thread=1 sequence=15 recid=17 stamp=874178220

input archive log thread=1 sequence=16 recid=18 stamp=874178248

input archive log thread=1 sequence=17 recid=19 stamp=874178514

input archive log thread=1 sequence=18 recid=20 stamp=874178629

input archive log thread=1 sequence=19 recid=21 stamp=874179234

input archive log thread=1 sequence=20 recid=22 stamp=874179587

input archive log thread=1 sequence=21 recid=23 stamp=874179818

input archive log thread=1 sequence=22 recid=24 stamp=874179946

input archive log thread=1 sequence=23 recid=25 stamp=874180013

input archive log thread=1 sequence=24 recid=26 stamp=874180045

input archive log thread=1 sequence=25 recid=27 stamp=874180177

input archive log thread=1 sequence=26 recid=28 stamp=874180387

input archive log thread=1 sequence=27 recid=29 stamp=874180624

channel c2: starting piece 1 at 2015-04-10 10:57:37

channel c1: finished piece 1 at 2015-04-10 10:57:44

piece handle=/home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_9_1.bak tag=TAG20150410T105735 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:08

channel c1: deleting archive log(s)

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_28_bj2zss27_.arc recid=30 stamp=874180665

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_29_bj308z6m_.arc recid=31 stamp=874181151

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_30_bj30j7f0_.arc recid=32 stamp=874181383

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_31_bj31wg6x_.arc recid=33 stamp=874182798

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_32_bj31wg77_.arc recid=34 stamp=874182798

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_33_bj31xqc4_.arc recid=35 stamp=874182839

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_34_bj3208q4_.arc recid=36 stamp=874182920

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_35_bj3224vc_.arc recid=37 stamp=874182980

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_36_bj32409g_.arc recid=38 stamp=874183040

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_37_bj32bj52_.arc recid=39 stamp=874183248

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_38_bj32j54p_.arc recid=40 stamp=874183429

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_39_bj32mygp_.arc recid=41 stamp=874183550

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_40_bj32rv2k_.arc recid=42 stamp=874183707

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_41_bj32zxom_.arc recid=43 stamp=874183933

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_42_bj4hqoty_.arc recid=44 stamp=874229749

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_43_bj4kclm5_.arc recid=45 stamp=874231410

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_44_bj4ky6mw_.arc recid=46 stamp=874232006

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_45_bj4lgc2k_.arc recid=47 stamp=874232523

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_46_bj4lgv0o_.arc recid=48 stamp=874232539

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_47_bj4ljcwg_.arc recid=49 stamp=874232587

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_13/o1_mf_1_48_bj5c0zgc_.arc recid=50 stamp=874257695

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_49_blgg6r3m_.arc recid=51 stamp=876653024

channel c2: finished piece 1 at 2015-04-10 10:57:45

piece handle=/home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_10_1.bak tag=TAG20150410T105735 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:09

channel c2: deleting archive log(s)

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_1_bj1y0f28_.arc recid=3 stamp=874146061

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_2_bj2s9d1c_.arc recid=4 stamp=874173997

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_3_bj2svl3x_.arc recid=5 stamp=874174578

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_4_bj2t7nct_.arc recid=6 stamp=874174964

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_5_bj2tdz19_.arc recid=7 stamp=874175135

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_6_bj2vsqt9_.arc recid=8 stamp=874176567

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_7_bj2vw23p_.arc recid=9 stamp=874176642

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_8_bj2w1f3m_.arc recid=10 stamp=874176813

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_9_bj2w3vmf_.arc recid=11 stamp=874176891

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_10_bj2w5jv7_.arc recid=12 stamp=874176944

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_11_bj2w7962_.arc recid=13 stamp=874177001

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_12_bj2wf8gp_.arc recid=14 stamp=874177192

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_13_bj2wkvtv_.arc recid=15 stamp=874177339

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_14_bj2xdk7j_.arc recid=16 stamp=874178193

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_15_bj2xfd82_.arc recid=17 stamp=874178220

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_16_bj2xg8c2_.arc recid=18 stamp=874178248

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_17_bj2xplw4_.arc recid=19 stamp=874178514

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_18_bj2xt5rh_.arc recid=20 stamp=874178629

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_19_bj2yf26n_.arc recid=21 stamp=874179234

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_20_bj2yr3c1_.arc recid=22 stamp=874179587

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_21_bj2yzb76_.arc recid=23 stamp=874179818

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_22_bj2z3b9g_.arc recid=24 stamp=874179946

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_23_bj2z5f1y_.arc recid=25 stamp=874180013

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_24_bj2z6fmq_.arc recid=26 stamp=874180045

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_25_bj2zbk8g_.arc recid=27 stamp=874180177

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_26_bj2zk3dy_.arc recid=28 stamp=874180387

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_27_bj2zrjg9_.arc recid=29 stamp=874180624

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=50 recid=52 stamp=876653855

input archive log thread=1 sequence=51 recid=53 stamp=876653855

channel c1: starting piece 1 at 2015-04-10 10:57:45

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=5 recid=1 stamp=874145991

input archive log thread=1 sequence=6 recid=2 stamp=874145991

channel c2: starting piece 1 at 2015-04-10 10:57:45

channel c1: finished piece 1 at 2015-04-10 10:57:46

piece handle=/home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_11_1.bak tag=TAG20150410T105735 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c1: deleting archive log(s)

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgh0z1n_.arc recid=52 stamp=876653855

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_51_blgh0z4q_.arc recid=53 stamp=876653855

channel c2: finished piece 1 at 2015-04-10 10:57:46

piece handle=/home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_12_1.bak tag=TAG20150410T105735 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c2: deleting archive log(s)

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_5_bj1xy7cd_.arc recid=1 stamp=874145991

archive log filename=/u03/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_03_12/o1_mf_1_6_bj1xy7ff_.arc recid=2 stamp=874145991

Finished backup at 2015-04-10 10:57:46

Starting backup at 2015-04-10 10:57:49

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

including current control file in backupset

channel c1: starting piece 1 at 2015-04-10 10:57:49

channel c1: finished piece 1 at 2015-04-10 10:57:50

piece handle=/home/oracle/oracle_bk/orcl/ctl_ORA1024G_20150410_13_1.bak tag=TAG20150410T105749 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-04-10 10:57:50

released channel: c1

released channel: c2

RMAN>

List of Backups

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

Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag

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

4       B  F  A DISK        2015-04-10 10:57:24 1       1       NO         TAG20150410T105604

5       B  F  A DISK        2015-04-10 10:57:27 1       1       NO         TAG20150410T105604

6       B  F  A DISK        2015-04-10 10:57:31 1       1       NO         TAG20150410T105604

7       B  F  A DISK        2015-04-10 10:57:31 1       1       NO         TAG20150410T105604

8       B  F  A DISK        2015-04-10 10:57:33 1       1       NO         TAG20150410T105733

9       B  A  A DISK        2015-04-10 10:57:40 1       1       NO         TAG20150410T105735

10      B  A  A DISK        2015-04-10 10:57:43 1       1       NO         TAG20150410T105735

11      B  A  A DISK        2015-04-10 10:57:45 1       1       NO         TAG20150410T105735

12      B  A  A DISK        2015-04-10 10:57:45 1       1       NO         TAG20150410T105735

13      B  F  A DISK        2015-04-10 10:57:49 1       1       NO         TAG20150410T105749

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 ~]$[oracle@redhat4 oracle_bk]$ oracle@192.168.59.10's password:

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

full_ORA1024G_20150410_876653764_5_1.bak                                                                                                                                        100%  223MB  31.9MB/s   00:07

arch_ORA1024G_20150410_12_1.bak                                                                                                                                                 100% 3584     3.5KB/s   00:00

full_ORA1024G_20150410_876653764_4_1.bak                                                                                                                                        100%  367MB  16.7MB/s   00:22

arch_ORA1024G_20150410_9_1.bak                                                                                                                                                  100%   38MB   4.7MB/s   00:08

arch_ORA1024G_20150410_11_1.bak                                                                                                                                                 100% 1849KB   1.8MB/s   00:00

full_ORA1024G_20150410_876653850_6_1.bak                                                                                                                                        100% 7232KB   7.1MB/s   00:01

ctl_ORA1024G_20150410_13_1.bak                                                                                                                                                  100% 7232KB   2.4MB/s   00:03

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

arch_ORA1024G_20150410_10_1.bak                                                                                                                                                 100% 8300KB   8.1MB/s   00:00

[oracle@rhel6_lhr oracle_bk]$ [oracle@redhat4 oracle_bk]$ oracle@192.168.59.10's password:

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

[oracle@redhat4 oracle_bk]$

三、 在target异机的操作 1、 恢复spfile

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

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

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

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

修改pfile文件之后:

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

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

*.compatible='10.2.0.3.0'

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

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='ora1024g'

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

*.db_recovery_file_dest_size=2147483648

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

*.job_queue_processes=10

*.nls_date_format='yyyy-mm-dd hh24:mi:ss'

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

[oracle@testdb orcl]$

创建相关路径:

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

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

[oracle@testdb orcl]$

[oracle@testdb dbs]$ ORACLE_SID=ora1024g

[oracle@testdb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 10 12:38:29 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 orcl]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Apr 10 12:39:19 2015

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

connected to target database:

RMAN>

Starting restore at 10-APR-15

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=136 device type=DISK

channel ORA_DISK_1: restoring control file

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

Finished restore at 10-APR-15

RMAN>

RMAN>

[oracle@testdb orcl]$ [oracle@testdb orcl]$ [oracle@testdb orcl]$ exit

exit

host command complete

RMAN>

RMAN>

using target database control file instead of recovery catalog

database mounted

RMAN>

RMAN>

告警日志:

Fri Apr 10 12:43:54 2015

alter database mount

Control file expanded from 448 to 610 blocks for upgrade.

Set as converted control file due to db_unique_name mismatch

Changing di2dbun from  to ora1024g

Expanded controlfile section 32 from 10 to 31 records

The number of logical blocks in section 32 remains the same

Fri Apr 10 12:43:58 2015

Successful mount of redo thread 1, with mount id 2700660298

Database mounted in Exclusive Mode

Lost write protection disabled

Create Relation IPS_PACKAGE_UNPACK_HISTORY

Completed: alter database mount

3、 恢复归档文件

RMAN>

Starting implicit crosscheck backup at 10-APR-15

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=136 device type=DISK

Crosschecked 12 objects

Finished implicit crosscheck backup at 10-APR-15

Starting implicit crosscheck copy at 10-APR-15

using channel ORA_DISK_1

Finished implicit crosscheck copy at 10-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/spfile_ORA1024G_08q41b8t_1_1_20150410.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653764_5_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_12_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653764_4_1.bak

File Name: /tmp/orcl/initora1024g.ora

File Name: /tmp/orcl/arch_ORA1024G_20150410_9_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_11_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653850_6_1.bak

File Name: /tmp/orcl/ctl_ORA1024G_20150410_13_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653851_7_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_10_1.bak

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

cataloging done

List of Cataloged Files

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

File Name: /tmp/orcl/spfile_ORA1024G_08q41b8t_1_1_20150410.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653764_5_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_12_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653764_4_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_9_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_11_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653850_6_1.bak

File Name: /tmp/orcl/ctl_ORA1024G_20150410_13_1.bak

File Name: /tmp/orcl/full_ORA1024G_20150410_876653851_7_1.bak

File Name: /tmp/orcl/arch_ORA1024G_20150410_10_1.bak

List of Files Which Where Not Cataloged

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

File Name: /tmp/orcl/initora1024g.ora

RMAN-07517: Reason: The file header is corrupted

RMAN>

RMAN>

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

List of Backup Pieces

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

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

4       4       1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653764_5_1.bak

5       5       1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653764_4_1.bak

8       8       1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/spfile_ORA1024G_08q41b8t_1_1_20150410.bak

12      12      1   1   EXPIRED     DISK        /home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_11_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_ORA1024G_20150410_876653764_5_1.bak RECID=4 STAMP=876653765

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/full_ORA1024G_20150410_876653764_4_1.bak RECID=5 STAMP=876653764

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/spfile_ORA1024G_08q41b8t_1_1_20150410.bak RECID=8 STAMP=876653853

deleted backup piece

backup piece handle=/home/oracle/oracle_bk/orcl/arch_ORA1024G_20150410_11_1.bak RECID=12 STAMP=876653865

Deleted 4 EXPIRED objects

RMAN>

List of Backup Sets

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

BS Key  Size       Device Type Elapsed Time Completion Time

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

9       8.10M      DISK        00:00:04     10-APR-15

BP Key: 27   Status: AVAILABLE  Compressed: NO  Tag: TAG20150410T105735

Piece Name: /tmp/orcl/arch_ORA1024G_20150410_10_1.bak

List of Archived Logs in backup set 9

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

1    1       662208     12-MAR-15 682213     12-MAR-15

1    2       682213     12-MAR-15 713813     12-MAR-15

1    3       713813     12-MAR-15 734293     12-MAR-15

1    4       734293     12-MAR-15 754316     12-MAR-15

1    5       754316     12-MAR-15 774339     12-MAR-15

1    6       774339     12-MAR-15 795060     12-MAR-15

1    7       795060     12-MAR-15 815180     12-MAR-15

1    8       815180     12-MAR-15 835296     12-MAR-15

1    9       835296     12-MAR-15 855340     12-MAR-15

1    10      855340     12-MAR-15 875374     12-MAR-15

1    11      875374     12-MAR-15 895414     12-MAR-15

1    12      895414     12-MAR-15 915452     12-MAR-15

1    13      915452     12-MAR-15 935521     12-MAR-15

1    14      935521     12-MAR-15 957213     12-MAR-15

1    15      957213     12-MAR-15 977241     12-MAR-15

1    16      977241     12-MAR-15 997285     12-MAR-15

1    17      997285     12-MAR-15 1017323    12-MAR-15

1    18      1017323    12-MAR-15 1037360    12-MAR-15

1    19      1037360    12-MAR-15 1057400    12-MAR-15

1    20      1057400    12-MAR-15 1077441    12-MAR-15

1    21      1077441    12-MAR-15 1097482    12-MAR-15

1    22      1097482    12-MAR-15 1117523    12-MAR-15

1    23      1117523    12-MAR-15 1137558    12-MAR-15

1    24      1137558    12-MAR-15 1157586    12-MAR-15

1    25      1157586    12-MAR-15 1177622    12-MAR-15

1    26      1177622    12-MAR-15 1197725    12-MAR-15

1    27      1197725    12-MAR-15 1217762    12-MAR-15

BS Key  Size       Device Type Elapsed Time Completion Time

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

10      37.62M     DISK        00:00:07     10-APR-15

BP Key: 24   Status: AVAILABLE  Compressed: NO  Tag: TAG20150410T105735

Piece Name: /tmp/orcl/arch_ORA1024G_20150410_9_1.bak

List of Archived Logs in backup set 10

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

1    28      1217762    12-MAR-15 1237794    12-MAR-15

1    29      1237794    12-MAR-15 1257829    12-MAR-15

1    30      1257829    12-MAR-15 1277869    12-MAR-15

1    31      1277869    12-MAR-15 1299920    12-MAR-15

1    32      1299920    12-MAR-15 1319924    12-MAR-15

1    33      1319924    12-MAR-15 1339928    12-MAR-15

1    34      1339928    12-MAR-15 1359932    12-MAR-15

1    35      1359932    12-MAR-15 1379936    12-MAR-15

1    36      1379936    12-MAR-15 1399940    12-MAR-15

1    37      1399940    12-MAR-15 1419945    12-MAR-15

1    38      1419945    12-MAR-15 1439949    12-MAR-15

1    39      1439949    12-MAR-15 1459953    12-MAR-15

1    40      1459953    12-MAR-15 1479957    12-MAR-15

1    41      1479957    12-MAR-15 1500098    12-MAR-15

1    42      1500098    12-MAR-15 1520201    13-MAR-15

1    43      1520201    13-MAR-15 1540685    13-MAR-15

1    44      1540685    13-MAR-15 1561012    13-MAR-15

1    45      1561012    13-MAR-15 1581158    13-MAR-15

1    46      1581158    13-MAR-15 1601197    13-MAR-15

1    47      1601197    13-MAR-15 1621238    13-MAR-15

1    48      1621238    13-MAR-15 1647550    13-MAR-15

1    49      1647550    13-MAR-15 1694275    10-APR-15

BS Key  Size       Device Type Elapsed Time Completion Time

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

11      3.00K      DISK        00:00:00     10-APR-15

BP Key: 23   Status: AVAILABLE  Compressed: NO  Tag: TAG20150410T105735

Piece Name: /tmp/orcl/arch_ORA1024G_20150410_12_1.bak

List of Archived Logs in backup set 11

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

1    5       660997     11-MAR-15 660999     11-MAR-15

1    6       660999     11-MAR-15 661005     11-MAR-15

BS Key  Size       Device Type Elapsed Time Completion Time

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

12      1.80M      DISK        00:00:00     10-APR-15

BP Key: 18   Status: AVAILABLE  Compressed: NO  Tag: TAG20150410T105735

Piece Name: /tmp/orcl/arch_ORA1024G_20150410_11_1.bak

List of Archived Logs in backup set 12

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

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

1    50      1694275    10-APR-15 1694970    10-APR-15

1

RMAN>

RMAN>

RMAN>

Starting restore at 10-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=41

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=42

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=43

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=44

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=45

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=46

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=47

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=48

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=49

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

channel ORA_DISK_1: piece handle=/tmp/orcl/arch_ORA1024G_20150410_9_1.bak tag=TAG20150410T105735

channel ORA_DISK_1: restored backup piece 1

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

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=50

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=51

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

channel ORA_DISK_1: piece handle=/tmp/orcl/arch_ORA1024G_20150410_11_1.bak tag=TAG20150410T105735

channel ORA_DISK_1: restored backup piece 1

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

Finished restore at 10-APR-15

RMAN>

4、 恢复数据文件

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

RMAN> host

2> ;

[oracle@testdb orcl]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 10 12:56:08 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> 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 "/u03/app/oracle/oradata/ora1024g/system01.dbf";

set newname for datafile 2 to "/u03/app/oracle/oradata/ora1024g/undotbs01.dbf";

set newname for datafile 3 to "/u03/app/oracle/oradata/ora1024g/sysaux01.dbf";

set newname for datafile 4 to "/u03/app/oracle/oradata/ora1024g/users01.dbf";

set newname for datafile 5 to "/u03/app/oracle/oradata/ora1024g/example01.dbf";

set newname for datafile 6 to "/u03/app/oracle/oradata/ora1024g/undotbs02.dbf";

set newname for tempfile 1 to "/u03/app/oracle/oradata/ora1024g/temp01.dbf";

SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo03.log''  to  ''/u03/app/oracle/oradata/ora1024g/redo03.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo02.log''  to  ''/u03/app/oracle/oradata/ora1024g/redo02.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo01.log''  to  ''/u03/app/oracle/oradata/ora1024g/redo01.log'' ";

10 rows selected.

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@testdb orcl]$ exit

exit

host command complete

RMAN>

修改脚本:

启动数据库到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>

11> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo03.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo03.log'' ";

12> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo02.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo02.log'' ";

13> SQL "ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo01.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo01.log'' ";

released channel: ORA_DISK_1

allocated channel: c1

channel c1: SID=136 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

executing command: SET NEWNAME

sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo03.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo03.log''

sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo02.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo02.log''

sql statement: ALTER DATABASE RENAME FILE ''/u03/app/oracle/oradata/ora1024g/redo01.log''  to  ''/u01/app/oracle/oradata/ora1024g/redo01.log''

executing command: SET until clause

Starting restore at 10-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/ora1024g/undotbs01.dbf

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

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

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

channel c1: piece handle=/tmp/orcl/full_ORA1024G_20150410_876653764_5_1.bak tag=TAG20150410T105604

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/ora1024g/system01.dbf

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

channel c1: restoring datafile 00006 to /u01/app/oracle/oradata/ora1024g/undotbs02.dbf

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

channel c1: piece handle=/tmp/orcl/full_ORA1024G_20150410_876653764_4_1.bak tag=TAG20150410T105604

channel c1: restored backup piece 1

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

Finished restore at 10-APR-15

datafile 1 switched to datafile copy

input datafile copy RECID=12 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=13 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=14 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=15 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=16 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/example01.dbf

datafile 6 switched to datafile copy

input datafile copy RECID=17 STAMP=876661203 file name=/u01/app/oracle/oradata/ora1024g/undotbs02.dbf

Starting recover at 10-APR-15

starting media recovery

archived log for thread 1 with sequence 50 is already on disk as file /u01/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgoy1k2_.arc

archived log file name=/u01/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgoy1k2_.arc thread=1 sequence=50

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

Finished recover at 10-APR-15

released channel: c1

RMAN>

告警日志:

Fri Apr 10 12:59:20 2015

ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo03.log'  to  '/u01/app/oracle/oradata/ora1024g/redo03.log'

Completed: ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo03.log'  to  '/u01/app/oracle/oradata/ora1024g/redo03.log'

ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo02.log'  to  '/u01/app/oracle/oradata/ora1024g/redo02.log'

Completed: ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo02.log'  to  '/u01/app/oracle/oradata/ora1024g/redo02.log'

ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo01.log'  to  '/u01/app/oracle/oradata/ora1024g/redo01.log'

Completed: ALTER DATABASE RENAME FILE '/u03/app/oracle/oradata/ora1024g/redo01.log'  to  '/u01/app/oracle/oradata/ora1024g/redo01.log'

Fri Apr 10 12:59:23 2015

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

  checkpoint is 1694926

  last deallocation scn is 1666404

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

  checkpoint is 1694926

  last deallocation scn is 617217

Fri Apr 10 12:59:34 2015

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

  checkpoint is 1694926

  last deallocation scn is 638890

Full restore complete of datafile 6 to datafile copy /u01/app/oracle/oradata/ora1024g/undotbs02.dbf.  Elapsed time: 0:00:00

  checkpoint is 1694925

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

  checkpoint is 1694925

Fri Apr 10 12:59:56 2015

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

  checkpoint is 1694925

  last deallocation scn is 1540959

Fri Apr 10 13:00:03 2015

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/system01.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 1694925

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/undotbs01.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 1694926

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/sysaux01.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 1694926

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/users01.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 1694925

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/example01.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 1694926

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_3982.trc:

ORA-19625: error identifying file /u03/app/oracle/oradata/ora1024g/undotbs02.dbf

ORA-27037: unable to obtain file status

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

Additional information: 3

Switch of datafile 6 complete to datafile copy

  checkpoint is 1694925

alter database recover datafile list clear

Completed: alter database recover datafile list clear

alter database recover datafile list

1 , 2 , 3 , 4 , 5 , 6

Completed: alter database recover datafile list

1 , 2 , 3 , 4 , 5 , 6

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/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgoy1k2_.arc'

Media Recovery Log /u01/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgoy1k2_.arc

ORA-279 signalled during: alter database recover logfile '/u01/app/oracle/flash_recovery_area/ORA1024G/archivelog/2015_04_10/o1_mf_1_50_blgoy1k2_.arc'...

alter database recover cancel

Media Recovery Canceled

Completed: alter database recover cancel

 

 

重建TEMP 表空间

--这一步很重要,做恢复,迁移,重建控制文件,都需要做这一步操作。

SQL>

Tablespace altered.

SQL> select name from v$tempfile;

NAME

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

/u03/app/oracle/oradata/ora1024g/temp01.dbf

/u01/app/oracle/oradata/ora1024g/temp01.dbf

SQL>

Tablespace altered.

SQL>

5、 startup upgrade打开数据库

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

[oracle@testdb orcl]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 10 13:01:54 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>

Database altered.

SQL>

告警日志:

 

Fri Apr 10 13:02:07 2015

alter database open resetlogs upgrade

RESETLOGS after incomplete recovery UNTIL CHANGE 1694970

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora1024g/redo01.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 2 of thread 1

ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora1024g/redo02.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 3 of thread 1

ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora1024g/redo03.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora1024g/redo01.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Clearing online redo logfile 1 /u01/app/oracle/oradata/ora1024g/redo01.log

Clearing online log 1 of thread 1 sequence number 52

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora1024g/redo01.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora1024g/redo01.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Clearing online redo logfile 1 complete

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 2 of thread 1

ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora1024g/redo02.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Clearing online redo logfile 2 /u01/app/oracle/oradata/ora1024g/redo02.log

Clearing online log 2 of thread 1 sequence number 50

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 2 of thread 1

ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora1024g/redo02.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 2 of thread 1

ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora1024g/redo02.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Clearing online redo logfile 2 complete

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 3 of thread 1

ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora1024g/redo03.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Clearing online redo logfile 3 /u01/app/oracle/oradata/ora1024g/redo03.log

Clearing online log 3 of thread 1 sequence number 51

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 3 of thread 1

ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora1024g/redo03.log'

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc:

ORA-00313: open failed for members of log group 3 of thread 1

ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora1024g/redo03.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Fri Apr 10 13:02:12 2015

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

Clearing online redo logfile 3 complete

Resetting resetlogs activation ID 2698192627 (0xa0d326f3)

Online log /u01/app/oracle/oradata/ora1024g/redo01.log: Thread 1 Group 1 was previously cleared

Online log /u01/app/oracle/oradata/ora1024g/redo02.log: Thread 1 Group 2 was previously cleared

Online log /u01/app/oracle/oradata/ora1024g/redo03.log: Thread 1 Group 3 was previously cleared

Fri Apr 10 13:02:12 2015

Setting recovery target incarnation to 4

Fri Apr 10 13:02:12 2015

Assigning activation ID 2700660298 (0xa0f8ce4a)

LGWR: STARTING ARCH PROCESSES

Fri Apr 10 13:02:12 2015

ARC0 started with pid=20, OS id=4160

ARC0: Archival started

LGWR: STARTING ARCH PROCESSES COMPLETE

ARC0: STARTING ARCH PROCESSES

Fri Apr 10 13:02:13 2015

ARC1 started with pid=21, OS id=4162

Fri Apr 10 13:02:13 2015

ARC2 started with pid=22, OS id=4164

Thread 1 opened at log sequence 1

  Current log# 1 seq# 1 mem# 0: /u01/app/oracle/oradata/ora1024g/redo01.log

Successful open of redo thread 1

MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set

Fri Apr 10 13:02:13 2015

SMON: enabling cache recovery

Fri Apr 10 13:02:13 2015

ARC3 started with pid=23, OS id=4166

ARC1: Archival started

ARC2: Archival started

ARC1: Becoming the 'no FAL' ARCH

ARC1: Becoming the 'no SRL' ARCH

ARC2: Becoming the heartbeat ARCH

[4153] Successfully onlined Undo Tablespace 1.

Undo initialization finished serial:0 start:9999934 end:10000464 diff:530 (5 seconds)

Dictionary check beginning

Fri Apr 10 13:02:14 2015

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_dbw0_3820.trc:

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

ORA-01110: data file 201: '/u03/app/oracle/oradata/ora1024g/temp01.dbf'

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/ora1024g/ora1024g/trace/ora1024g_dbw0_3820.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: '/u03/app/oracle/oradata/ora1024g/temp01.dbf'

File 201 not verified due to error ORA-01157

Dictionary check complete

SMON: enabling tx recovery

Cannot re-create tempfile /u03/app/oracle/oradata/ora1024g/temp01.dbf, the same name file exists

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_dbw0_3820.trc:

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

ORA-01110: data file 201: '/u03/app/oracle/oradata/ora1024g/temp01.dbf'

ORA-27037: unable to obtain file status

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

Additional information: 3

Database Characterset is ZHS16GBK

Updating 10.2.0.4.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

Fri Apr 10 13:02:18 2015

Stopping background process MMON

Starting background process MMON

Fri Apr 10 13:02:19 2015

Starting background process MMNLMMON started with pid=15, OS id=4169

 

Fri Apr 10 13:02:19 2015

MMNL started with pid=16, OS id=4171

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 resetlogs upgrade

 

 

 

 

6、  upgrade模式下执行升级脚本catupgrd.sql

SELECT d.owner, count(1) FROM dba_objects d where status = 'INVALID' GROUP BY d.owner;

SQL>

COUNT(1)

----------

811

SQL>

SQL>

OWNER                            COUNT(1)

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

MDSYS                                  16

DMSYS                                   2

PUBLIC                                334

CTXSYS                                  1

ORACLE_OCM                              2

EXFSYS                                  8

DBSNMP                                  4

SYSMAN                                  3

XDB                                     4

SYS                                   413

WMSYS                                  24

11 rows selected.

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

INSTANCE_NAME    VERSION           STATUS

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

OPEN MIGRATE

SQL>

$ORACLE_HOME\RDBMS\ADMIN\catupgrd.sql

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

。。。。。。。。。。。省略

SQL>

SQL>

SQL> /*****************************************************************************/

SQL> /* Step 10 - SHUTDOWN THE DATABASE..!!!!!

SQL> */

SQL> /*****************************************************************************/

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

SQL>

SQL> DOC

DOC>#######################################################################

DOC>#######################################################################

DOC>

DOC>   The above sql script is the final step of the upgrade. Please

DOC>   review any errors in the spool log file. If there are any errors in

DOC>   the spool file, consult the Oracle Database Upgrade Guide for

DOC>   troubleshooting recommendations.

DOC>

DOC>   Next restart for normal operation, and then run utlrp.sql to

DOC>   recompile any invalid application objects.

DOC>

DOC>   If the source database had an older time zone version prior to

DOC>   upgrade, then please run the DBMS_DST package.  DBMS_DST will upgrade

DOC>   TIMESTAMP WITH TIME ZONE data to use the latest time zone file shipped

DOC>   with Oracle.

DOC>

DOC>#######################################################################

DOC>#######################################################################

DOC>#

SQL>

SQL> Rem Set errorlogging off

SQL> SET ERRORLOGGING OFF;

SQL>

SQL> REM END OF CATUPGRD.SQL

SQL>

SQL> REM bug 12337546 - Exit current sqlplus session at end of catupgrd.sql.

SQL> REM                This forces user to start a new sqlplus session in order

SQL> REM                to connect to the upgraded db.

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

-----------  终于完了,,,,,,

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

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.

Errors in file /u01/app/oracle/diag/rdbms/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc  (incident=159):

ORA-04031: unable to allocate 280 bytes of shared memory ("shared pool","CCOL$","PLDIA^4db547a0","PAR.C:parchk:init")

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/ora1024g/ora1024g/trace/ora1024g_ora_4153.trc  (incident=160):

ORA-04031: unable to allocate 280 bytes of shared memory ("shared pool","CCOL$","PLDIA^4db547a0","PAR.C:parchk:init")

Use ADRCI or Support Workbench to package the incident.

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

这个脚本运行了整个2个小时,之前直接从11.2.0.1升级到11.2.0.3运行了80分钟。而在Oracle10g下,运行该脚本在40分钟左右。

导致执行占用这么长时间的原因如下:

1.     使用的是虚拟机

2.     之前没有注意到归档的问题,后面才看到3.     运行脚本之前忘记修改java_pool_size 和 shared_pool_size.  增加这2个值,可以减少运行时间。

SQL>alter system setjava_pool_size=512M;
SQL>alter system set shared_pool_size=800M;

The
upgrade scriptcreates and alters certain data dictionary tables. It
also upgrades orinstallsthe following database components in the new
Oracle Database11g Release 2(11.2) database:

(1)       OracleDatabase Catalog Views

(2)       OracleDatabase Packages andTypes

(3)       JServerJAVA Virtual Machine

(4)       OracleDatabase Java Packages

(5)       OracleXDK

(6)       OracleReal ApplicationClusters

(7)       OracleWorkspace Manager

(8)       OracleMultimedia

(9)       OracleXML Database

(10)    OLAP AnalyticWorkspace

(11)    Oracle OLAP API

(12)    OLAP Catalog

(13)    Oracle Text

(14)    Spatial

(15)    Oracle DataMining

(16)    Oracle LabelSecurity

(17)    MessagingGateway

(18)    OracleExpression Filter

(19)    Oracle RulesManager

(20)    OracleEnterprise Manager Repository

(21)    Oracle DatabaseVault

(22)    OracleApplication Express

  1. 2. 执行这个脚本会产生大量的归档文件,50M的online redo log,切换时间在2分钟左右,所以要增加online redo group,从而保证足够的切换时间,不能让其出现Checkpoint not complete。 

如果告警日志中出现了Checkpoint not complete的问题,我们可以多添加几组日志:

在脚本运行期间还可能会调用之前的归档文件,所以也不要删除之前的归档。

7、 执行catuppst.sql脚本,不需要在upgrade 模式下执行

SQL>

。。。。。。

SQL> SPOOL &spool_file

SQL> exec dbms_registry.set_session_namespace('SERVER')

PL/SQL procedure successfully completed.

SQL> ALTER SESSION SET current_schema = SYS;

Session altered.

SQL> PROMPT Updating registry...

Updating registry...

SQL> INSERT INTO registry$history

2    (action_time, action,

3     namespace, version, id,

4     bundle_series, comments)

5  VALUES

6    (SYSTIMESTAMP, 'APPLY',

7     SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),

8     '11.2.0.3',

9     0,

10     'PSU',

11     'Patchset 11.2.0.2.0');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SPOOL off

SQL> SET echo off

Check the following log file for errors:

/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_ORA1024G_APPLY_2015Apr10_16_06_00.log

SQL>

This script will migrate the Baseline dataon a pre-11g database to the 11g database.

--这个脚本用来迁移一些Baseline 数据到11g数据库中。

8、 编译无效对象

[oracle@testdb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Thu Apr 9 15:14:26 2015

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

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area  501059584 bytes

Fixed Size                  2229744 bytes

Variable Size             444598800 bytes

Database Buffers           46137344 bytes

Redo Buffers                8093696 bytes

Database mounted.

Database opened.

SQL>  select count(*) from dba_invalid_objects;

COUNT(*)

----------

5959

SQL>

SQL> select count(*) from dba_objects where status='INVALID';

COUNT(*)

----------

SQL>

TIMESTAMP

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

COMP_TIMESTAMP UTLRP_BGN  2015-04-09 15:16:49

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid

DOC>   objects in the database. Recompilation time is proportional to the

DOC>   number of invalid objects in the database, so this command may take

DOC>   a long time to execute on a database with a large number of invalid

DOC>   objects.

DOC>

DOC>   Use the following queries to track recompilation progress:

DOC>

DOC>   1. Query returning the number of invalid objects remaining. This

DOC>      number should decrease with time.

DOC>         DOC>

DOC>   2. Query returning the number of objects compiled so far. This number

DOC>      should increase with time.

DOC>        DOC>

DOC>   This script automatically chooses serial or parallel recompilation

DOC>   based on the number of CPUs available (parameter cpu_count) multiplied

DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).

DOC>   On RAC, this number is added across all RAC nodes.

DOC>

DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel

DOC>   recompilation. Jobs are created without instance affinity so that they

DOC>   can migrate across RAC nodes. Use the following queries to verify

DOC>   whether UTL_RECOMP jobs are being created and run correctly:

DOC>

DOC>   1. Query showing jobs created by UTL_RECOMP

DOC>         SELECT job_name FROM dba_scheduler_jobs

DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';

DOC>

DOC>   2. Query showing UTL_RECOMP jobs that are running

DOC>         SELECT job_name FROM dba_scheduler_running_jobs

DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';

DOC>#

PL/SQL procedure successfully completed.

TIMESTAMP

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

COMP_TIMESTAMP UTLRP_END  2015-04-09 15:22:21

DOC> The following query reports the number of objects that have compiled

DOC> with errors (objects that compile with errors have status set to 3 in

DOC> obj$). If the number is higher than expected, please examine the error

DOC> messages reported with each object (using SHOW ERRORS) to see if they

DOC> point to system misconfiguration or resource constraints that must be

DOC> fixed before attempting to recompile these objects.

DOC>#

OBJECTS WITH ERRORS

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

0

DOC> The following query reports the number of errors caught during

DOC> recompilation. If this number is non-zero, please query the error

DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors

DOC> are due to misconfiguration or resource constraints that must be

DOC> fixed before objects can compile successfully.

DOC>#

ERRORS DURING RECOMPILATION

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

0

Function created.

PL/SQL procedure successfully completed.

Function dropped.

PL/SQL procedure successfully completed.

SQL>

SQL> select count(*) from dba_objects where status='INVALID';

COUNT(*)

----------

SQL>

SQL>

COUNT(*)

----------

4

1 row selected.

SQL> SELECT d.owner, count(1) FROM dba_objects d where status = 'INVALID'GROUP BY d.owner;

OWNER                            COUNT(1)

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

OE                                      4

1 row selected.

SQL>

根据脚本提示,我们可以在重新编译的过程中,重开一个窗口执行最后查询INVALID的对象消失,说明还原成功,剩下的就是其它一些tns及监听的配置等等后续操作,这里就不演示了。

9、 检查组件状态

col comp_name for a40

set wrap off

set line 9999 pagesize 9999

select  comp_id,comp_name,version, status from dba_registry;

SQL> col comp_name for a40

SQL> set wrap off

SQL> set line 9999 pagesize 9999

SQL> select comp_id,comp_name,version,status from dba_registry;

COMP_ID                        COMP_NAME                                VERSION                        STATUS

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

XDB                            Oracle XML Database                      11.2.0.3.0                     VALID

EM                             Oracle Enterprise Manager                11.2.0.3.0                     VALID

AMD                            OLAP Catalog                             11.2.0.3.0                     VALID

SDO                            Spatial                                  11.2.0.3.0                     VALID

CONTEXT                        Oracle Text                              11.2.0.3.0                     VALID

ODM                            Oracle Data Mining                       11.2.0.3.0                     VALID

EXF                            Oracle Expression Filter                 11.2.0.3.0                     VALID

RUL                            Oracle Rules Manager                     11.2.0.3.0                     VALID

OWM                            Oracle Workspace Manager                 11.2.0.3.0                     VALID

CATALOG                        Oracle Database Catalog Views            11.2.0.3.0                     VALID

CATPROC                        Oracle Database Packages and Types       11.2.0.3.0                     VALID

JAVAVM                         JServer JAVA Virtual Machine             11.2.0.3.0                     VALID

XML                            Oracle XDK                               11.2.0.3.0                     VALID

CATJAVA                        Oracle Database Java Packages            11.2.0.3.0                     VALID

APS                            OLAP Analytic Workspace                  11.2.0.3.0                     VALID

XOQ                            Oracle OLAP API                          11.2.0.3.0                     VALID

17 rows selected.

SQL>

SQL>

SQL>

COUNT(*)

----------

4

1 row selected.

SQL>

SQL> SQL> @$ORACLE_HOME/rdbms/admin/utlu112s.sql

.

Oracle Database 11.2 Post-Upgrade Status Tool           04-10-2015 16:09:34

.

Component                               Current      Version     Elapsed Time

Name                                    Status       Number      HH:MM:SS

.

.   ORA-00001: unique constraint (SYS.I_SMB$CONFIG_PKEY) violated

.   ORA-00001: unique constraint (SYS.I_AUDIT_ACTIONS) violated

.   ORA-00001: unique constraint (SYS.I_AUDIT_ACTIONS) violated

.   ORA-00001: unique constraint (SYS.I_AUDIT_ACTIONS) violated

.   ORA-00001: unique constraint (SYS.I_AUDIT_ACTIONS) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_SMB$CONFIG_PKEY) violated

.   ORA-00001: unique constraint (SYS.I_SYSTEM_PRIVILEGE_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.WRM$_BASELINE_PK) violated

.   ORA-06512: at line 23

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.   ORA-00001: unique constraint (SYS.I_STMT_AUDIT_OPTION_MAP) violated

.                                         VALID      11.2.0.3.0  00:09:10

JServer JAVA Virtual Machine

.                                         VALID      11.2.0.3.0  00:00:00

Oracle Workspace Manager

.                                         VALID      11.2.0.3.0  00:00:26

OLAP Analytic Workspace

.                                         VALID      11.2.0.3.0  00:00:39

OLAP Catalog

.                                         VALID      11.2.0.3.0  00:00:30

Oracle OLAP API

.                                         VALID      11.2.0.3.0  00:00:19

Oracle Enterprise Manager

.                                         VALID      11.2.0.3.0  00:00:00

Oracle XDK

.                                         VALID      11.2.0.3.0  00:00:42

Oracle Text

.                                         VALID      11.2.0.3.0  00:00:21

Oracle XML Database

.                                         VALID      11.2.0.3.0  00:00:00

Oracle Database Java Packages

.                                         VALID      11.2.0.3.0  00:00:16

.   ORA-31085: schema "XDh1jUheYAR5PgNAgAILJCxg==" already registered

.   ORA-06512: at "SYS.XMLTYPE", line 310

.   ORA-06512: at line 4

.   ORA-31085: schema "XDh1jUheYAR5PgNAgAILJCxg==" already registered

.   ORA-06512: at "SYS.XMLTYPE", line 310

.   ORA-06512: at line 4

.                                       INVALID      11.2.0.3.0  00:02:24

Spatial

.                                         VALID      11.2.0.3.0  00:04:06

Oracle Expression Filter

.                                         VALID      11.2.0.3.0  00:00:07

Oracle Rules Manager

.                                         VALID      11.2.0.3.0  00:00:07

Gathering Statistics

.                                                                00:02:16

Total Upgrade Time: 00:21:52

PL/SQL procedure successfully completed.

SQL>

SQL>

Oracle Multimedia 是Oracle 标准版和企业版里的一个特性,其可以用来管理images, audio, and video,这个暂时用不到可以不用管,如果要解决这个问题我们可以重新reloadxdb组件即可解决这个问题。关于oracle的更多组件我们可以参考http://blog.csdn.net/tianlesoftware/article/details/7339998 。

附: Oracle 10.1 and above(10g 以上版本) - XDBReload

SQL> spool xdbreload.log
SQL> set echo on;
SQL> startup upgrade;
SQL> shutdown immediate;
SQL> @?/rdbms/admin/utlrp.sql
ORDIM RELOAD

SQL> @?/ord/im/admin/imxreg.sql;
?/ord/im/admin/impbs.sql;
?/ord/im/admin/impvs.sql;
?/ord/im/admin/imtyb.sql;
?/ord/im/admin/implb.sql;
?

10、 小结

将10g Restore 到11g 的2个关键内容:

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

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

3.   如果在升级过程中遇到问题,可以重新执行升级脚本,具体步骤如下:

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

本文地址:http://blog.itpub.net/26736162/viewspace-1562583/
上一篇:5. 常见C语言字符串库函数的使用及实现


下一篇:Shell 将两个文件按列合并