Thursday, June 30, 2016

Upgrade Oracle 11g R2 (11.2.0.4) Database to Oracle 12c (12.1.0.2)

9:38 PM Posted by Dilli Raj Maharjan 13 comments
Upgrading Oracle database is transforming existing Oracle environment into newer version of oracle executables, libraries, configuration files and newer version of existing database. User data won't be affected at all. Database upgrade include following changes:
  • Modifying data dictionary.
  • Adding, dropping, or modifying columns in system tables and views
  • Creating new system packages or procedures
  • Modifying existing system packages or procedures
  • Creating, modifying, or dropping database users, roles, and privileges
  • Modifying seed data that is used by Oracle database components

We can perform Database upgradation in 2 steps.

  1. Upgrade newer version of Oracle Database Software.
  2. Perform Oracle database version upgrade.


Minimum Version required to upgrade to 12.1.0.2

  • Oracle Database 11g Release 2 11.2.0.2 and later
  • Oracle Database 11g Release 1 11.1.0.7
  • Oracle Database 10g 10.2.0.5



Unzip Oracle Database software

unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip

Create new oracle_home

mkdir -p /u01/app/oracle/product/12.1.0.1/db_1






Set new oracle home in ORACLE_HOME environment variable

export ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/db_1
./runInstaller






Above screen will be displayed once runInstaller executable file is executed. 





Uncheck "I wish to receive security updates via My Oracle Support". Click on Next to continue.


Warning Message will be displayed. Click on Yes to continue.


I prefer to upgrade database later with dbua command so I have selected Install database software only.


Select Single instance database installation and Click on Next to continue.



Select languages and Click on Next to continue.































Oracle database version is already select and there is no option to select Standard and Standard One. Click Next to continue.































Select Oracle base and Software location. Select newly created Oracle Home directory. Click on Next to continue.


Select appropriate OS groups for OSDBA, OSOPER, OSBACKUPDBA, OSDGDBA, OSKMDBA. Click on Next to continue.


Prerequisite check is on progress.


Click on Save Response File.


On Save Response File window. Select the location and file name and Click on Save.

Click on Install to start database software installation.




Installation Oracle 12c software is on progress. ##########

























Execute root.sh script window will be displayed. Execute the script as user root. Once script is executed click on OK to continue.
































Database software installation completion window will be displayed. Click on Close.


Before upgrading Oracle database with DBUA. We need to check few stuff.

Verify the oracle database version with SQL command below

select instance_name,host_name, version from v$instance;










Verify component, its version and status from dba_registry, All Component should be VALID before upgradation.

select comp_name,version, status from dba_registry;


























Execute preupgrd.sql script

Execute preupgrd.sql script to check prerequisite before upgrading database to 12c. The script file is located on new ORACLE_HOME/rdbms/admin. The new preupgrd.sql script replaces the utlu121i.sql script. This new utility generate 3 files contains detail log of the script execution, fixup script that need to be execute before upgradation and post fix script to be executed after upgradataion.

/u01/app/oracle/product/12.1.0.1/db_1/rdbms/admin/preupgrd.sql
  1. preupgrade.log
  2. preupgrade_fixups.sql
  3. post_upgrade_fixups.sql



























On basic of preupgrade.log findings we need to increase process count by at least 300 and remove the Enterprise Manager Database Control repository.

Increasing Process database parameter.

ALTER SYSTEM SET PROESSES=300 SCOPE=SPFILE;









Removing the Enterprise Manager Database Control repository. We can simply execute emremove.sql on the location of New Oracle_home/rdbms/admin.




Before executing dbua set ORACLE_HOME to new Oracle location.








Execute dbau.


































Once dbua is executed Operation selection window will be displayed. Click on Upgrade Oracle database and Click on Next.































Select the database that is need to be update. Click on Next to continue.






























Prerequisite checks is on progress. ##########






























Info message will be displayed. In case there is any failure it need to be fixed prior to database upgradation.































Check Recompile Invalid Object, Upgrade Timezone Data and Gather Statistics and Click on Next.






























Check Configure Enterprise Manager (EM) Database Express. Specify the desired Port.































Click on Next to continue. In case we need to move database file check Move Database files option.
































If Listener already exists then the upgraded version of database will be registered with the listed listener. In case there is no listener configured we can create a new listener.
































Select appropriate option for the backup. This backup will be used to restore in case of failure.































Summary page will be displayed. Click on Finish to begin database upgradation.































Database upgradation is on progress. ##########































Database upgradation is on progress. ####################































Database upgradation is on progress. ##############################































Once Upgradation is completed it will display the summary window.


























































Click on Close once the upgradation is completed.

Wednesday, June 29, 2016

Upgrade Oracle 11g R2 (11.2.0.4) Grid Infrastructure to Oracle 12c (12.1.0.2)

8:15 AM Posted by Dilli Raj Maharjan No comments
Oracle Database can be performed upgrade in two ways: Direct Upgrade and Indirect Upgrade. Direct upgrade can be done with OUI. Different tools as Data Pump, Transportable tablespace and Goldengate replication can be used to do Indirect upgrade. Oracle always recommended to do Direct out-of-place upgrade. That is, install newer version on separate ORACLE_HOME than the existing one.

Minimum version required to upgrade existing Oracle Grid Infrastructure installations to 12.1.0.2

  1. Oracle Clusterware 10g Release 1 (10.1.0.5) or later
  2. Oracle Clusterware 10g Release 2 (10.2.0.3) or later
  3. Oracle Grid Infrastructure 11g Release 1 (11.1.0.6) or later
  4. Oracle Grid Infrastructure 11g Release 2 (11.2) or later
  5. Oracle Grid Infrastructure 11g Release 2 (11.2.0.2) requires patch 11.2.0.2.3 (11.2.0.2 PSU 3) or later.


