Minimal Downtime Cross Platform Migration and Database Upgrade
Minimal Downtime Cross Platform Migration and Database Upgrade
Minimal Downtime Cross Platform Migration and Database Upgrade
This note describes the procedure used to perform a minimal downtime platform migration from Windows to Linux as well as a database
upgrade from Oracle 11.2.0.4 to Oracle 12c (12.1.0.2).
We create a Data Guard physical standby database using the DUPLICATE FROM ACTIVE DATABASE feature, followed by a switchover and
then we activate the standby and make it a primary database. Finally we upgrade the database to 12c using the catctl.pl perl utility with the
parallel upgrade option.
By using Data Guard and the 12c command line parallel upgrade utility the entire operation has been performed with database outage of less
than 30 minutes.
This example uses a Data Guard MAXIMUM PERFORMANCE configuration, but in a production environment it is recommended to use a
MAXIMUM AVAILABILITY configuration which will require the SYNC Redo Log transport attributes and creation of standby redo log files as
well.
NAME
--------------------------------------------------------------------------------
F:\ORADATA\TESTDB\SYSTEM01.DBF
F:\ORADATA\TESTDB\SYSAUX01.DBF
F:\ORADATA\TESTDB\UNDOTBS01.DBF
F:\ORADATA\TESTDB\USERS01.DBF
F:\ORADATA\TESTDB\EXAMPLE01.DBF
/u01/app/oracle/oradata/testdb12
/u02/app/oracle/oradata/testdb12
MEMBER
-------------------------------------------------------------------------------
G:\ORADATA\TESTDB\REDO01.LOG
G:\ORADATA\TESTDB\REDO02.LOG
G:\ORADATA\TESTDB\REDO03.LOG
Site B: This will be the location for the redo log files
/u01/app/oracle/oradata/testdb12/
(SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = testdb12)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = testdb12)
)
)
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=LINT0003.apac.ent.net)(PORT=1521)))
The command completed successfully
Site B: Add entry to the /etc/oratab file for the testdb12 database
Site B : Create the password file – use the same SYS password as the source database
[oracle@LINT0003 admin]$ . oraenv
ORACLE_SID = [testdb] ? testdb12
The Oracle base remains unchanged with value /u01/app/oracle
Copy init.ora from Windows (Site A) to Linux (Site B) and make changes as appropriate
Create the required directories on Site B for the data files, control files, redo log files , archive log files, diagnostic destination, audit
file destination etc
The following changes to the init.ora were made on Site B in this case
*.audit_file_dest='/u01/app/oracle/admin/testdb12/adump'
*.control_files='/u01/app/oracle/oradata/testdb12/control01.ctl','/u01/app/oracle/oradata/testdb12/control02.ctl'
*.db_unique_name='testdb12'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.diagnostic_dest='/u01/app/oracle'
*.log_file_name_convert='G:\ORADATA\TESTDB\','/u01/app/oracle/oradata/testdb12/'
*.fal_client='testdb12'
On both Site A and Site B add the following entries to the tnsnames.ora file
TESTDB12 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = LINT0003.apac.ent.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb12)
)
)
TESTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = CSMSDC-ORAD01.apac.ent.bhpbilliton.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testdb)
)
)
Enter password:
Connected to an idle instance.
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate auxiliary channel c3 type disk;
SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/testdb12/SYSTEM01.DBF';
SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF';
SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF';
SET NEWNAME FOR DATAFILE 4 TO '/u02/app/oracle/oradata/testdb12/USERS01.DBF';
SET NEWNAME FOR DATAFILE 5 TO '/u02/app/oracle/oradata/testdb12/EXAMPLE01.DBF';
SET NEWNAME FOR TEMPFILE 1 TO '/u02/app/oracle/oradata/testdb12/TEMP01.DBF';
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER;
}
RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate auxiliary channel c3 type disk;
5> SET NEWNAME FOR DATAFILE 1 TO '/u01/app/oracle/oradata/testdb12/SYSTEM01.DBF'
;
6> SET NEWNAME FOR DATAFILE 2 TO '/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF'
;
7> SET NEWNAME FOR DATAFILE 3 TO '/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF
';
8> SET NEWNAME FOR DATAFILE 4 TO '/u02/app/oracle/oradata/testdb12/USERS01.DBF';
allocated channel: c2
channel c2: SID=19 device type=DISK
allocated channel: c3
channel c3: SID=129 device type=DISK
archived log for thread 1 with sequence 8 is already on disk as file /u01/app/or
acle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_8_12pt3res_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/20
15_01_19/o1_mf_1_8_12pt3res_.arc thread=1 sequence=8
media recovery complete, elapsed time: 00:00:00
Finished recover at 19-JAN-15
Finished Duplicate Db at 19-JAN-15
released channel: c1
released channel: c2
released channel: c3
RMAN>
Site B : Note the database role and the mount state of the database
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
System altered.
DESTINATION
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------
J:\oracle\product\11.2.0.4\dbhome_1\RDBMS
VALID
testdb12
VALID
System altered.
Site B: Open the standby database and start the managed recovery
Database altered.
COUNT(*)
----------
86736
MESSAGE
--------------------------------------------------------------------------------
ARC0: Archival started
ARC1: Archival started
ARC2: Archival started
ARC1: Becoming the 'no FAL' ARCH
ARC2: Becoming the heartbeat ARCH
ARC2: Becoming the active heartbeat ARCH
ARC3: Archival started
Error 12154 received logging on to the standby
FAL[client, ARC0]: Error 12154 connecting to testdb for fetching gap sequence
Managed Standby Recovery not using Real Time Apply
Media Recovery Complete
MESSAGE
--------------------------------------------------------------------------------
RFS[1]: Assigned to RFS process 5906
Primary database is in MAXIMUM PERFORMANCE mode
RFS[2]: Assigned to RFS process 5920
RFS[2]: No standby redo logfiles created
RFS[3]: Assigned to RFS process 5922
Primary database is in MAXIMUM PERFORMANCE mode
RFS[4]: Assigned to RFS process 6249
RFS[4]: No standby redo logfiles created
Attempt to start background Managed Standby Recovery process
MRP0: Background Managed Standby Recovery process started
Managed Standby Recovery not using Real Time Apply
MESSAGE
--------------------------------------------------------------------------------
Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_0
1_19/o1_mf_1_9_bcrwlwfz_.arc
Site B: Cancel managed recovery, activate the standby database and make it primary
Database altered.
Database altered.
Database altered.
Database altered.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/preupgrd.sql
************************************************************
The following are *** ERROR LEVEL CONDITIONS *** that must be addressed
prior to attempting your upgrade.
Failure to do so will result in a failed upgrade.
************************************************************
************************************************************
ACTIONS REQUIRED:
************************************************************
***************************************************************************
Pre-Upgrade Checks in TESTDB Completed.
***************************************************************************
Review the preupgrade.log file
**********************************************************************
[Component List]
**********************************************************************
--> 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
--> Oracle Enterprise Manager Repository [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle Application Express [upgrade] VALID
**********************************************************************
[Tablespaces]
**********************************************************************
--> SYSAUX tablespace is adequate for the upgrade.
minimum required size: 29945 MB
--> SYSTEM tablespace is adequate for the upgrade.
minimum required size: 1539 MB
--> TEMP tablespace is adequate for the upgrade.
minimum required size: 60 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
minimum required size: 400 MB
**********************************************************************
**********************************************************************
[Pre-Upgrade Checks]
**********************************************************************
WARNING: --> Enterprise Manager Database Control repository found in the database
Database is using a time zone file older than version 18.
After the upgrade, it is recommended that DBMS_DST package
be used to upgrade the 11.2.0.4.0 database time zone version
to the latest version which comes with the new release.
Please refer to My Oracle Support note number 977512.1 for details.
WARNING: --> RESOURCE_LIMIT default has changed to TRUE starting with 12.1.0.2
Resource limits defined for users via database profiles may not
be currently enforced because RESOURCE_LIMIT init parameter in
this 11.2.0.4.0 database is shown to be defaulted to FALSE.
o RESOURCE_LIMIT in 12.1.0.1 release and earlier is FALSE by
default but is TRUE starting with 12.1.0.2.
o To continue having these resource limits disabled for users
after database upgrade, set RESOURCE_LIMIT to FALSE.
o For example, to change parameter file: update PFILE or use
"ALTER SYSTEM SET RESOURCE_LIMIT=FALSE SCOPE=SPFILE". Note that
the update will not take effect until next database startup.
**********************************************************************
[Pre-Upgrade Recommendations]
**********************************************************************
*****************************************
********* Dictionary Statistics *********
*****************************************
**********************************************************************
[Post-Upgrade Recommendations]
**********************************************************************
*****************************************
******** Fixed Object Statistics ********
*****************************************
**********************************************************************
************ Summary ************
After your database is upgraded and open in normal mode you must run
rdbms/admin/catuppst.sql which executes several required tasks and completes
the upgrade process.
Execute the recommended pre-upgrade actions and shutdown the 11.2.0.4 database
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Copy the password file and init.ora to the Oracle 12c environment location
Edit the oratab file and enter the Oracle 12c home location
Set the Oracle 12c environment and open the database in UPGRADE mode
[oracle@LINT0003 admin]$ sqlplus sys as sysdba
Enter password:
Connected to an idle instance.
Run the catctl.pl to upgrade the database to 12.1.0.2 using the command line method with the parallel upgrade option
------------------------------------------------------
Phases [0-73]
Serial Phase #: 0 Files: 1 Time: 398s
Serial Phase #: 1 Files: 5 Time: 32s
Restart Phase #: 2 Files: 1 Time: 1s
Parallel Phase #: 3 Files: 18 Time: 5s
Restart Phase #: 4 Files: 1 Time: 0s
Serial Phase #: 5 Files: 5 Time: 16s
Serial Phase #: 6 Files: 1 Time: 9s
Serial Phase #: 7 Files: 4 Time: 7s
Restart Phase #: 8 Files: 1 Time: 0s
Parallel Phase #: 9 Files: 62 Time: 17s
Restart Phase #:10 Files: 1 Time: 1s
Serial Phase #:11 Files: 1 Time: 11s
Restart Phase #:12 Files: 1 Time: 0s
Parallel Phase #:13 Files: 91 Time: 6s
Restart Phase #:14 Files: 1 Time: 0s
Parallel Phase #:15 Files: 111 Time: 9s
Restart Phase #:16 Files: 1 Time: 0s
Serial Phase #:17 Files: 3 Time: 1s
Restart Phase #:18 Files: 1 Time: 0s
Parallel Phase #:19 Files: 32 Time: 13s
Restart Phase #:20 Files: 1 Time: 0s
Serial Phase #:21 Files: 3 Time: 6s
Restart Phase #:22 Files: 1 Time: 0s
Parallel Phase #:23 Files: 23 Time: 65s
Restart Phase #:24 Files: 1 Time: 0s
Parallel Phase #:25 Files: 11 Time: 30s
Restart Phase #:26 Files: 1 Time: 0s
Serial Phase #:27 Files: 1 Time: 1s
Restart Phase #:28 Files: 1 Time: 0s
Serial Phase #:30 Files: 1 Time: 0s
Serial Phase #:31 Files: 257 Time: 19s
Serial Phase #:32 Files: 1 Time: 0s
Restart Phase #:33 Files: 1 Time: 0s
Serial Phase #:34 Files: 1 Time: 3s
Restart Phase #:35 Files: 1 Time: 0s
Restart Phase #:36 Files: 1 Time: 0s
Serial Phase #:37 Files: 4 Time: 41s
Restart Phase #:38 Files: 1 Time: 0s
Parallel Phase #:39 Files: 13 Time: 44s
Restart Phase #:40 Files: 1 Time: 0s
Parallel Phase #:41 Files: 10 Time: 5s
Restart Phase #:42 Files: 1 Time: 0s
Serial Phase #:43 Files: 1 Time: 4s
Restart Phase #:44 Files: 1 Time: 0s
Serial Phase #:45 Files: 1 Time: 10s
Serial Phase #:46 Files: 1 Time: 0s
Restart Phase #:47 Files: 1 Time: 0s
Serial Phase #:48 Files: 1 Time: 89s
Restart Phase #:49 Files: 1 Time: 0s
Serial Phase #:50 Files: 1 Time: 33s
Restart Phase #:51 Files: 1 Time: 0s
Serial Phase #:52 Files: 1 Time: 0s
Restart Phase #:53 Files: 1 Time: 0s
Serial Phase #:54 Files: 1 Time: 84s
Restart Phase #:55 Files: 1 Time: 0s
Serial Phase #:56 Files: 1 Time: 61s
Restart Phase #:57 Files: 1 Time: 0s
Serial Phase #:58 Files: 1 Time: 0s
Restart Phase #:59 Files: 1 Time: 0s
Serial Phase #:60 Files: 1 Time: 0s
Restart Phase #:61 Files: 1 Time: 0s
Serial Phase #:62 Files: 1 Time: 155s
Restart Phase #:63 Files: 1 Time: 0s
Serial Phase #:64 Files: 1 Time: 2s
Serial Phase #:65 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/dbhome_1/lib; export
LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
-I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose -upgrade_mode_only >
/tmp/catupgrd_datapatch_upgrade.log 2> /tmp/catupgrd_datapatch_upgrade.err
returned from sqlpatch
Time: 28s
Serial Phase #:66 Files: 1 Time: 39s
Serial Phase #:68 Files: 1 Time: 0s
Serial Phase #:69 Files: 1 Calling sqlpatch with LD_LIBRARY_PATH=/u01/app/oracle/product/12.1.0/dbhome_1/lib; export
LD_LIBRARY_PATH;/u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl -I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin
-I /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/../../sqlpatch/sqlpatch.pl -verbose > /tmp/catupgrd_datapatch_normal.log
2> /tmp/catupgrd_datapatch_normal.err
returned from sqlpatch
Time: 35s
Serial Phase #:70 Files: 1 Time: 9s
Serial Phase #:71 Files: 1 Time: 0s
Serial Phase #:72 Files: 1 Time: 0s
Serial Phase #:73 Files: 1 Time: 19s
Check the component upgrade status by reviewing the upgrade log files
Elapsed: 00:00:00.08
Grand Total Upgrade Time: [0d:0h:21m:50s]