Migrating Oracle Database from 10g to 11g using RMAN (Different Server Approach).
1) Steps in 10g database:
copy the utlu112i.sql file from 11g home to 10g home.
[oracle@batdb admin]$ scp utlu112i.sql mytest:/u01/app/oracle/product/10.2.0/db_1/rdbms/admin
The authenticity of host 'mytest (192.168.1.170)' can't be established.
RSA key fingerprint is 7f:69:e4:a1:44:e9:91:d8:c3:14:d7:b0:d5:9b:e4:6c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mytest,192.168.1.170' (RSA) to the lbat of known hosts.
oracle@mytest's password:
utlu112i.sql 100% 199KB 199.4KB/s 00:00
[oracle@batdb admin]$
[oracle@mytest GEN]$ sqlplus
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 6 11:16:01 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @?/rdbms/admin/utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 12-06-2012 11:21:42
Script Version: 11.2.0.2.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: GEN
--> version: 10.2.0.5.0
--> compatible: 10.2.0.5.0
--> blocksize: 8192
--> platform: Linux IA (32-bit)
--> timezone file: V4
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 682 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 467 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 442 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 61 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or spfile]
Note: Pre-upgrade tool was run on a lower version 32-bit database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 412 MB
WARNING: --> "pga_aggregate_target" needs to be increased to at least 24 MB
.
--> If Target Oracle is 64-Bit, refer here for Update Parameters:
WARNING: --> "sga_target" needs to be increased to at least 596 MB
WARNING: --> "pga_aggregate_target" needs to be increased to at least 24 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]
**********************************************************************
--> background_dump_dest 11.1 DEPRECATED replaced by "diagnostic_dest"
--> 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.5.0 database timezone version
.... to the latest version which comes with the new release.
WARNING: --> EM Database Control Repository exbats 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 statbatics prior to
upgrading the database.
To gather dictionary statbatics 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 exbating 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.
**********************************************************************
2) Backup the 10g database.
rman target /
backup as backupset database format '/u01/backup/%d_%t_%s_%p' plus archivelog format '/u01/backup/%d_%U';
3) Copy the backup pices and pfile from 10g server to 11g server.
4) create the nessary database directory in 11g server.
5) Change the below parameter in pfile.
*.compatible='11.2.0.0.0'
*.control_files='+BAT_DATA/GEN/controlfile/current.257.787742981','+BAT_FRA/GEN/controlfile/current.258.787742983'
*.db_create_file_dest='+BAT_DATA'
*.db_create_online_log_dest_1='+BAT_FRA'
*.open_cursors=300
6) Start the database nomount mode in 11g server.
[oracle@batdb dbs]$ export ORACLE_SID=GEN;
[oracle@batdb dbs]$ sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 6 12:20:44 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 622149632 bytes
Fixed Size 2229040 bytes
Variable Size 184552656 bytes
Database Buffers 432013312 bytes
Redo Buffers 3354624 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@batdb dbs]$ cd /u02/backup/
[oracle@batdb backup]$ ls -lrt
total 544780
-rw-r----- 1 oracle oinstall 3072 Dec 6 12:11 GEN_0cns680j_1_1
-rw-r----- 1 oracle oinstall 9612800 Dec 6 12:11 GEN_09ns67v1_1_1
-rw-r----- 1 oracle oinstall 7143424 Dec 6 12:12 GEN_801316880_11_1
-rw-r----- 1 oracle oinstall 540532736 Dec 6 12:12 GEN_801316835_10_1
[oracle@batdb backup]$ rman target /
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Dec 6 12:21:45 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: GEN (not mounted)
7) Restore the controlfile from backup. Controfile backup piece name should be noted during backup performed in 10g DB.
RMAN> restore controlfile from '/u02/backup/GEN_801316880_11_1';
Starting restore at 06-DEC-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=24 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output file name=+BAT_DATA/gen/controlfile/current.266.801318113
output file name=+BAT_FRA/gen/controlfile/current.263.801318115
Finished restore at 06-DEC-12
8) If the backup location is same on both server, no need to do the below steps.
RMAN> catalog start with '/u02/backup';
using target database control file instead of recovery catalog
searching for all files that match the pattern /u02/backup
Lbat of Files Unknown to the Database
=====================================
File Name: /u02/backup/GEN_801316835_10_1
File Name: /u02/backup/GEN_09ns67v1_1_1
File Name: /u02/backup/GEN_0cns680j_1_1
File Name: /u02/backup/GEN_801316880_11_1
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
Lbat of Cataloged Files
=======================
File Name: /u02/backup/GEN_801316835_10_1
File Name: /u02/backup/GEN_09ns67v1_1_1
File Name: /u02/backup/GEN_0cns680j_1_1
File Name: /u02/backup/GEN_801316880_11_1
RMAN> list backup;
9) Restore and Recovery the database using below script.
RMAN> run
2> {
allocate channel c1 device type disk;
SET NEWNAME FOR DATAFILE 1 TO '+BAT_DATA';
SET NEWNAME FOR DATAFILE 2 TO '+BAT_DATA';
SET NEWNAME FOR DATAFILE 3 TO '+BAT_DATA';
SET NEWNAME FOR DATAFILE 4 TO '+BAT_DATA';
restore database until sequence 12;
switch datafile all;
recover database until sequence 12;
}3> 4> 5> 6> 7> 8> 9> 10> 11>
allocated channel: c1
channel c1: SID=15 device type=DISK
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 06-DEC-12
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to +BAT_DATA
channel c1: restoring datafile 00002 to +BAT_DATA
channel c1: restoring datafile 00003 to +BAT_DATA
channel c1: restoring datafile 00004 to +BAT_DATA
channel c1: reading from backup piece /u01/backup/GEN_801316835_10_1
channel c1: errors found reading piece handle=/u01/backup/GEN_801316835_10_1
channel c1: failover to piece handle=/u02/backup/GEN_801316835_10_1 tag=TAG20121206T120035
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:55
Finished restore at 06-DEC-12
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=801318942 file name=+BAT_DATA/gen/datafile/system.267.801318887
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=801318942 file name=+BAT_DATA/gen/datafile/undotbs1.269.801318887
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=801318942 file name=+BAT_DATA/gen/datafile/sysaux.268.801318887
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=801318942 file name=+BAT_DATA/gen/datafile/users.270.801318887
Starting recover at 06-DEC-12
starting media recovery
channel c1: starting archived log restore to default destination
channel c1: restoring archived log
archived log thread=1 sequence=11
channel c1: reading from backup piece /u02/backup/GEN_0cns680j_1_1
channel c1: piece handle=/u02/backup/GEN_0cns680j_1_1 tag=TAG20121206T120123
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:01
archived log file name=/u02/arch/GEN/1_11_801312264.arch thread=1 sequence=11
media recovery complete, elapsed time: 00:00:01
Finished recover at 06-DEC-12
released channel: c1
RMAN>
RMAN> exit
Recovery Manager complete.
10) Upgrade the database using sqlplus.
[oracle@batdb backup]$ sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 6 12:38:03 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> select name,open_mode,log_mode from v$database;
NAME OPEN_MODE LOG_MODE
--------- -------------------- ------------
GEN MOUNTED ARCHIVELOG
SQL>
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
11) Open the database in upgrade mode.
SQL> alter database open resetlogs upgrade;
alter database open resetlogs upgrade
*
ERROR at line 1:
ORA-00344: unable to re-create online log
'/u01/app/oracle/oradata/GEN/redo01.log'
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
Note : If you are getting above error. Pleae check the logfile location available or not.
SQL> !mkdir -p /u01/app/oracle/oradata/GEN
SQL> alter database open resetlogs upgrade;
alter database open resetlogs upgrade
*
ERROR at line 1:
ORA-00392: log 2 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/GEN/redo02.log'
Note : If you are getting above error. Pleae clear the logfile group.
SQL> alter database clear logfile group 2;
Database altered.
SQL> alter database open resetlogs upgrade;
Database altered.
12) upgrade the database.
SQL> SPOOL upgrade.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> SPOOL off
-------------------------------------------------
13) Changing 32 bit to 64 bit.
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP UPGRADE
SQL> SPOOL migrate.log
SQL> @?/rdbms/admin/utlmmig.sql
SQL> SPOOL off
-------------------------------------------------
14) start the database as normal mode.
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
15) run the below utlu112s.sql file for post upgrade checking and utlrp.sql file to compile the invalid objects.
SQL> @$ORACLE_HOME/rdbms/admin/utlu112s.sql
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
16) remap the temporary tablespace to ASM storage.
SQL> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/GEN/temp01.dbf';
SQL> alter tablespace temp add tempfile '+IST_DATA' size 50M;
------------- Thank You ----------------------------
Comments
Post a Comment