Create new ORACLE_HOME for new grid clusterware.

mkdir -p /u01/app/oracle/product/12.1.0/grid

Install cvuqdisk rpm package from grid staging directory.

rpm -ivh cvuqdisk-1.0.9-1.rpm 


Verify disk_string ASM instance paramter

SQL> show parameter disk_string
SQL> alter system set asm_diskstring='/dev/raw/ORCL*' scope=both;



Limitation while upgrading grid infrastructure.

  1. Never delete directories in the Grid home. For example, do not delete the directory Grid_home/Opatch. If you delete the directory, then the Grid infrastructure installation owner cannot use OPatch to patch the grid home, and OPatch displays the error message "'checkdir' error: cannot create Grid_home/OPatch".
  2. Before start upgradation, Verify if you need to apply any mandatory patches for upgrade to succeed.
  3. The same user that owned the earlier release Oracle Grid Infrastructure software must perform the Oracle Grid Infrastructure 12c Release 1 (12.1) upgrade.
  4. During a major release upgrade to Oracle Grid Infrastructure 12c Release 1 (12.1), the software in the 12c Release 1 (12.1) Oracle Grid Infrastructure home is not fully functional until the upgrade is completed. Running srvctl, crsctl, and other commands from the new Grid homes are not supported until the final rootupgrade.sh script is run and the upgrade is complete across all nodes.

Unset all oracle related environment variables before starts installation.


unset ORACLE_BASE
unset ORACLE_HOME
unset ORACLE_SID
unset ORA_CRS_HOME
unset ORACLE_HOME
unset ORA_NLS10
unset TNS_ADMIN

Remove $ORACLE_HOME/bin from PATH environment variable and $ORACLE_HOME/lib from LD_LIBRARY_PATH.

export PATH=/usr/sbin:/usr/lib64/qt3.3/bin:/usr/local/bin:/bin:/usr/bin:\
/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin
export LD_LIBRARY_PATH=/lib:/usr/lib

Start the installer, and select the option to upgrade an existing Oracle Clusterware and Oracle ASM installation.

./runInstaller

Above splash image will be displayed after executing runInstaller executable.






























Select Upgrade Oracle Grid Infrastructure or Oracle Automatic Storage Management and Click on Next to continue.






























Select languages and click on Next to continue.


If we have any Cloud control installed then specify the OMS host, port, EM Admin username and password.

Select ASM Administrator Group and OSDBA Group and Click on Next to continue.


In my case I have no separate OSASM group so the warning window has been displayed. Click on Yes to continue.


Select Oracle base and Software location for GRID infrastructure. Click on Next to continue.






























Configure Root Script execution configuration. In my case I prefer to manually execute root.sh script. You may add root password or sudo setting so that the root.sh script will be executed automatically. It will make installation easier.


Prerequisite check is on progress.


In my case I have failed Physical Memory Pre-requisite. 





























I have select Ignore All option and Click Next.

Warning Message has been displayed due to ignoring the prerequisite. It may cause problem while installation or after installation.

Summary Page has be displayed. Click on Save Response File.

File save window will be displayed. Provide the file name and click on save to continue.






























Click on Install to begin installation.


Installation in progress. ##########



Installation in progress. ####################


Execute rootupgrade.sh script window will be displayed. Execute script as user root on terminal.

Verify the rootupgrade.sh script execute successfully.



After successfully execution of the rootupgrade.sh script Click on OK.





























Click on Close after successfully Installation.















If we encounter the error "MEMORY_TARGET not supported on this system" as above we need to modify the tmpfs size.


SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
[oracle@OEL1 bin]$ ./crsctl start res -all
CRS-2501: Resource 'ora.ons' is disabled
CRS-2672: Attempting to start 'ora.evmd' on 'oel1'
CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'oel1'
CRS-2672: Attempting to start 'ora.cssd' on 'oel1'
CRS-2672: Attempting to start 'ora.diskmon' on 'oel1'
CRS-2676: Start of 'ora.diskmon' on 'oel1' succeeded
CRS-2676: Start of 'ora.evmd' on 'oel1' succeeded
CRS-2676: Start of 'ora.cssd' on 'oel1' succeeded
CRS-2676: Start of 'ora.LISTENER.lsnr' on 'oel1' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'oel1'
CRS-5017: The resource action "ora.asm start" encountered the following error: 
ORA-00845: MEMORY_TARGET not supported on this system
. For details refer to "(:CLSN00107:)" in "/u01/app/oracle/diag/crs/oel1/crs/trace/ohasd_oraagent_oracle.trc".
CRS-2674: Start of 'ora.asm' on 'oel1' failed
CRS-2679: Attempting to clean 'ora.asm' on 'oel1'
CRS-2681: Clean of 'ora.asm' on 'oel1' succeeded
CRS-4000: Command Start failed, or completed with errors.
[oracle@OEL1 bin]$ 

Modify tmpfs size to fix the above issue.

[root@ OEL1 ~]# umount tmpfs
[root@ OEL1 ~]# mount -t tmpfs shmfs -o size=1500m /dev/shm

tmpfs                   /dev/shm                tmpfs   defaults        0 0
tmpfs                   /dev/shm                tmpfs   size=4g        0 0



Downgrading to earlier release

/u01/app/oracle/product/12.1.0/grid/crs/install/rootcrs.sh -downgrade