Total Pageviews

Thursday, May 10, 2018

Upgrade Oracle database from 11.2.0.4 to 12.1.0.1


         



Direct Upgrade to 12.1.0.1 is possible only when we upgrade from 10.2.0.5/11.1.0.7/11.2.0.2. If we are running in lower version than first we have to upgrade to required version.
Here I am using Out-of-Place upgrade method. In this method we have to install new binaries in separate Oracle home that upgrade the database using DBUA utility.

Login to the server from putty:

Lets check the version of Linux: ( Linux kernel version is 2.6 and intel 64 bit server)
[oracle@oracleforensics ~]$ uname –r
2.6.32-642.el6.x86_64

[oracle@oracleforensics ~]$ uname –p
x86_64

[oracle@oracleforensics ~]$ cat /etc/oratab

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/11.2.0.4/dbhome_1:N

As we can see we have orcl database running on 11g Release 2

[oracle@oracleforensics ~]$ cat /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

To check my current home check the entry in inventory.xml as below:

[oracle@oracleforensics ~]$ cat /u01/app/oraInventory/ContentsXML/inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2014, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.1.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.04/dbhome_1" TYPE="O" IDX="1"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</INVENTORY>

We can check our ORCL instance is up and running as below
 [oracle@oracleforensics ~]$ ps -ef |grep pmon
oracle    8329     1  0 May07 ?        00:00:05 ora_pmon_orcl
oracle   23902 22695  0 19:14 pts/0    00:00:00 grep pmon

Let’s logging to the database

[oracle@oracleforensics ~]$ . oraenv
ORACLE_SID = [orcl] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracleforensics ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue May 8 19:15:25 2018
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

[oracle@oracleforensics ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 08-MAY-2018 19:18:59

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= oracleforensics)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4- Production
Start Date                07-MAY-2018 17:45:25
Uptime                    1 days 1 hr. 33 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracleforensics/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= oracleforensics)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=oracleforensics)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracleforensics)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

Our database ORCL has one handler and it is running on Listener version 11.2.0.4

We can also check the status of enterprise manager database console and notice that it is running.

[oracle@oracleforensics database]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://172.29.58.77:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.4/dbhome_1/172.29.58.77_orcl/sysman/log

Now we will login to sql prompt and query the below commands.

[oracle@oracleforensics ~]$ . oraenv
ORACLE_SID = [orcl] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oracleforensics ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue May 8 19:30:04 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select instance_name,host_name,version,status from v$instance;

INSTANCE_NAME    HOST_NAME                                                VERSION           STATUS
---------------- ------------------------------------------------------------ -----------------       ------------
orcl             oracleforensics                                                  11.2.0.4.0              OPEN

SQL>
col COMP_NAME form a30
select comp_name,version,status from dba_registry order by status;

COMP_NAME                      VERSION                        STATUS
----------                     ------------               --------------
OWB                            11.2.0.4.0                     VALID
Oracle OLAP API                11.2.0.4.0                     VALID
Oracle Enterprise Manager      11.2.0.4.0                     VALID
OLAP Catalog                   11.2.0.4.0                     VALID
Spatial                        11.2.0.4.0                     VALID
Oracle Multimedia              11.2.0.4.0                     VALID
Oracle XML Database            11.2.0.4.0                     VALID
Oracle Text                    11.2.0.4.0                     VALID
Oracle Expression Filter       11.2.0.4.0                     VALID
Oracle Rules Manager           11.2.0.4.0                     VALID
Oracle Workspace Manager       11.2.0.4.0                     VALID
Oracle Database Catalog Views  11.2.0.4.0                     VALID
Oracle Database Packages and T 11.2.0.4.0                     VALID
ypes

JServer JAVA Virtual Machine   11.2.0.4.0                     VALID
Oracle XDK                     11.2.0.4.0                     VALID
Oracle Database Java Packages  11.2.0.4.0                     VALID
OLAP Analytic Workspace        11.2.0.4.0                     VALID
Oracle Application Express     3.2.1.00.12                    VALID

18 rows selected.

Oracle Application Express and OWB component can be upgrade independently

Now we have to install oracle 12c software in separate home.

Create the directory where we will install the binaries.

[oracle@oracleforensics ~]$ mkdir –p /u01/app/oracle/product/12.1.0/dbhome_1

[oracle@oracleforensics u02]$ ls –lrth
-rw-r--r--. 1 root   root     968M Dec 31 16:58 linuxamd64_12102_database_2of2.zip
-rw-r--r--. 1 root   root     1.6G Dec 31 17:08 linuxamd64_12102_database_1of2.zip

[oracle@oracleforensics u02]$ unzip linuxamd64_12102_database_1of2.zip
[oracle@oracleforensics u02]$ unzip linuxamd64_12102_database_2of2.zip

[oracle@oracleforensics u02]$ ls –lrth
-rw-r--r--. 1 root   root     968M Dec 31 16:58 linuxamd64_12102_database_2of2.zip
-rw-r--r--. 1 root   root     1.6G Dec 31 17:08 linuxamd64_12102_database_1of2.zip
drwxr-xr-x. 7 oracle oinstall 4.0K Jul  7  2014 database

[oracle@oracleforensics u02]$ cd database
[oracle@oracleforensics database]$ ls -lrth
total 36K
-rwxr-xr-x.  1 oracle oinstall  500 Feb  7  2013 welcome.html
-rwxr-xr-x.  1 oracle oinstall 8.4K Jul  7  2014 runInstaller
drwxr-xr-x.  2 oracle oinstall 4.0K Jul  7  2014 rpm
drwxrwxr-x.  2 oracle oinstall 4.0K Jul  7  2014 sshsetup
drwxrwxr-x.  2 oracle oinstall 4.0K Jul  7  2014 response
drwxr-xr-x. 14 oracle oinstall 4.0K Jul  7  2014 stage
drwxr-xr-x.  4 oracle oinstall 4.0K May  7 15:41 install

