Minimal Downtime Cross Platform Migration and Database Upgrade

Total Page:16

File Type:pdf, Size:1020Kb

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.

This is the environment

Site A : Windows 64 bit Oracle database 11.2.0.4 (testdb)

Site B: OEL 6.3 Oracle database 12.1.0.2 (testdb12)

Site A: This is the database file layout on Windows

SQL> select name from v$datafile;

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

On Site B these will be the location for the data files

/u01/app/oracle/oradata/testdb12

/u02/app/oracle/oradata/testdb12

Site A: This is the location of the redo log files

SQL> select member from v$logfile;

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/

PART 1 - Data Guard Configuration Site B: Add a static entry in the listener.ora

(SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = testdb12) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = testdb12) ) )

Site B: Reload the listener

[oracle@LINT0003 admin]$ lsnrctl reload

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 19-JAN-2015 09:27:18

Copyright (c) 1991, 2014, Oracle. All rights reserved.

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

[oracle@LINT0003 admin]$ cd $ORACLE_HOME

[oracle@LINT0003 dbhome_1]$ pwd /u01/app/oracle/product/11.2.0/dbhome_1

[oracle@LINT0003 dbhome_1]$ cd dbs [oracle@LINT0003 dbs]$ orapwd file=orapwtestdb12 password=Oracle#123

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/'

*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES, ALL_ROLES) DB_UNIQUE_NAME=testdb12' *.fal_server='testdb'

*.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) ) )

Site B: Start the instance in NOMOUNT state

[oracle@LINT0003 dbs]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 19 10:00:02 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved.

Enter password: Connected to an idle instance.

SQL> startup nomount; ORACLE instance started.

Total System Global Area 1068937216 bytes Fixed Size 2260088 bytes Variable Size 671089544 bytes Database Buffers 390070272 bytes Redo Buffers 5517312 bytes

Site A: Connect via RMAN to target and auxiliary destination

C:\Users\soorg9>rman target sys/Oracle#123 auxiliary sys/Oracle#123@testdb12

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 19 10:03:20 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTDB (DBID=2652718402) connected to auxiliary database: TESTDB (not mounted)

This is the RMAN command we will run 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';

9> SET NEWNAME FOR DATAFILE 5 TO '/u02/app/oracle/oradata/testdb12/EXAMPLE01.DBF '; 10> SET NEWNAME FOR TEMPFILE 1 TO '/u02/app/oracle/oradata/testdb12/TEMP01.DBF';

11> DUPLICATE TARGET DATABASE 12> FOR STANDBY 13> FROM ACTIVE DATABASE 14> DORECOVER; 15> } using target database control file instead of recovery catalog allocated channel: c1 channel c1: SID=3 device type=DISK allocated channel: c2 channel c2: SID=19 device type=DISK allocated channel: c3 channel c3: SID=129 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

Starting Duplicate Db at 19-JAN-15 contents of Memory Script: { backup as copy reuse targetfile 'J:\oracle\product\11.2.0.4\dbhome_1\DATABASE\PWDtestdb.ORA' auxi liary format '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtestdb12' ; } executing Memory Script

Starting backup at 19-JAN-15 Finished backup at 19-JAN-15 contents of Memory Script: { backup as copy current controlfile for standby auxiliary format '/u01/app/or acle/oradata/testdb12/control01.ctl'; } executing Memory Script

