Upload
trinhkhanh
View
228
Download
1
Embed Size (px)
Citation preview
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.DBFF:\ORADATA\TESTDB\SYSAUX01.DBFF:\ORADATA\TESTDB\UNDOTBS01.DBFF:\ORADATA\TESTDB\USERS01.DBFF:\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.LOGG:\ORADATA\TESTDB\REDO02.LOGG:\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]$ . oraenvORACLE_SID = [testdb] ? testdb12The 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 bytesFixed Size 2260088 bytesVariable Size 671089544 bytesDatabase Buffers 390070272 bytesRedo 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 DATABASEFOR STANDBYFROM ACTIVE DATABASEDORECOVER;}
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 DATABASE12> FOR STANDBY13> FROM ACTIVE DATABASE14> DORECOVER;15> }
using target database control file instead of recovery catalogallocated channel: c1channel c1: SID=3 device type=DISK
allocated channel: c2channel c2: SID=19 device type=DISK
allocated channel: c3channel 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' auxiliary format'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtestdb12' ;}executing Memory Script
Starting backup at 19-JAN-15Finished backup at 19-JAN-15
contents of Memory Script:{ backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/testdb12/control01.ctl';}executing Memory Script
Starting backup at 19-JAN-15channel c1: starting datafile copycopying standby control fileoutput file name=J:\ORACLE\PRODUCT\11.2.0.4\DBHOME_1\DATABASE\SNCFTESTDB.ORA tag=TAG20150119T105153 RECID=7 STAMP=869395914channel c1: datafile copy complete, elapsed time: 00:00:01Finished 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" datafile2 auxiliary format"/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF" datafile3 auxiliary format"/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF" datafile4 auxiliary format"/u01/app/oracle/oradata/testdb12/USERS01.DBF" datafile5 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 file
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-15channel c1: starting datafile copyinput datafile file number=00001 name=F:\ORADATA\TESTDB\SYSTEM01.DBFchannel c2: starting datafile copyinput datafile file number=00002 name=F:\ORADATA\TESTDB\SYSAUX01.DBFoutput file name=/u01/app/oracle/oradata/testdb12/SYSTEM01.DBF tag=TAG20150119T105159channel c1: datafile copy complete, elapsed time: 00:00:07channel c1: starting datafile copyinput datafile file number=00005 name=F:\ORADATA\TESTDB\EXAMPLE01.DBFoutput file name=/u01/app/oracle/oradata/testdb12/SYSAUX01.DBF tag=TAG20150119T105159channel c2: datafile copy complete, elapsed time: 00:00:07channel c2: starting datafile copyinput datafile file number=00003 name=F:\ORADATA\TESTDB\UNDOTBS01.DBFoutput file name=/u02/app/oracle/oradata/testdb12/EXAMPLE01.DBF tag=TAG20150119T105159channel c1: datafile copy complete, elapsed time: 00:00:03channel c1: starting datafile copyinput datafile file number=00004 name=F:\ORADATA\TESTDB\USERS01.DBFoutput file name=/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBF tag=TAG20150119T105159channel c2: datafile copy complete, elapsed time: 00:00:04output file name=/u02/app/oracle/oradata/testdb12/USERS01.DBF tag=TAG20150119T105159channel c1: datafile copy complete, elapsed time: 00:00:01Finished 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\O1_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-15channel c1: starting archived log copyinput archived log thread=1 sequence=8 RECID=3 STAMP=869395932output file name=/u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_8_12pt3res_.arc RECID=0 STAMP=0channel c1: archived log copy complete, elapsed time: 00:00:01Finished 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_.arccataloging 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 copyinput datafile copy RECID=7 STAMP=869395871 file name=/u01/app/oracle/oradata/testdb12/SYSTEM01.DBFdatafile 2 switched to datafile copyinput datafile copy RECID=8 STAMP=869395871 file name=/u01/app/oracle/oradata/testdb12/SYSAUX01.DBFdatafile 3 switched to datafile copyinput datafile copy RECID=9 STAMP=869395871 file name=/u01/app/oracle/oradata/testdb12/UNDOTBS01.DBFdatafile 4 switched to datafile copyinput datafile copy RECID=10 STAMP=869395871 file name=/u02/app/oracle/oradata/testdb12/USERS01.DBFdatafile 5 switched to datafile copyinput datafile copy RECID=11 STAMP=869395871 file name=/u02/app/oracle/oradata/testdb12/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/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_8_12pt3res_.arcarchived log file name=/u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_8_12pt3res_.arc thread=1 sequence=8media recovery complete, elapsed time: 00:00:00Finished recover at 19-JAN-15Finished Duplicate Db at 19-JAN-15released channel: c1released channel: c2released 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 ProductionWith 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\RDBMSVALID
testdb12VALID
Site A: Simulate some changes on the Primary database.
SQL> conn system/Oracle#123Connected.
SQL> create table myobjects 2 tablespace users 3 as select * from dba_objects;
Table created.
SQL> conn / as sysdbaConnected.
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 mrporacle 6360 1 0 10:59 ? 00:00:00 ora_mrp0_testdb12oracle 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 0ARCH CONNECTED 0 0 0 0ARCH CONNECTED 0 0 0 0ARCH CONNECTED 0 0 0 0RFS IDLE 0 0 0 0RFS IDLE 1 12 2863 1RFS IDLE 0 0 0 0MRP0 WAIT_FOR_LOG 1 12 0 0
SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;
MESSAGE--------------------------------------------------------------------------------ARC0: Archival startedARC1: Archival startedARC2: Archival startedARC1: Becoming the 'no FAL' ARCHARC2: Becoming the heartbeat ARCHARC2: Becoming the active heartbeat ARCHARC3: Archival startedError 12154 received logging on to the standbyFAL[client, ARC0]: Error 12154 connecting to testdb for fetching gap sequenceManaged Standby Recovery not using Real Time ApplyMedia Recovery Complete
MESSAGE--------------------------------------------------------------------------------RFS[1]: Assigned to RFS process 5906Primary database is in MAXIMUM PERFORMANCE modeRFS[2]: Assigned to RFS process 5920RFS[2]: No standby redo logfiles createdRFS[3]: Assigned to RFS process 5922Primary database is in MAXIMUM PERFORMANCE modeRFS[4]: Assigned to RFS process 6249RFS[4]: No standby redo logfiles createdAttempt to start background Managed Standby Recovery processMRP0: Background Managed Standby Recovery process startedManaged Standby Recovery not using Real Time Apply
MESSAGE--------------------------------------------------------------------------------Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_9_bcrwlwfz_.arc
Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_19/o1_mf_1_10_bcrwly09_.arc
Media Recovery Log /u01/app/oracle/fast_recovery_area/TESTDB12/archivelog/2015_01_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 ProductionWith 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.logOracle Database Pre-Upgrade Information Tool 01-21-2015 08:12:41Script 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 toupgrading the database.To gather dictionary statistics execute the following commandwhile 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 weeksafter 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 runrdbms/admin/catuppst.sql which executes several required tasks and completesthe upgrade process.
You should follow that with the execution of rdbms/admin/utlrp.sql, and acomparison of invalid objects before and after the upgrade usingrdbms/admin/utluiobj.sql
If needed you may want to upgrade your timezone data using the processdescribed 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 ProductionWith 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.sqlSQL> SQL> SQL> RemSQL> Rem $Header: rdbms/admin/emremove.sql /main/2 2012/07/27 01:19:53 spramani Exp $SQL> RemSQL> Rem emremove.sqlSQL> RemSQL> Rem Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.SQL> RemSQL> Rem NAMESQL> 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 5Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ...Finished phase 6The Oracle Enterprise Manager related schemas and objects are dropped.Do the manual steps to studown the DB Control if not done before running thisscript 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 bytesFixed Size 2932632 bytesVariable Size 679477352 bytesDatabase Buffers 385875968 bytesRedo Buffers 5455872 bytesDatabase 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 = 4SQL PDB Process Count N = 0Input Directory d = 0Phase Logging Table t = 0Log Dir l = /tmpScript s = 0Serial Run S = 0Upgrade Mode active M = 0Start Phase p = 0End Phase P = 0Log Id i = 0Run in c = 0
Do not run in C = 0Echo OFF e = 1No Post Upgrade x = 0Reverse Order r = 0Open Mode Normal o = 0Debug catcon.pm z = 0Debug catctl.pl Z = 0Display Phases y = 0Child Process I = 0
catctl.pl version: 12.1.0.2.0Oracle Base = /u01/app/oracle
Analyzing file catupgrd.sqlLog files in /tmpcatcon: ALL catcon-related output will be written to /tmp/catupgrd_catcon_22992.lstcatcon: See /tmp/catupgrd*.log files for output generated by scriptscatcon: See /tmp/catupgrd_*.lst files for spool files, if anyNumber of Cpus = 4SQL Process Count = 4
------------------------------------------------------Phases [0-73]Serial Phase #: 0 Files: 1 Time: 398sSerial Phase #: 1 Files: 5 Time: 32sRestart Phase #: 2 Files: 1 Time: 1sParallel Phase #: 3 Files: 18 Time: 5sRestart Phase #: 4 Files: 1 Time: 0sSerial Phase #: 5 Files: 5 Time: 16sSerial Phase #: 6 Files: 1 Time: 9sSerial Phase #: 7 Files: 4 Time: 7sRestart Phase #: 8 Files: 1 Time: 0sParallel Phase #: 9 Files: 62 Time: 17sRestart Phase #:10 Files: 1 Time: 1sSerial Phase #:11 Files: 1 Time: 11sRestart Phase #:12 Files: 1 Time: 0sParallel Phase #:13 Files: 91 Time: 6sRestart Phase #:14 Files: 1 Time: 0sParallel Phase #:15 Files: 111 Time: 9sRestart Phase #:16 Files: 1 Time: 0sSerial Phase #:17 Files: 3 Time: 1sRestart Phase #:18 Files: 1 Time: 0sParallel Phase #:19 Files: 32 Time: 13sRestart Phase #:20 Files: 1 Time: 0s
Serial Phase #:21 Files: 3 Time: 6sRestart Phase #:22 Files: 1 Time: 0sParallel Phase #:23 Files: 23 Time: 65sRestart Phase #:24 Files: 1 Time: 0sParallel Phase #:25 Files: 11 Time: 30sRestart Phase #:26 Files: 1 Time: 0sSerial Phase #:27 Files: 1 Time: 1sRestart Phase #:28 Files: 1 Time: 0sSerial Phase #:30 Files: 1 Time: 0sSerial Phase #:31 Files: 257 Time: 19sSerial Phase #:32 Files: 1 Time: 0sRestart Phase #:33 Files: 1 Time: 0sSerial Phase #:34 Files: 1 Time: 3sRestart Phase #:35 Files: 1 Time: 0sRestart Phase #:36 Files: 1 Time: 0sSerial Phase #:37 Files: 4 Time: 41sRestart Phase #:38 Files: 1 Time: 0sParallel Phase #:39 Files: 13 Time: 44sRestart Phase #:40 Files: 1 Time: 0sParallel Phase #:41 Files: 10 Time: 5sRestart Phase #:42 Files: 1 Time: 0sSerial Phase #:43 Files: 1 Time: 4sRestart Phase #:44 Files: 1 Time: 0sSerial Phase #:45 Files: 1 Time: 10sSerial Phase #:46 Files: 1 Time: 0sRestart Phase #:47 Files: 1 Time: 0sSerial Phase #:48 Files: 1 Time: 89sRestart Phase #:49 Files: 1 Time: 0sSerial Phase #:50 Files: 1 Time: 33sRestart Phase #:51 Files: 1 Time: 0sSerial Phase #:52 Files: 1 Time: 0sRestart Phase #:53 Files: 1 Time: 0sSerial Phase #:54 Files: 1 Time: 84sRestart Phase #:55 Files: 1 Time: 0sSerial Phase #:56 Files: 1 Time: 61sRestart Phase #:57 Files: 1 Time: 0sSerial Phase #:58 Files: 1 Time: 0sRestart Phase #:59 Files: 1 Time: 0sSerial Phase #:60 Files: 1 Time: 0sRestart Phase #:61 Files: 1 Time: 0sSerial Phase #:62 Files: 1 Time: 155sRestart Phase #:63 Files: 1 Time: 0sSerial 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.errreturned from sqlpatch Time: 28sSerial Phase #:66 Files: 1 Time: 39sSerial Phase #:68 Files: 1 Time: 0sSerial 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.errreturned from sqlpatch Time: 35sSerial Phase #:70 Files: 1 Time: 9sSerial Phase #:71 Files: 1 Time: 0sSerial Phase #:72 Files: 1 Time: 0sSerial 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 TimeName Status Number HH:MM:SS
Oracle Server UPGRADED 12.1.0.2.0 00:12:33JServer JAVA Virtual Machine VALID 12.1.0.2.0 00:01:28Oracle Workspace Manager VALID 12.1.0.2.0 00:00:50Oracle XDK VALID 12.1.0.2.0 00:00:32Oracle XML Database VALID 12.1.0.2.0 00:01:23Oracle Database Java Packages VALID 12.1.0.2.0 00:00:10Oracle Application Express VALID 4.2.5.00.08 00:02:22Final Actions 00:01:06Post Upgrade 00:00:07
Total Upgrade Time: 00:20:50
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.08Grand 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