[oracle@oracleforensics database]$ ./runInstaller

Uncheck the checked box:





Default Oracle base and home location looks good.





This can be ignored and check the ignore check button:


Press install


As indicated by installer, login to root user and execute the root.sh script.

[oracle@oracleforensics database]$ su -
Password:
[root@oracleforensics ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh


Let’s return to oracle installer and complete this installation:


Now we have to login the database environment

[oracle@oracleforensics database]$ . oraenv
ORACLE_SID = [orcl] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle

I will check status of database enterprise manager console and notice that it is running.

[oracle@oracleforensics database]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://172.29.58.77:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/12.1.0.2/db_1/172.29.58.77_orcl/sysman/log

Staring with oracle 12c Oracle has introduce Oracle Enterprise Database Express 12c this will replace Oracle Enterprise Manager database console. It is recommended to remove Enterprise Manager configuration from 11g database before upgraded to oracle 12c. Below are the steps for the same:

Stop the enterprise database console

[oracle@oracleforensics database]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
https://172.29.58.77:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
 ...  Stopped.

Lets login to the database

[oracle@oracleforensics database]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue May 8 20:38:33 2018
Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select instance_name,host_name,version,status from v$instance;

INSTANCE_NAME    HOST_NAME                                                        VERSION           STATUS
---------------- ---------------------------------------------------------------- ----------------- ------------
orcl             oracleforensics                                                  11.2.0.4.0        OPEN


As you can see ORCL database version is 11.2.0.4. I will remove Enterprise Manager database console configuration from this database. For this we have to execute below command from new oracle 12c home.

SQL>@/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/emremove.sql

Now database Enterprise Manager Database console configuration is removed from this database.

Now stop the listener

[oracle@oracleforensics ~]$ lsnrctl stop

Setup oracle 12c environment pointing to ORACLE 12c Home.

[oracle@oracleforensics ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

Open Net Configuration Assistant (NETCA)
 [oracle@oracleforensics ~]$ /u01/app/oracle/product/12.1.0/dbhome_1/bin/netca &






Select ‘NO’ and finish.






Now start the upgradation

[oracle@oracleforensics ~]$ /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbua &






Choose the option Upgrade Oracle database



Press next and finish.

SQL> select instance_name,host_name,version,status from v$instance;

INSTANCE_NAME    HOST_NAME                                                        VERSION           STATUS
---------------- ---------------------------------------------------------------- ----------------- ------------
orcl             oracleforensics                                                  12.1.0.2.0        OPEN

SQL> col COMP_NAME form a30
select comp_name,version,status from dba_registry order by status;
SQL>
COMP_NAME                      VERSION                        STATUS
------------------------------ ------------------------------ ------OLAP Catalog                   11.2.0.4.0                     OPTION OFF
Oracle OLAP API                12.1.0.2.0                     VALID
Spatial                        12.1.0.2.0                     VALID
Oracle Multimedia              12.1.0.2.0                     VALID
Oracle XML Database            12.1.0.2.0                     VALID
Oracle Text                    12.1.0.2.0                     VALID
Oracle Workspace Manager       12.1.0.2.0                     VALID
Oracle Database Catalog Views  12.1.0.2.0                     VALID
Oracle Database Packages and T 12.1.0.2.0                     VALID
ypes

JServer JAVA Virtual Machine   12.1.0.2.0                     VALID
Oracle XDK                     12.1.0.2.0                     VALID
Oracle Database Java Packages  12.1.0.2.0                     VALID
OLAP Analytic Workspace        12.1.0.2.0                     VALID
Oracle Application Express     4.2.5.00.08                    VALID
OWB                            11.2.0.4.0                     VALID

15 rows selected.

SQL>
col COMMENTS form a20
select to_char(action_time, 'DD-MON-YYY HH:24:SS AM') UPGRADE_DATE,COMMENTS SOURCE_VERSION,VERSION TARGET_VERSION FROM DBA_REGISTRY_HISTORY WHERE ACTION='UPGRADE';

or
select ACTION_TIME,ACTION,VERSION,COMMENTS from DBA_REGISTRY_HISTORY;


Now we are good as we upgrade the database to new version 12.1.0.2.0. Now we can deinstall the old binaries from ORACLE 11g home.

[oracle@oracleforensics dbhome_1]$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/deinstall

[oracle@oracleforensics deinstall]$ ls -lrth
total 92K
-rwxr-xr-x. 1 oracle oinstall  32K Dec 16  2009 sshUserSetup.sh
-rw-r--r--. 1 oracle oinstall  409 Aug 18  2010 readme.txt
-rw-r--r--. 1 oracle oinstall 3.4K Aug 18  2010 deinstall.xml
-rwxr-xr-x. 1 oracle oinstall 9.6K May 10  2011 bootstrap.pl
-rwxr-xr-x. 1 oracle oinstall  19K Jan 29  2013 deinstall.pl
drwxr-xr-x. 2 oracle oinstall 4.0K Feb  7 18:15 jlib
drwxr-xr-x. 2 oracle oinstall 4.0K Feb  7 18:15 response
-rwxr-xr-x. 1 oracle oinstall 9.5K Feb  7 18:22 deinstall

[oracle@oracleforensics deinstall]$ ./deinstall

Press Enter in all the inputs.


------------- Now we are good. We successfully upgrades out database. J -------------------

No comments:

Post a Comment