Starting backup at 19-JAN-15 channel c1: starting datafile copy copying standby control file output file name=J:\ORACLE\PRODUCT\11.2.0.4\DBHOME_1\DATABASE\SNCFTESTDB.ORA tag =TAG20150119T105153 RECID=7 STAMP=869395914 channel c1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 19-JAN-15 contents of Memory Script: { sql clone 'alter database mount standby database'; } executing Memory Script sql statement: alter database mount standby database contents of Memory Script: { set newname for tempfile 1 to "/u02/app/oracle/oradata/testdb12/TEMP01.DBF"; switch clone tempfile all; 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"; backup as copy reuse datafile 1 auxiliary format "/u01/app/oracle/oradata/testdb12/SYSTEM01.DBF" datafile 2 auxiliary format "/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF" datafile 3 auxiliary format "/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF" datafile 4 auxiliary format "/u01/app/oracle/oradata/testdb12/USERS01.DBF" datafile 5 auxiliary format "/u01/app/oracle/oradata/testdb12/EXAMPLE01.DBF" ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to /u01/app/oracle/oradata/testdb12/TEMP01.DBF in control fil e executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME

Starting backup at 19-JAN-15 channel c1: starting datafile copy input datafile file number=00001 name=F:\ORADATA\TESTDB\SYSTEM01.DBF channel c2: starting datafile copy input datafile file number=00002 name=F:\ORADATA\TESTDB\SYSAUX01.DBF output file name=/u01/app/oracle/oradata/testdb12/SYSTEM01.DBF tag=TAG20150119T1 05159 channel c1: datafile copy complete, elapsed time: 00:00:07 channel c1: starting datafile copy input datafile file number=00005 name=F:\ORADATA\TESTDB\EXAMPLE01.DBF output file name=/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF tag=TAG20150119T1 05159 channel c2: datafile copy complete, elapsed time: 00:00:07 channel c2: starting datafile copy input datafile file number=00003 name=F:\ORADATA\TESTDB\UNDOTBS01.DBF output file name=/u02/app/oracle/oradata/testdb12/EXAMPLE01.DBF tag=TAG20150119T 105159 channel c1: datafile copy complete, elapsed time: 00:00:03 channel c1: starting datafile copy input datafile file number=00004 name=F:\ORADATA\TESTDB\USERS01.DBF output file name=/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF tag=TAG20150119T 105159 channel c2: datafile copy complete, elapsed time: 00:00:04 output file name=/u02/app/oracle/oradata/testdb12/USERS01.DBF tag=TAG20150119T10 5159 channel c1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 19-JAN-15 sql statement: alter system archive log current contents of Memory Script: { backup as copy reuse archivelog like "J:\ORACLE\FAST_RECOVERY_AREA\TESTDB\ARCHIVELOG\2015_01_19\O 1_MF_1_8_BCRWBWB3_.ARC" auxiliary format "/u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_8_%u _.arc" ; catalog clone recovery area; switch clone datafile all; } executing Memory Script

Starting backup at 19-JAN-15 channel c1: starting archived log copy input archived log thread=1 sequence=8 RECID=3 STAMP=869395932 output file name=/u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_ 19/o1_mf_1_8_12pt3res_.arc RECID=0 STAMP=0 channel c1: archived log copy complete, elapsed time: 00:00:01 Finished backup at 19-JAN-15 searching for all files in the recovery area

List of Files Unknown to the Database ======File Name: /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_ mf_1_8_12pt3res_.arc cataloging files... cataloging done

List of Cataloged Files ======File Name: /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_ mf_1_8_12pt3res_.arc datafile 1 switched to datafile copy input datafile copy RECID=7 STAMP=869395871 file name=/u01/app/oracle/oradata/te stdb12/SYSTEM01.DBF datafile 2 switched to datafile copy input datafile copy RECID=8 STAMP=869395871 file name=/u01/app/oracle/oradata/te stdb12/SYSAUX01.DBF datafile 3 switched to datafile copy input datafile copy RECID=9 STAMP=869395871 file name=/u01/app/oracle/oradata/te stdb12/UNDOTBS01.DBF datafile 4 switched to datafile copy input datafile copy RECID=10 STAMP=869395871 file name=/u02/app/oracle/oradata/t estdb12/USERS01.DBF datafile 5 switched to datafile copy input datafile copy RECID=11 STAMP=869395871 file name=/u02/app/oracle/oradata/t estdb12/EXAMPLE01.DBF contents of Memory Script: { set until scn 972136; recover standby clone database delete archivelog ; } executing Memory Script executing command: SET until clause

Starting recover at 19-JAN-15 starting media recovery 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

[oracle@LINT0003 testdb12]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 19 10:53:54 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved.

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> select open_mode,database_role from v$database;

OPEN_MODE DATABASE_ROLE ------MOUNTED PHYSICAL STANDBY

Site A: Add the parameter for Redo Transport

SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=testdb12 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testdb12' scope=both;

System altered.

SQL> select destination,status,error from v$archive_dest_status where rownum <3;

DESTINATION ------

STATUS ERROR ------J:\oracle\product\11.2.0.4\dbhome_1\RDBMS VALID testdb12 VALID

Site A: Simulate some changes on the Primary database. SQL> conn system/Oracle#123 Connected.

SQL> create table myobjects 2 tablespace users 3 as select * from dba_objects;

Table created.

SQL> conn / as sysdba Connected.

SQL> alter system switch logfile;

System altered.

Site B: Open the standby database and start the managed recovery

SQL> alter database open;

Database altered.

SQL> recover managed standby database disconnect from session; Media recovery complete. SQL> select count(*) from system.myobjects;

COUNT(*) ------86736

SQL> !ps -ef |grep mrp oracle 6360 1 0 10:59 ? 00:00:00 ora_mrp0_testdb12 oracle 6436 5425 0 10:59 pts/0 00:00:00 /bin/bash -c ps -ef |grep mrp

SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#,BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS ------ARCH CONNECTED 0 0 0 0 ARCH CONNECTED 0 0 0 0 ARCH CONNECTED 0 0 0 0 ARCH CONNECTED 0 0 0 0 RFS IDLE 0 0 0 0 RFS IDLE 1 12 2863 1 RFS IDLE 0 0 0 0 MRP0 WAIT_FOR_LOG 1 12 0 0

SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;

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

Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_0 1_19/o1_mf_1_10_bcrwly09_.arc

Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_0 1_19/o1_mf_1_11_bcrwlxxj_.arc

Media Recovery Waiting for thread 1 sequence 12 (in transit)

DATABASE/APPLICATION OUTAGE STARTS NOW!!

Site B: Cancel managed recovery, activate the standby database and make it primary

SQL> alter database recover managed standby database cancel;

Database altered.

SQL> alter database recover managed standby database finish;

Database altered.

SQL> alter database activate physical standby database;

Database altered.

SQL> select name, open_mode, database_role from v$database;

NAME OPEN_MODE DATABASE_ROLE ------TESTDB MOUNTED PRIMARY SQL> alter database open;

Database altered.

SQL> select name, open_mode, database_role from v$database;

NAME OPEN_MODE DATABASE_ROLE ------TESTDB READ WRITE PRIMARY

PART 2 – Oracle 12c Database Upgrade

Note: All actions now performed on Site B….

Run the 12c preupgrd.sql script in the 11.2.0.4 environment

[oracle@IOMDC-LINT0004 admin]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 21 08:12:16 2015

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

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

Loading Pre-Upgrade Package...

*************************************************************************** Executing Pre-Upgrade Checks in TESTDB... ***************************************************************************

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

====>> ERRORS FOUND for TESTDB<<====

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.

1) Check Tag: PURGE_RECYCLEBIN Check Summary: Check that recycle bin is empty prior to upgrade Fixup Summary: "The recycle bin will be purged."

