Wednesday, February 10, 2016

12c: Upgrading Oracle Multitenant database

Steps to Upgrade
pre-req checks before applying patch to the Oracle databases 

1) Backup existing Oracle_Home 

[oracle@tnc61 12.1.0]$ ls -ltr
[oracle@tnc61 12.1.0]$ cp -r dbhome_1 dbhome_1_backup
drwxr-xr-x 70 oracle dba 4096 Feb 10 21:46 dbhome_1
drwxr-xr-x  2 oracle dba 4096 Feb 10 21:56 dbhome_1_backup


2) Make sure Opatch version is compactible to the patch we are applying
[oracle@tnc61 catbundle]$ opatch version
OPatch Version: 12.1.0.1.10
OPatch succeeded.


3) Add following line in bash_profile
PATH=$PATH:$ORACLE_HOME/OPatch


4) checks for conflicts before applying a patch
[oracle@tnc61 19877342]$ pwd
/u01/patch/20132482/19877342

[oracle@tnc61 19877342]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./


Oracle Interim Patch Installer version 12.1.0.1.10
Copyright (c) 2016, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.1.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2016-02-10_21-44-34PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.


5) run opatch apply when it passes all pre-req's
[oracle@tnc61 19877342]$ opatch apply


[oracle@tnc61 19877342]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.10
Copyright (c) 2016, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.1.0
Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2016-02-10_22-01-23PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2016-02-10_22-01-23PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: tnc61.ffdc.com
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c | 12.1.0.1.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch  19877342     : applied on Wed Feb 10 22:00:23 EST 2016
Unique Patch ID:  18407371
Patch description:  "Oracle JAVAVM Component 12.1.0.1.2 Database PSU (JAN2015)"
   Created on 22 Dec 2014, 06:38:01 hrs PST8PDT
   Bugs fixed:
     19007266, 19153980, 17070459, 19554117, 19909862, 17201047, 19058059
     19245191, 16746190, 19699946, 19852357, 19282024, 19006757, 19877342
     19895326, 19231857, 17615204, 17907157, 17285560, 17056813, 19895362
     14774730, 19223010
--------------------------------------------------------------------------------
OPatch succeeded.


Patch is successfully installed on oracle home & now we need to upgrade the databases 



upgrading CDB & PDB DATABASES 

[oracle@tnc61 ~]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Wed Feb 10 22:10:05 2016
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area  730714112 bytes
Fixed Size            2292672 bytes
Variable Size          532677696 bytes
Database Buffers      192937984 bytes
Redo Buffers            2805760 bytes
Database mounted.
Database opened.

SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT

SQL> select name,open_mode from v$pdbs;
NAME                   OPEN_MODE
------------------------------ ----------
PDB$SEED         READ ONLY
PINK                   READ WRITE
GREEN               READ WRITE

SQL> exit

[oracle@tnc61 ~]$ cd /u01/app/oracle/product/12.1.0/dbhome_1/OPatch
[oracle@tnc61 OPatch]$ ls -ltr
total 164
-rw-r----- 1 oracle dba    27 Nov 13 15:15 version.txt
drwxr-x--- 2 oracle dba  4096 Nov 13 15:15 scripts
-rw-r----- 1 oracle dba  2915 Nov 13 15:15 README.txt
-rw-r----- 1 oracle dba  3177 Nov 13 15:15 operr_readme.txt
-rwxr-x--- 1 oracle dba  4220 Nov 13 15:15 operr.bat
-rwxr-x--- 1 oracle dba  3161 Nov 13 15:15 operr
drwxr-x--- 4 oracle dba  4096 Nov 13 15:15 opatchprereqs
-rwxr-x--- 1 oracle dba  2652 Nov 13 15:15 opatch.pl
-rwxr-x--- 1 oracle dba  9445 Nov 13 15:15 opatchdiag.bat
-rwxr-x--- 1 oracle dba 10125 Nov 13 15:15 opatchdiag
-rwxr-x--- 1 oracle dba 15277 Nov 13 15:15 opatch.bat
-rwxr-x--- 1 oracle dba 27214 Nov 13 15:15 opatch
drwxr-x--- 2 oracle dba  4096 Nov 13 15:15 jlib
-rwxr-x--- 1 oracle dba 23764 Nov 13 15:15 emdpatch.pl
-rwxr-x--- 1 oracle dba   645 Nov 13 15:15 datapatch.bat
-rwxr-x--- 1 oracle dba   607 Nov 13 15:15 datapatch
drwxr-x--- 5 oracle dba  4096 Nov 13 15:15 ocm
drwxrwxr-x 3 oracle dba  4096 Nov 13 15:16 oracle_common
drwxr-x--- 3 oracle dba  4096 Nov 13 15:16 oplan
drwxr-x--- 4 oracle dba  4096 Nov 13 15:16 opatchauto-dir
-rwxr-x--- 1 oracle dba   309 Nov 13 15:16 opatchauto
drwxr-x--- 2 oracle dba  4096 Nov 13 15:16 docs