You MUST resolve the above error prior to upgrade

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

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

====>> PRE-UPGRADE RESULTS for TESTDB <<====

ACTIONS REQUIRED:

1. Review results of the pre-upgrade checks: /u01/app/oracle/cfgtoollogs/testdb/preupgrade/preupgrade.log 2. Execute in the SOURCE environment BEFORE upgrade: /u01/app/oracle/cfgtoollogs/testdb/preupgrade/preupgrade_fixups.sql

3. Execute in the NEW environment AFTER upgrade: /u01/app/oracle/cfgtoollogs/testdb/preupgrade/postupgrade_fixups.sql

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

*************************************************************************** Pre-Upgrade Checks in TESTDB Completed. ***************************************************************************

Review the preupgrade.log file

[oracle@IOMDC-LINT0004 admin]$ cat /u01/app/oracle/cfgtoollogs/testdb/preupgrade/preupgrade.log Oracle Database Pre-Upgrade Information Tool 01-21-2015 08:12:41 Script Version: 12.1.0.2.0 Build: 006 ********************************************************************** Database Name: PDEV7 Container Name: Not Applicable in Pre-12.1 database Container ID: Not Applicable in Pre-12.1 database Version: 11.2.0.4.0 Compatible: 11.2.0.4.0 Blocksize: 8192 Platform: Linux x86 64-bit Timezone file: V1 ********************************************************************** [Update parameters] [No parameters to update] ********************************************************************** ********************************************************************** [Renamed Parameters] [No Renamed Parameters in use] ********************************************************************** ********************************************************************** [Obsolete/Deprecated Parameters] --> sec_case_sensitive_logon 12.1 DESUPPORTED

[Changes required in Oracle Database init.ora or spfile]

********************************************************************** [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

[No adjustments recommended]

********************************************************************** ********************************************************************** [Pre-Upgrade Checks] ********************************************************************** WARNING: --> Enterprise Manager Database Control repository found in the database

In Oracle Database 12c, Database Control is removed during the upgrade. To save time during the Upgrade, this action can be done prior to upgrading using the following steps after copying rdbms/admin/emremove.sql from the new Oracle home - Stop EM Database Control: $> emctl stop dbconsole

- Connect to the Database using the SYS account AS SYSDBA:

SET ECHO ON; SET SERVEROUTPUT ON; @emremove.sql Without the set echo and serveroutput commands you will not be able to follow the progress of the script.

WARNING: --> Database contains INVALID objects prior to upgrade

The list of invalid SYS/SYSTEM objects was written to registry$sys_inv_objs. The list of non-SYS/SYSTEM objects was written to registry$nonsys_inv_objs unless there were over 5000. Use utluiobj.sql after the upgrade to identify any new invalid objects due to the upgrade.

INFORMATION: --> Older Timezone in use

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.

ERROR: --> RECYCLE_BIN not empty. Your recycle bin contains 98 object(s). It is REQUIRED that the recycle bin is empty prior to upgrading. Immediately before performing the upgrade, execute the following command: EXECUTE dbms_preup.purge_recyclebin_fixup;

INFORMATION: --> Oracle Application Express (APEX) can be manually upgraded prior to database upgrade APEX is currently at version 4.2.1.00.08 and will need to be upgraded to APEX version 4.2.5 in the new release. Note 1: To reduce database upgrade time, APEX can be manually upgraded outside of and prior to database upgrade. Note 2: See MOS Note 1088970.1 for information on APEX installation upgrades.

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 ********* *****************************************

Please gather dictionary statistics 24 hours prior to upgrading the database. To gather dictionary statistics execute the following command while connected as SYSDBA: EXECUTE dbms_stats.gather_dictionary_stats;

^^^ MANUAL ACTION SUGGESTED ^^^ ********************************************************************** [Post-Upgrade Recommendations] **********************************************************************

***************************************** ******** Fixed Object Statistics ******** *****************************************

Please create stats on fixed objects two weeks after the upgrade using the command: EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

^^^ MANUAL ACTION SUGGESTED ^^^

********************************************************************** ************ Summary ************

1 ERROR exist that must be addressed prior to performing your upgrade. 3 WARNINGS that Oracle suggests are addressed to improve database performance. 2 INFORMATIONAL messages that should be reviewed prior to your upgrade.

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.

You should follow that with the execution of rdbms/admin/utlrp.sql, and a comparison of invalid objects before and after the upgrade using rdbms/admin/utluiobj.sql

If needed you may want to upgrade your timezone data using the process described in My Oracle Support note 1509653.1 *********************************** [oracle@IOMDC-LINT0004 admin]$

Execute the recommended pre-upgrade actions and shutdown the 11.2.0.4 database

[oracle@IOMDC-LINT0004 admin]$ sqlplus sys as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 21 08:16:14 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved.

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> EXECUTE dbms_preup.purge_recyclebin_fixup;

PL/SQL procedure successfully completed.

SQL> EXECUTE dbms_stats.gather_dictionary_stats;

PL/SQL procedure successfully completed.

SQL> SET ECHO ON; SET SERVEROUTPUT ON; @emremove.sql SQL> SQL> SQL> Rem SQL> Rem $Header: rdbms/admin/emremove.sql /main/2 2012/07/27 01:19:53 spramani Exp $ SQL> Rem SQL> Rem emremove.sql SQL> Rem SQL> Rem Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. SQL> Rem SQL> Rem NAME SQL> Rem emremove.sql - This script removes EM Schema from RDBMS

…. ….

Dropping synonym : SMP_EMD_STRING_ARRAY_ARRAY ... Dropping synonym : SMP_EMD_TARGET_OBJ ... Dropping synonym : SMP_EMD_TARGET_OBJ_ARRAY ... Finished phase 5 Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ... Finished phase 6 The Oracle Enterprise Manager related schemas and objects are dropped. Do the manual steps to studown the DB Control if not done before running this script and then delete the DB Control configuration files

PL/SQL procedure successfully completed.

SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.

Copy the password file and init.ora to the Oracle 12c environment location

[oracle@LINT0003 dbs]$ cp inittestdb12.ora /u01/app/oracle/product/12.1.0/dbhome_1/dbs [oracle@LINT0003 dbs]$ cp orapwtestdb12 /u01/app/oracle/product/12.1.0/dbhome_1/dbs

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

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 19 11:16:58 2015

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

Enter password: Connected to an idle instance.

SQL> startup upgrade; ORACLE instance started.

Total System Global Area 1073741824 bytes Fixed Size 2932632 bytes Variable Size 679477352 bytes Database Buffers 385875968 bytes Redo Buffers 5455872 bytes Database mounted. Database opened.

Run the catctl.pl to upgrade the database to 12.1.0.2 using the command line method with the parallel upgrade option

[oracle@IOMDC-LINT0004 admin]$ $ORACLE_HOME/perl/bin/perl catctl.pl -n 4 -l /tmp catupgrd.sql

Argument list for [catctl.pl] SQL Process Count n = 4 SQL PDB Process Count N = 0 Input Directory d = 0 Phase Logging Table t = 0 Log Dir l = /tmp Script s = 0 Serial Run S = 0 Upgrade Mode active M = 0 Start Phase p = 0 End Phase P = 0 Log Id i = 0 Run in c = 0 Do not run in C = 0 Echo OFF e = 1 No Post Upgrade x = 0 Reverse Order r = 0 Open Mode Normal o = 0 Debug catcon.pm z = 0 Debug catctl.pl Z = 0 Display Phases y = 0 Child Process I = 0 catctl.pl version: 12.1.0.2.0 Oracle Base = /u01/app/oracle

Analyzing file catupgrd.sql Log files in /tmp catcon: ALL catcon-related output will be written to /tmp/catupgrd_catcon_22992.lst catcon: See /tmp/catupgrd*.log files for output generated by scripts catcon: See /tmp/catupgrd_*.lst files for spool files, if any Number of Cpus = 4 SQL Process Count = 4

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

Grand Total Time: 1310s

LOG FILES: (catupgrd*.log)

Upgrade Summary Report Located in: /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/testdb/upgrade/upg_summary.log

Grand Total Upgrade Time: [0d:0h:21m:50s] [oracle@IOMDC-LINT0004 admin]$

Note the upgrade log files located in /tmp

[oracle@IOMDC-LINT0004 tmp]$ ls -lrt cat* -rw-r--r-- 1 oracle dba 358 Jan 21 08:27 catupgrd_catcon_22992.lst -rw-r--r-- 1 oracle dba 0 Jan 21 08:46 catupgrd_datapatch_upgrade.err -rw-r--r-- 1 oracle dba 396 Jan 21 08:46 catupgrd_datapatch_upgrade.log -rw-r--r-- 1 oracle dba 0 Jan 21 08:48 catupgrd_datapatch_normal.err -rw-r--r-- 1 oracle dba 396 Jan 21 08:48 catupgrd_datapatch_normal.log -rw-r--r-- 1 oracle dba 6298525 Jan 21 08:48 catupgrd1.log -rw-r--r-- 1 oracle dba 5059334 Jan 21 08:48 catupgrd2.log -rw-r--r-- 1 oracle dba 5742452 Jan 21 08:48 catupgrd3.log -rw-r--r-- 1 oracle dba 45146507 Jan 21 08:49 catupgrd0.log

Check the component upgrade status by reviewing the upgrade log files

Oracle Database 12.1 Post-Upgrade Status Tool 01-21-2015 08:48:44 Component Current Version Elapsed Time Name Status Number HH:MM:SS

Oracle Server UPGRADED 12.1.0.2.0 00:12:33 JServer JAVA Virtual Machine VALID 12.1.0.2.0 00:01:28 Oracle Workspace Manager VALID 12.1.0.2.0 00:00:50 Oracle XDK VALID 12.1.0.2.0 00:00:32 Oracle XML Database VALID 12.1.0.2.0 00:01:23 Oracle Database Java Packages VALID 12.1.0.2.0 00:00:10 Oracle Application Express VALID 4.2.5.00.08 00:02:22 Final Actions 00:01:06 Post Upgrade 00:00:07

Total Upgrade Time: 00:20:50

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.08 Grand Total Upgrade Time: [0d:0h:21m:50s]

Execute the following post-upgrade steps

 Compile invalid objects via utlrp.sql

 Run utluiobj.sql to identify any objects invalidated by the upgrade process

 Gather fixed object statistics via EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

 Upgrade timezone data

 Change COMPATIBLE parameter to 12.1.0.2

Recommended publications