[oracle@tnc61 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.1.0 on Wed Feb 10 22:13:15 2016
Copyright (c) 2012, Oracle.  All rights reserved.

Connecting to database...OK
Determining current state...
Currently installed SQL Patches:
  PDB CDB$ROOT:
  PDB PDB$SEED:
  PDB PINK:
  PDB GREEN:
Currently installed C Patches: 19877342
For the following PDBs: CDB$ROOT
  Nothing to roll back
  The following patches will be applied: 19877342
For the following PDBs: PDB$SEED
  Nothing to roll back
  The following patches will be applied: 19877342
For the following PDBs: PINK
  Nothing to roll back
  The following patches will be applied: 19877342
For the following PDBs: GREEN
  Nothing to roll back
  The following patches will be applied: 19877342
Adding patches to installation queue...
Installing patches...
Validating logfiles...
Patch 19877342 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/product/12.1.0/dbhome_1/sqlpatch/19877342/19877342_apply_COLOUR_CDBROOT_2016Feb10_22_13_56.log
Patch 19877342 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/product/12.1.0/dbhome_1/sqlpatch/19877342/19877342_apply_COLOUR_PDBSEED_2016Feb10_22_14_23.log
Patch 19877342 apply (pdb PINK): SUCCESS
  logfile: /u01/app/oracle/product/12.1.0/dbhome_1/sqlpatch/19877342/19877342_apply_COLOUR_PINK_2016Feb10_22_14_24.log
Patch 19877342 apply (pdb GREEN): SUCCESS
  logfile: /u01/app/oracle/product/12.1.0/dbhome_1/sqlpatch/19877342/19877342_apply_COLOUR_GREEN_2016Feb10_22_15_06.log
SQL Patching tool complete on Wed Feb 10 22:15:55 2016

upgraded container database successfully :)

Upgrading NON CDB database

[oracle@tnc61 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.1.0 on Wed Feb 10 22:42:30 2016
Copyright (c) 2012, Oracle.  All rights reserved.
Connecting to database...OK
Determining current state...
Currently installed SQL Patches:
Currently installed C Patches: 19877342
Nothing to roll back
The following patches will be applied: 19877342
Adding patches to installation queue...
Installing patches...
Validating logfiles...
Patch 19877342 apply: SUCCESS
  logfile: /u01/app/oracle/product/12.1.0/dbhome_1/sqlpatch/19877342/19877342_apply_OVAL007P_oval007p_2016Feb10_22_43_19.log
SQL Patching tool complete on Wed Feb 10 22:43:26 2016
[oracle@tnc61 OPatch]$

we can find error in log files at following location
[oracle@tnc61 catbundle]$ pwd
/u01/app/oracle/cfgtoollogs/catbundle



--12c Oracle: Pluggable databases--
--Nikhil Tatineni--

Querys to monitor RAC

following few  Query's will help to find out culprits-  Query to check long running transaction from last 8 hours  Col Sid Fo...