Oracle Database 12c: Apply 12.1.0.1.1 PSU (October 2013)


1. Preface

To apply PSU 12.1.0.1.1 oracle provides some new tools to reach this goal.

2. Apply PSU to single instance database

2.1 Set enviroment

[bash install]$ . oraenv
ORACLE_SID = [CDB1] ?
The Oracle base remains unchanged with value /opt/oracle/app
[bash install]$

2.2 Check OPatch version

[oracle install]$ $ORACLE_HOME/OPatch/opatch lsinventory | grep version
Oracle Interim Patch Installer version 12.1.0.1.0
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0

2.3 Upgrade OPatch

[oracle install]$ cp p6880880_121010_Linux-x86-64.zip $ORACLE_HOME
[oracle install]$ cd $ORACLE_HOME
[oracle dbhome_1]$ mv OPatch OPatch.old
[oracle dbhome_1]$ unzip p6880880_121010_Linux-x86-64.zip
Archive:  p6880880_121010_Linux-x86-64.zip
   creating: OPatch/
  inflating: OPatch/opatchauto
   creating: OPatch/jlib/
  inflating: OPatch/jlib/oracle.opatch.classpath.jar
  inflating: OPatch/jlib/oracle.opatch.classpath.windows.jar
  inflating: OPatch/jlib/opatch.jar
  inflating: OPatch/jlib/opatchsdk.jar
  inflating: OPatch/jlib/oracle.opatch.classpath.unix.jar
   creating: OPatch/oplan/
  inflating: OPatch/oplan/oplan.bat
   creating: OPatch/oplan/jlib/
  inflating: OPatch/oplan/jlib/oplan.jar
  inflating: OPatch/oplan/jlib/osysmodel-utils.jar
  inflating: OPatch/oplan/jlib/patchsdk.jar
  inflating: OPatch/oplan/jlib/JMXDrivers.jar
  inflating: OPatch/oplan/jlib/Validation.jar
  inflating: OPatch/oplan/jlib/bundle.jar
  inflating: OPatch/oplan/jlib/oracle.oplan.classpath.jar
  inflating: OPatch/oplan/jlib/OuiDriver.jar
  inflating: OPatch/oplan/jlib/automation.jar
   creating: OPatch/oplan/jlib/jaxb/
  inflating: OPatch/oplan/jlib/jaxb/jaxb-impl.jar
  inflating: OPatch/oplan/jlib/jaxb/activation.jar
  inflating: OPatch/oplan/jlib/jaxb/jaxb-api.jar
  inflating: OPatch/oplan/jlib/jaxb/jsr173_1.0_api.jar
  inflating: OPatch/oplan/jlib/EMrepoDrivers.jar
  inflating: OPatch/oplan/jlib/CRSProductDriver.jar
  inflating: OPatch/oplan/jlib/ValidationRules.jar
   creating: OPatch/oplan/jlib/apache-commons/
  inflating: OPatch/oplan/jlib/apache-commons/commons-cli-1.0.jar
  inflating: OPatch/oplan/jlib/OsysModel.jar
  inflating: OPatch/oplan/oplan
  inflating: OPatch/oplan/README.txt
  inflating: OPatch/oplan/README.html
   creating: OPatch/opatchprereqs/
  inflating: OPatch/opatchprereqs/prerequisite.properties
   creating: OPatch/opatchprereqs/opatch/
  inflating: OPatch/opatchprereqs/opatch/opatch_prereq.xml
  inflating: OPatch/opatchprereqs/opatch/runtime_prereq.xml
  inflating: OPatch/opatchprereqs/opatch/rulemap.xml
   creating: OPatch/opatchprereqs/oui/
  inflating: OPatch/opatchprereqs/oui/knowledgesrc.xml
  inflating: OPatch/emdpatch.pl
  inflating: OPatch/opatch.pl
  inflating: OPatch/opatch
  inflating: OPatch/opatch.bat
  inflating: OPatch/README.txt
  inflating: OPatch/datapatch.bat
   creating: OPatch/docs/
  inflating: OPatch/docs/Prereq_Users_Guide.txt
  inflating: OPatch/docs/Users_Guide.txt
  inflating: OPatch/docs/FAQ
   creating: OPatch/ocm/
  inflating: OPatch/ocm/ocm_platforms.txt
 extracting: OPatch/ocm/ocm.zip
   creating: OPatch/ocm/lib/
  inflating: OPatch/ocm/lib/emocmclnt.jar
  inflating: OPatch/ocm/lib/emocmclnt-14.jar
  inflating: OPatch/ocm/lib/http_client.jar
  inflating: OPatch/ocm/lib/osdt_jce.jar
  inflating: OPatch/ocm/lib/jnet.jar
  inflating: OPatch/ocm/lib/emocmcommon.jar
  inflating: OPatch/ocm/lib/xmlparserv2.jar
  inflating: OPatch/ocm/lib/log4j-core.jar
  inflating: OPatch/ocm/lib/jcert.jar
  inflating: OPatch/ocm/lib/jsse.jar
  inflating: OPatch/ocm/lib/osdt_core3.jar
  inflating: OPatch/ocm/lib/regexp.jar
   creating: OPatch/ocm/bin/
  inflating: OPatch/ocm/bin/emocmrsp
  inflating: OPatch/operr_readme.txt
 extracting: OPatch/version.txt
  inflating: OPatch/operr.bat
  inflating: OPatch/opatch.ini
  inflating: OPatch/datapatch
  inflating: OPatch/operr
  inflating: PatchSearch.xml
[oracle dbhome_1]$

2.4 Check OPatch pre apply requirements

[oracle dbhome_1]$ cd /opt/oracle/install
[oracle install]$ unzip p17027533_121010_Linux-x86-64.zip
Archive:  p17027533_121010_Linux-x86-64.zip
   creating: 17027533/
  inflating: 17027533/README.html
 extracting: 17027533/README.txt
   creating: 17027533/etc/
   creating: 17027533/etc/config/
  inflating: 17027533/etc/config/actions.xml
  inflating: 17027533/etc/config/inventory.xml
   creating: 17027533/files/
   creating: 17027533/files/lib/
  inflating: 17027533/files/lib/asmcmdexceptions.pm
  inflating: 17027533/files/lib/librs12.so
   creating: 17027533/files/lib/libgeneric12.a/
  inflating: 17027533/files/lib/libgeneric12.a/kgh.o
  inflating: 17027533/files/lib/libgeneric12.a/kgl4.o
  inflating: 17027533/files/lib/libgeneric12.a/kxdcap.o
  inflating: 17027533/files/lib/libgeneric12.a/kgl.o
  inflating: 17027533/files/lib/libgeneric12.a/kgl2.o
   creating: 17027533/files/lib/libserver12.a/
  inflating: 17027533/files/lib/libserver12.a/ksp.o
  inflating: 17027533/files/lib/libserver12.a/kpdbd.o
  inflating: 17027533/files/lib/libserver12.a/kmm.o
  inflating: 17027533/files/lib/libserver12.a/kjbm.o
  inflating: 17027533/files/lib/libserver12.a/ksb.o
  inflating: 17027533/files/lib/libserver12.a/kkm.o
  inflating: 17027533/files/lib/libserver12.a/kqr.o
  inflating: 17027533/files/lib/libserver12.a/kjcts.o
  inflating: 17027533/files/lib/libserver12.a/ktsj.o
  inflating: 17027533/files/lib/libserver12.a/opilof.o
  inflating: 17027533/files/lib/libserver12.a/kkzl.o
  inflating: 17027533/files/lib/libserver12.a/kcvfdb.o
  inflating: 17027533/files/lib/libserver12.a/kql.o
  inflating: 17027533/files/lib/libserver12.a/kjm.o
  inflating: 17027533/files/lib/libserver12.a/fbadrv.o
  inflating: 17027533/files/lib/libserver12.a/kpdba.o
  inflating: 17027533/files/lib/libserver12.a/ktm.o
  inflating: 17027533/files/lib/libserver12.a/ksl.o
  inflating: 17027533/files/lib/libserver12.a/kpolon.o
  inflating: 17027533/files/lib/libserver12.a/qesrc.o
  inflating: 17027533/files/lib/libserver12.a/kpdbe.o
  inflating: 17027533/files/lib/libserver12.a/kpdb.o
  inflating: 17027533/files/lib/libserver12.a/kzap.o
  inflating: 17027533/files/lib/libserver12.a/kzr.o
  inflating: 17027533/files/lib/libserver12.a/kjbl.o
  inflating: 17027533/files/lib/libserver12.a/qerfx.o
  inflating: 17027533/files/lib/libserver12.a/ksfd.o
  inflating: 17027533/files/lib/libserver12.a/ksfdaf.o
  inflating: 17027533/files/lib/libserver12.a/kdu.o
  inflating: 17027533/files/lib/libserver12.a/krvrd.o
  inflating: 17027533/files/lib/libserver12.a/kff.o
  inflating: 17027533/files/lib/libserver12.a/kpon.o
  inflating: 17027533/files/lib/libserver12.a/kpdbutl.o
  inflating: 17027533/files/lib/libserver12.a/knalf.o
  inflating: 17027533/files/lib/libserver12.a/jscr.o
  inflating: 17027533/files/lib/libserver12.a/kxdam.o
  inflating: 17027533/files/lib/libserver12.a/knas.o
  inflating: 17027533/files/lib/libserver12.a/kcfis.o
  inflating: 17027533/files/lib/libserver12.a/krt.o
  inflating: 17027533/files/lib/libserver12.a/ctc.o
  inflating: 17027533/files/lib/libserver12.a/ksws.o
  inflating: 17027533/files/lib/libserver12.a/aud.o
  inflating: 17027533/files/lib/libserver12.a/krvt.o
  inflating: 17027533/files/lib/libserver12.a/kwqr.o
  inflating: 17027533/files/lib/libserver12.a/kjb.o
  inflating: 17027533/files/lib/libserver12.a/kzvdve.o
  inflating: 17027533/files/lib/libserver12.a/kxes.o
  inflating: 17027533/files/lib/libserver12.a/cvw.o
  inflating: 17027533/files/lib/libserver12.a/kqlb.o
  inflating: 17027533/files/lib/libserver12.a/ktsi.o
  inflating: 17027533/files/lib/libserver12.a/kfi.o
  inflating: 17027533/files/lib/libserver12.a/knipg.o
  inflating: 17027533/files/lib/libserver12.a/jskq.o
  inflating: 17027533/files/lib/libserver12.a/kjzd.o
  inflating: 17027533/files/lib/libserver12.a/kdo.o
  inflating: 17027533/files/lib/libserver12.a/kjbr.o
  inflating: 17027533/files/lib/libserver12.a/kwqic.o
  inflating: 17027533/files/lib/libserver12.a/ksk.o
  inflating: 17027533/files/lib/libserver12.a/knl.o
  inflating: 17027533/files/lib/libserver12.a/ktfa.o
  inflating: 17027533/files/lib/libserver12.a/knahs.o
  inflating: 17027533/files/lib/libserver12.a/qol.o
  inflating: 17027533/files/lib/libserver12.a/ksu.o
  inflating: 17027533/files/lib/libserver12.a/kcl.o
  inflating: 17027533/files/lib/libserver12.a/knanr.o
  inflating: 17027533/files/lib/libserver12.a/kxdofl.o
  inflating: 17027533/files/lib/libserver12.a/k2v.o
  inflating: 17027533/files/lib/libserver12.a/kjfc.o
  inflating: 17027533/files/lib/libserver12.a/knalse.o
  inflating: 17027533/files/lib/libserver12.a/kkt.o
  inflating: 17027533/files/lib/libserver12.a/kzekm.o
  inflating: 17027533/files/lib/libserver12.a/kdn.o
  inflating: 17027533/files/lib/libserver12.a/kcf.o
  inflating: 17027533/files/lib/libserver12.a/kwqmn.o
  inflating: 17027533/files/lib/libserver12.a/ktt.o
  inflating: 17027533/files/lib/libserver12.a/kzp.o
  inflating: 17027533/files/lib/libserver12.a/kokl2.o
  inflating: 17027533/files/lib/libserver12.a/kzckmr.o
  inflating: 17027533/files/lib/libserver12.a/knasp.o
  inflating: 17027533/files/lib/libserver12.a/kokt.o
  inflating: 17027533/files/lib/libserver12.a/kfda.o
  inflating: 17027533/files/lib/libserver12.a/kfpkg.o
  inflating: 17027533/files/lib/libserver12.a/kpdbicd.o
  inflating: 17027533/files/lib/libserver12.a/opiprs.o
  inflating: 17027533/files/lib/libserver12.a/knahf.o
  inflating: 17027533/files/lib/libserver12.a/qksrc.o
  inflating: 17027533/files/lib/libserver12.a/dgls.o
  inflating: 17027533/files/lib/libserver12.a/kzmkr.o
  inflating: 17027533/files/lib/libserver12.a/kewf.o
  inflating: 17027533/files/lib/libserver12.a/kcc.o
  inflating: 17027533/files/lib/libserver12.a/qkagby.o
  inflating: 17027533/files/lib/libserver12.a/ksfq.o
  inflating: 17027533/files/lib/libserver12.a/kewm.o
  inflating: 17027533/files/lib/libserver12.a/kpdbcv.o
  inflating: 17027533/files/lib/libserver12.a/kfd.o
  inflating: 17027533/files/lib/libserver12.a/kcbo.o
  inflating: 17027533/files/lib/libserver12.a/knlogc.o
  inflating: 17027533/files/lib/libserver12.a/kpdbc.o
  inflating: 17027533/files/lib/libserver12.a/qmps.o
  inflating: 17027533/files/lib/libserver12.a/sol.o
  inflating: 17027533/files/lib/libserver12.a/dgl.o
  inflating: 17027533/files/lib/libserver12.a/krvxr.o
  inflating: 17027533/files/lib/libserver12.a/kwslb.o
  inflating: 17027533/files/lib/libserver12.a/jskm.o
  inflating: 17027533/files/lib/libserver12.a/krvxb.o
  inflating: 17027533/files/lib/libserver12.a/kcb.o
  inflating: 17027533/files/lib/libserver12.a/kfgb.o
  inflating: 17027533/files/lib/libserver12.a/knals.o
  inflating: 17027533/files/lib/libserver12.a/ktrv.o
  inflating: 17027533/files/lib/libserver12.a/kkp.o
  inflating: 17027533/files/lib/libserver12.a/knasx.o
  inflating: 17027533/files/lib/libserver12.a/knasda.o
  inflating: 17027533/files/lib/libserver12.a/kfvsu.o
  inflating: 17027533/files/lib/libserver12.a/knam.o
  inflating: 17027533/files/lib/libserver12.a/kkeaf.o
  inflating: 17027533/files/lib/libserver12.a/kwqv.o
  inflating: 17027533/files/lib/libserver12.a/kzckm.o
  inflating: 17027533/files/lib/libserver12.a/kjzn.o
  inflating: 17027533/files/lib/libserver12.a/knac.o
  inflating: 17027533/files/lib/libserver12.a/kffm.o
  inflating: 17027533/files/lib/libserver12.a/zllc.o
  inflating: 17027533/files/lib/libnnz12.so
  inflating: 17027533/files/lib/libnnzst12.a
  inflating: 17027533/files/lib/asmcmdshare.pm
  inflating: 17027533/files/lib/libzt12.a
  inflating: 17027533/files/lib/asmcmddisk.pm
  inflating: 17027533/files/lib/libosbws12.so
   creating: 17027533/files/sqlpatch/
  inflating: 17027533/files/sqlpatch/sqlpatch.pm
  inflating: 17027533/files/sqlpatch/sqlpatch.pl
   creating: 17027533/files/sqlpatch/17027533/
  inflating: 17027533/files/sqlpatch/17027533/17027533_apply.sql
  inflating: 17027533/files/sqlpatch/17027533/17027533_rollback.sql
   creating: 17027533/files/rdbms/
   creating: 17027533/files/rdbms/lib/
  inflating: 17027533/files/rdbms/lib/jox.o
   creating: 17027533/files/rdbms/lib/libknlopt.a/
  inflating: 17027533/files/rdbms/lib/libknlopt.a/jox.o
   creating: 17027533/files/rdbms/mesg/
  inflating: 17027533/files/rdbms/mesg/oraus.msg
  inflating: 17027533/files/rdbms/mesg/oraus.msb
   creating: 17027533/files/rdbms/admin/
  inflating: 17027533/files/rdbms/admin/prvtbstr.plb
  inflating: 17027533/files/rdbms/admin/prvtlmd.plb
  inflating: 17027533/files/rdbms/admin/bundledata_PSU.xml
  inflating: 17027533/files/rdbms/admin/catbundleapply.sql
  inflating: 17027533/files/rdbms/admin/prvtbxstr.plb
  inflating: 17027533/files/rdbms/admin/catuppst.sql
  inflating: 17027533/files/rdbms/admin/catbundle.sql
  inflating: 17027533/files/rdbms/admin/cdenv.sql
  inflating: 17027533/files/rdbms/admin/catbundlerollback.sql
   creating: 17027533/files/bin/
  inflating: 17027533/files/bin/asmcmdcore
   creating: 17027533/files/patch/
   creating: 17027533/files/patch/scripts/
  inflating: 17027533/files/patch/scripts/bug16825779.sql
  inflating: 17027533/files/patch/scripts/bug16286774.sql
[oracle install]$ cd 17027533
[oracle 17027533]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2013-11-27_21-48-10PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
[oracle 17027533]$

2.5 Stopping all components

[oracle 17027533]$ lsnrctl stop

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 27-NOV-2013 21:43:34

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle 17027533]$
[oracle 17027533]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Nov 27 21:43:07 2013

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

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

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

2.6 Apply patch

[oracle 17027533]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/17027533_Nov_27_2013_21_43_50/apply2013-11-27_21-43-50PM_1.log

Applying interim patch '17027533' to OH '/opt/oracle/app/product/12.1.0/dbhome_1'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/opt/oracle/app/product/12.1.0/dbhome_1')

Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...

Patching component oracle.rdbms, 12.1.0.1.0...

Patching component oracle.rdbms.dbscripts, 12.1.0.1.0...

Patching component oracle.rdbms.rsf, 12.1.0.1.0...

Patching component oracle.ldap.rsf, 12.1.0.1.0...

Patching component oracle.ldap.rsf.ic, 12.1.0.1.0...

Verifying the update...
Patch 17027533 successfully applied
Log file location: /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/17027533_Nov_27_2013_21_43_50/apply2013-11-27_21-43-50PM_1.log

OPatch succeeded.
[oracle 17027533]$

2.7 Start components

[oracle 17027533]$ lsnrctl start

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 27-NOV-2013 21:44:48

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

Starting /opt/oracle/app/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Log messages written to /opt/oracle/app/diag/tnslsnr/oel12ctest/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel12ctest)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                27-NOV-2013 21:44:48
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /opt/oracle/app/diag/tnslsnr/oel12ctest/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel12ctest)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle 17027533]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Nov 27 21:44:50 2013

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2287912 bytes
Variable Size             855639768 bytes
Database Buffers          402653184 bytes
Redo Buffers                8785920 bytes
Database mounted.
Database opened.
SQL> alter pluggable database all open;

Pluggable database altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

2.7 Check applied patches

cd $ORACLE_HOME/OPatch
[oracle OPatch]$ ./opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2013-11-27_21-52-12PM_1.log

Lsinventory Output file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-27_21-52-12PM.txt

--------------------------------------------------------------------------------
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  17027533     : applied on Wed Nov 27 21:49:35 CET 2013
Unique Patch ID:  16677152
Patch description:  "Database Patch Set Update : 12.1.0.1.1 (17027533)"
   Created on 27 Sep 2013, 05:30:33 hrs PST8PDT
   Bugs fixed:
     17034172, 16694728, 16448848, 16863422, 16634384, 16465158, 16320173
     16313881, 16910734, 16816103, 16911800, 16715647, 16825779, 16707927
     16392068, 14197853, 16712618, 17273253, 16902138, 16524071, 16856570
     16465149, 16705020, 16689109, 16372203, 16864864, 16849982, 16946613
     16837842, 16964279, 16459685, 16978185, 16845022, 16195633, 14536110
     16964686, 16787973, 16850996, 16674842, 16838328, 16178562, 15996344
     16503473, 16842274, 16935643, 17000176, 14355775, 16362358, 16994576
     16485876, 16919176, 16928832, 16864359, 16617325, 16921340, 16679874
     16788832, 16483559, 16733884, 16784167, 16286774, 15986012, 16660558
     16674666, 16191248, 16697600, 16993424, 16946990, 16589507, 16173738
     16784143, 16772060, 16991789, 17346196, 16495802, 16859937, 16590848
     16910001, 16603924, 16427054, 16730813, 16227068, 16663303, 16784901
     16836849, 16186165, 16457621, 16007562, 16170787, 16663465, 16524968
     16543323, 17027533, 16675710, 17005047, 16795944, 16668226, 16070351
     16212405, 16523150, 16698577, 16621274, 16930325, 17330580, 16443657

--------------------------------------------------------------------------------

OPatch succeeded.

2.8 Postpatch work
Here comes the new section. On 11g and earlier you have to use @catbundle.sql psu apply. In 12g the new tool datapatch will do this work you you.

[oracle 17027533]$ cd $ORACLE_HOME/OPatch
[oracle OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.1.0 on Wed Nov 27 21:46:28 2013
Copyright (c) 2013, Oracle.  All rights reserved.

Connecting to database...OK
Determining current state...
Currently installed SQL Patches:
  PDB CDB$ROOT:
  PDB PDB$SEED:
  PDB PDB1:
Currently installed C Patches: 17027533
For the following PDBs: CDB$ROOT
  Nothing to roll back
  The following patches will be applied: 17027533
For the following PDBs: PDB$SEED
  Nothing to roll back
  The following patches will be applied: 17027533
For the following PDBs: PDB1
  Nothing to roll back
  The following patches will be applied: 17027533
Adding patches to installation queue...
Installing patches...
Validating logfiles...
Patch 17027533 apply (pdb CDB$ROOT): SUCCESS
  logfile: /opt/oracle/app/product/12.1.0/dbhome_1/sqlpatch/17027533/17027533_apply_CDB1_CDBROOT_2013Nov27_21_46_32.log (no errors)
Patch 17027533 apply (pdb PDB$SEED): SUCCESS
  logfile: /opt/oracle/app/product/12.1.0/dbhome_1/sqlpatch/17027533/17027533_apply_CDB1_PDBSEED_2013Nov27_21_46_41.log (no errors)
Patch 17027533 apply (pdb PDB1): SUCCESS
  logfile: /opt/oracle/app/product/12.1.0/dbhome_1/sqlpatch/17027533/17027533_apply_CDB1_PDB1_2013Nov27_21_46_44.log (no errors)
SQL Patching tool complete on Wed Nov 27 21:46:53 2013

Problems while patching with datapatch

If you rollback an online patch before you apply the psu you may get an error during datapatch:

[oracle OPatch]$ export OPATCH_DEBUG=true
[oracle OPatch]$ ./datapatch -verbose -debug
SQL Patching tool version 12.1.0.1.0 on Tue Oct 29 13:25:17 2013
Copyright (c) 2013, Oracle. All rights reserved.

Command line arguments:
db:
apply_list:
rollback_list:
force: 0
prereq: 0
oh:
Connecting to database...OK
Determining current state...
CDB! pdbs: CDB$ROOT PDB$SEED PDB1
Currently installed SQL Patches:
PDB CDB$ROOT:
PDB PDB$SEED:
PDB PDB1:
DBD::Oracle::st execute failed: ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: at "SYS.DBMS_QOPATCH", line 1011
ORA-06512: at line 4 (DBD ERROR: OCIStmtExecute) [for Statement "DECLARE
x XMLType;
BEGIN
x := dbms_qopatch.get_pending_activity;
? := x.getStringVal();
END;" with ParamValues: :p1=undef] at /opt/oracle/app/product/12.1.0/dbhome_1/sqlpatch/sqlpatch.pm line 824.
[oracle OPatch]$

This is a problem with directories created during patching …
To solve this issue you can workaround with the following

Check parameter:

SELECT a.ksppinm “Parameter”,
b.ksppstvl “Session Value”,
c.ksppstvl “Instance Value”
FROM x$ksppi a,
x$ksppcv b,
x$ksppsv c
WHERE a.indx = b.indx
AND a.indx = c.indx
AND a.ksppinm LIKE ‘/_disable_direc%’ escape ‘/’

if _disable_directory_link_check is set to FALSE I would suggest you set to TRUE and try to execute datapatch and update again. It should work now.

3. Apply PSU to Grid Infrastruce and RAC database

3.1 Check GI Patches

[oracle@node0 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/12.1.0.1/grid
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/12.1.0.1/grid/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/opatch2013-11-24_22-37-14PM_1.log

Lsinventory Output file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/lsinv/lsinventory2013-11-24_22-37-14PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Grid Infrastructure 12c                                       12.1.0.1.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

Patch level status of Cluster nodes :

 Patching Level                  Nodes
 --------------                  -----
 0                               node1,node0,node2,node3

--------------------------------------------------------------------------------

3.2 Check Databases Patches

[oracle@node0 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/12.1.0.1/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/12.1.0.1/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/12.1.0.1/dbhome_1/cfgtoollogs/opatch/opatch2013-11-24_22-39-13PM_1.log

Lsinventory Output file location : /opt/oracle/app/12.1.0.1/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-24_22-39-13PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 12c                                                  12.1.0.1.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

Rac system comprising of multiple nodes
  Local node = node0
  Remote node = node1
  Remote node = node2
  Remote node = node3

--------------------------------------------------------------------------------

3.3 Create response file

[oracle@node0 tmp]$ cd /opt/oracle/12.1.0.1/grid/OPatch/ocm/bin
[oracle@node0 bin]$ ls -l
total 12
-rwxr----- 1 oracle oinstall 9063 Nov 27  2009 emocmrsp
[oracle@node0 bin]$ ./emocmrsp
OCM Installation Response Generator 10.3.7.0.0 - Production
Copyright (c) 2005, 2012, Oracle and/or its affiliates.  All rights reserved.

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y
The OCM configuration response file (ocm.rsp) was successfully created.
[oracle@node0 bin]$ ls -l
total 16
-rwxr----- 1 oracle oinstall 9063 Nov 27  2009 emocmrsp
-rw-r--r-- 1 oracle oinstall  623 Nov 24 22:42 ocm.rsp
[oracle@node0 bin]$ cp ocm.rsp /opt/oracle/install/

3.4 Patch GI and Databases with opatchauto
opatchauto is also a new tool to apply patches automated to gi and database at one step. You have to run this as ROOT user:

[root@node0 install]# opatchauto apply /opt/oracle/install/17272829 -ocmrf /opt/oracle/install/ocm.rsp
OPatch Automation Tool
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

OPatchauto version : 12.1.0.1.2
OUI version        : 12.1.0.1.0
Running from       : /opt/oracle/12.1.0.1/grid

opatchauto log file: /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatchauto/17272829/opatch_gi_2013-11-24_22-43-51_deploy.log

Parameter Validation: Successful

Grid Infrastructure home:
/opt/oracle/12.1.0.1/grid
RAC home(s):
/opt/oracle/app/12.1.0.1/dbhome_1

Configuration Validation: Successful

Patch Location: /opt/oracle/install/17272829
Grid Infrastructure Patch(es): 17027533 17077442 17303297
RAC Patch(es): 17027533 17077442

Patch Validation: Successful

Stopping RAC (/opt/oracle/app/12.1.0.1/dbhome_1) ... Successful
Following database(s) were stopped and will be restarted later during the session: cdb1

Applying patch(es) to "/opt/oracle/app/12.1.0.1/dbhome_1" ...
Patch "/opt/oracle/install/17272829/17027533" successfully applied to "/opt/oracle/app/12.1.0.1/dbhome_1".
Patch "/opt/oracle/install/17272829/17077442" successfully applied to "/opt/oracle/app/12.1.0.1/dbhome_1".

Stopping CRS ... Successful

Applying patch(es) to "/opt/oracle/12.1.0.1/grid" ...
Patch "/opt/oracle/install/17272829/17027533" successfully applied to "/opt/oracle/12.1.0.1/grid".
Patch "/opt/oracle/install/17272829/17077442" successfully applied to "/opt/oracle/12.1.0.1/grid".
Patch "/opt/oracle/install/17272829/17303297" successfully applied to "/opt/oracle/12.1.0.1/grid".

Starting CRS ... Successful

Starting RAC (/opt/oracle/app/12.1.0.1/dbhome_1) ... Successful

SQL changes, if any, are applied successfully on the following database(s): CDB1

Apply Summary:
Following patch(es) are successfully installed:
GI Home: /opt/oracle/12.1.0.1/grid: 17027533, 17077442, 17303297
RAC Home: /opt/oracle/app/12.1.0.1/dbhome_1: 17027533, 17077442

opatchauto succeeded.
[root@node0 install]#

3.5 Check patch on local node

[root@node0 install]# su - oracle
[oracle@node0 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/12.1.0.1/grid
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/12.1.0.1/grid/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/opatch2013-11-24_22-57-20PM_1.log

Lsinventory Output file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/lsinv/lsinventory2013-11-24_22-57-20PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Grid Infrastructure 12c                                       12.1.0.1.0
There are 1 products installed in this Oracle Home.

Interim patches (3) :

Patch  17303297     : applied on Sun Nov 24 22:50:27 CET 2013
Unique Patch ID:  16881795
Patch description:  "ACFS Patch Set Update 12.1.0.1.1"
   Created on 14 Oct 2013, 07:25:50 hrs US/Central
   Bugs fixed:
     14487556, 16398970, 16552813, 16930184, 16420645, 16170117, 16436434
     16476044, 16458315, 16463033, 16095100, 16545876, 16429953, 14826673
     16001893, 16482869, 16371746, 16435343, 14476443, 16294308, 16671486
     16386110, 15978267, 16085530, 16347837, 16814544, 16022372, 16167084
     14510092, 16450287, 16399406

Patch  17077442     : applied on Sun Nov 24 22:49:35 CET 2013
Unique Patch ID:  16881794
Patch description:  "Oracle Clusterware Patch Set Update 12.1.0.1.1"
   Created on 12 Oct 2013, 06:33:53 hrs US/Central
   Bugs fixed:
     16505840, 16505255, 16390989, 16399322, 16505617, 16505717, 17486244
     16168869, 16444109, 16505361, 13866165, 16505763, 16208257, 16904822
     17299876, 16246222, 16505214, 16505540, 15936039, 16580269, 16838292
     16505449, 16801843, 16309853, 16505395, 17507349, 17475155, 16493242
     17039197, 16196609, 17463260, 16505667, 15970176, 16488665, 16670327

Patch  17027533     : applied on Sun Nov 24 22:49:04 CET 2013
Unique Patch ID:  16677152
Patch description:  "Database Patch Set Update : 12.1.0.1.1 (17027533)"
   Created on 27 Sep 2013, 05:30:33 hrs PST8PDT
   Bugs fixed:
     17034172, 16694728, 16448848, 16863422, 16634384, 16465158, 16320173
     16313881, 16910734, 16816103, 16911800, 16715647, 16825779, 16707927
     16392068, 14197853, 16712618, 17273253, 16902138, 16524071, 16856570
     16465149, 16705020, 16689109, 16372203, 16864864, 16849982, 16946613
     16837842, 16964279, 16459685, 16978185, 16845022, 16195633, 14536110
     16964686, 16787973, 16850996, 16674842, 16838328, 16178562, 15996344
     16503473, 16842274, 16935643, 17000176, 14355775, 16362358, 16994576
     16485876, 16919176, 16928832, 16864359, 16617325, 16921340, 16679874
     16788832, 16483559, 16733884, 16784167, 16286774, 15986012, 16660558
     16674666, 16191248, 16697600, 16993424, 16946990, 16589507, 16173738
     16784143, 16772060, 16991789, 17346196, 16495802, 16859937, 16590848
     16910001, 16603924, 16427054, 16730813, 16227068, 16663303, 16784901
     16836849, 16186165, 16457621, 16007562, 16170787, 16663465, 16524968
     16543323, 17027533, 16675710, 17005047, 16795944, 16668226, 16070351
     16212405, 16523150, 16698577, 16621274, 16930325, 17330580, 16443657

Patch level status of Cluster nodes :

 Patching Level                  Nodes
 --------------                  -----
 1650217826                      node0
 0                               node1,node2,node3

--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@node0 ~]$

3.6 Repeat the opatchauto process on each node
3.7 Check opatch inventory again now

[root@node0 install]# su - oracle
[oracle@node0 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/12.1.0.1/grid
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/12.1.0.1/grid/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/opatch2013-11-24_22-57-20PM_1.log

Lsinventory Output file location : /opt/oracle/12.1.0.1/grid/cfgtoollogs/opatch/lsinv/lsinventory2013-11-24_22-57-20PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Grid Infrastructure 12c                                       12.1.0.1.0
There are 1 products installed in this Oracle Home.

Interim patches (3) :

Patch  17303297     : applied on Sun Nov 24 22:50:27 CET 2013
Unique Patch ID:  16881795
Patch description:  "ACFS Patch Set Update 12.1.0.1.1"
   Created on 14 Oct 2013, 07:25:50 hrs US/Central
   Bugs fixed:
     14487556, 16398970, 16552813, 16930184, 16420645, 16170117, 16436434
     16476044, 16458315, 16463033, 16095100, 16545876, 16429953, 14826673
     16001893, 16482869, 16371746, 16435343, 14476443, 16294308, 16671486
     16386110, 15978267, 16085530, 16347837, 16814544, 16022372, 16167084
     14510092, 16450287, 16399406

Patch  17077442     : applied on Sun Nov 24 22:49:35 CET 2013
Unique Patch ID:  16881794
Patch description:  "Oracle Clusterware Patch Set Update 12.1.0.1.1"
   Created on 12 Oct 2013, 06:33:53 hrs US/Central
   Bugs fixed:
     16505840, 16505255, 16390989, 16399322, 16505617, 16505717, 17486244
     16168869, 16444109, 16505361, 13866165, 16505763, 16208257, 16904822
     17299876, 16246222, 16505214, 16505540, 15936039, 16580269, 16838292
     16505449, 16801843, 16309853, 16505395, 17507349, 17475155, 16493242
     17039197, 16196609, 17463260, 16505667, 15970176, 16488665, 16670327

Patch  17027533     : applied on Sun Nov 24 22:49:04 CET 2013
Unique Patch ID:  16677152
Patch description:  "Database Patch Set Update : 12.1.0.1.1 (17027533)"
   Created on 27 Sep 2013, 05:30:33 hrs PST8PDT
   Bugs fixed:
     17034172, 16694728, 16448848, 16863422, 16634384, 16465158, 16320173
     16313881, 16910734, 16816103, 16911800, 16715647, 16825779, 16707927
     16392068, 14197853, 16712618, 17273253, 16902138, 16524071, 16856570
     16465149, 16705020, 16689109, 16372203, 16864864, 16849982, 16946613
     16837842, 16964279, 16459685, 16978185, 16845022, 16195633, 14536110
     16964686, 16787973, 16850996, 16674842, 16838328, 16178562, 15996344
     16503473, 16842274, 16935643, 17000176, 14355775, 16362358, 16994576
     16485876, 16919176, 16928832, 16864359, 16617325, 16921340, 16679874
     16788832, 16483559, 16733884, 16784167, 16286774, 15986012, 16660558
     16674666, 16191248, 16697600, 16993424, 16946990, 16589507, 16173738
     16784143, 16772060, 16991789, 17346196, 16495802, 16859937, 16590848
     16910001, 16603924, 16427054, 16730813, 16227068, 16663303, 16784901
     16836849, 16186165, 16457621, 16007562, 16170787, 16663465, 16524968
     16543323, 17027533, 16675710, 17005047, 16795944, 16668226, 16070351
     16212405, 16523150, 16698577, 16621274, 16930325, 17330580, 16443657

Patch level status of Cluster nodes :

 Patching Level                  Nodes
 --------------                  -----
 1650217826                      node0,node1,node2,node3

--------------------------------------------------------------------------------

OPatch succeeded.

3.8 And on database home

[oracle@node0 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? CDB1
The Oracle base has been set to /opt/oracle/app
[oracle@node0 ~]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.2
Copyright (c) 2013, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/12.1.0.1/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/12.1.0.1/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.2
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/12.1.0.1/dbhome_1/cfgtoollogs/opatch/opatch2013-11-24_22-58-04PM_1.log

Lsinventory Output file location : /opt/oracle/app/12.1.0.1/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-24_22-58-04PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 12c                                                  12.1.0.1.0
There are 1 products installed in this Oracle Home.

Interim patches (2) :

Patch  17077442     : applied on Sun Nov 24 22:46:01 CET 2013
Unique Patch ID:  16881794
Patch description:  "Oracle Clusterware Patch Set Update 12.1.0.1.1"
   Created on 12 Oct 2013, 06:33:53 hrs US/Central
   Bugs fixed:
     16505840, 16505255, 16390989, 16399322, 16505617, 16505717, 17486244
     16168869, 16444109, 16505361, 13866165, 16505763, 16208257, 16904822
     17299876, 16246222, 16505214, 16505540, 15936039, 16580269, 16838292
     16505449, 16801843, 16309853, 16505395, 17507349, 17475155, 16493242
     17039197, 16196609, 17463260, 16505667, 15970176, 16488665, 16670327

Patch  17027533     : applied on Sun Nov 24 22:45:55 CET 2013
Unique Patch ID:  16677152
Patch description:  "Database Patch Set Update : 12.1.0.1.1 (17027533)"
   Created on 27 Sep 2013, 05:30:33 hrs PST8PDT
   Bugs fixed:
     17034172, 16694728, 16448848, 16863422, 16634384, 16465158, 16320173
     16313881, 16910734, 16816103, 16911800, 16715647, 16825779, 16707927
     16392068, 14197853, 16712618, 17273253, 16902138, 16524071, 16856570
     16465149, 16705020, 16689109, 16372203, 16864864, 16849982, 16946613
     16837842, 16964279, 16459685, 16978185, 16845022, 16195633, 14536110
     16964686, 16787973, 16850996, 16674842, 16838328, 16178562, 15996344
     16503473, 16842274, 16935643, 17000176, 14355775, 16362358, 16994576
     16485876, 16919176, 16928832, 16864359, 16617325, 16921340, 16679874
     16788832, 16483559, 16733884, 16784167, 16286774, 15986012, 16660558
     16674666, 16191248, 16697600, 16993424, 16946990, 16589507, 16173738
     16784143, 16772060, 16991789, 17346196, 16495802, 16859937, 16590848
     16910001, 16603924, 16427054, 16730813, 16227068, 16663303, 16784901
     16836849, 16186165, 16457621, 16007562, 16170787, 16663465, 16524968
     16543323, 17027533, 16675710, 17005047, 16795944, 16668226, 16070351
     16212405, 16523150, 16698577, 16621274, 16930325, 17330580, 16443657

Rac system comprising of multiple nodes
  Local node = node0
  Remote node = node1
  Remote node = node2
  Remote node = node3

--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@node0 ~]$

All done

Database 12c: Common and local users and roles


Since 12c “nothing” is like before. Today we are talking about the user creation. The user beavior in a Non-CDB is like in 11g and before. In CDBs and PDBs the concept slightly changes. In a multitenant database users will be divided into two different types: Local and common users:

commonuser

Common users

A common user is user which is present in the CDB and all PDBs. Here from documentation:

“A common user is a database user that has the same identity in the root and in every existing and future PDB. Every common user can connect to and perform operations within the root, and within any PDB in which it has privileges.”

Special users are sys and system. Common users have the same characteristic in all instances (e.g. password, tablespace and so on)

Create a new common user:

SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> create user C##TEST1 identified by test1 container = all;

User created.

Common users must start with c## or C##

SQL> create user TEST1 identified by bubu1 container=all;
create user TEST1 identified by bubu1 container=all
            *
ERROR at line 1:
ORA-65096: invalid common user or role name

Changes to common users apply to all container:

SQL> create user C##TEST1 identified by test1 container = all default tablespace users;
create user C##TEST1 identified by test1 container = all default tablespace users
*
ERROR at line 1:
ORA-65048: error encountered when processing the current DDL statement in pluggable database PDB1
ORA-00959: tablespace 'USERS' does not exist

The password is the same in CDB and all PDBs, when trying to change you get an error:

QL> alter user C##TEST1 identified by bubu1;
alter user C##TEST1 identified by bubu1
*
ERROR at line 1:
ORA-65066: The specified changes must apply to all containers

Changes to common users are only allowed in CDB

SQL> alter user C##TEST1 identified by bubu1 container=all;
alter user C##TEST1 identified by bubu1 container=all
*
ERROR at line 1:
ORA-65050: Common DDLs only allowed in CDB$ROOT

Local users

Local users are users which are only exsits in a PDB but not in all containers.

Create local users:

SQL> create user TEST1 identified by bubu1;

User created.

SQL> create user TEST2 identified by bubu1 container=current;

User created.

SQL> 

In CDBs no local users can be created:

SQL> create user TEST1 identified by bubu1 container=current;
create user TEST1 identified by bubu1 container=current
                                *
ERROR at line 1:
ORA-65049: creation of local user or role is not allowed in CDB$ROOT

The username for a local user must not start with c## or C##

SQL> create user C##TEST1 identified by bubu1;
create user C##TEST1 identified by bubu1
            *
ERROR at line 1:
ORA-65094: invalid local user or role name

SQL> create user C##TEST1 identified by bubu1 container=current;
create user C##TEST1 identified by bubu1 container=current
            *
ERROR at line 1:
ORA-65094: invalid local user or role name

Common roles

Common roles are like common users roles which are present in CDB and all PDBs. Important is that the privileges are granted at CDB or PDB level, but not over all containers, per default.

SQL> create role C##ROLE1 container=all;

Role created.

SQL> grant create session to C##ROLE1;

Grant succeeded.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';
GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE SESSION                 NO

SQL> alter session set container=PDB1;

Session altered.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

no rows selected

SQL> 

To grant privileges over all containers:

SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> grant create table to C##ROLE1 container=all;

Grant succeeded.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE SESSION                 NO
C##ROLE1                       CREATE TABLE                   YES

SQL> alter session set container=PDB1;

Session altered.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE TABLE                   YES

SQL> 

Privileges granted in a pdb will only available in a pdb:

SQL> alter session set container=PDB1;

Session altered.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE TABLE                   YES

SQL> grant create view to C##ROLE1;

Grant succeeded.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE VIEW                    NO
C##ROLE1                       CREATE TABLE                   YES

SQL> alter session set container=CDB$ROOT;

Session altered.

SQL> select grantee,privilege,common from dba_sys_privs where grantee='C##ROLE1';

GRANTEE                        PRIVILEGE                      COMMON
------------------------------ ------------------------------ ------------------------------
C##ROLE1                       CREATE SESSION                 NO
C##ROLE1                       CREATE TABLE                   YES

SQL> 

Database 12c: RBO (Rule Based Optimizer) is not death


Starting with Oracle Database 10g Release 1 (10.1), the cost-based optimizer (CBO) is now enabled by default. The rule-based optimizer is no longer supported in Oracle Database 10g Release 1 (10.1). As a result, rule and choose are no longer supported as OPTIMIZER_MODE initialization parameter values and a warning is displayed in the alert log if OPTIMIZER_MODE is set to either of these values.

  • Oracle has announced to remove RBO in 11.1 and hasn’t done.
  • Oracle has announced to remove RBO in 11.2 and hasn’t done.
  • Oracle has announced to remove RBO in 12.1 and hasn’t done.

Here the test:

1. Create environment

SQL> conn dhafner/<pwd>
Connected.
SQL> create table tab1 (id number,text varchar2(32767));

Table created.

SQL> desc tab1
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
ID                                                 NUMBER
TEXT                                               VARCHAR2(32767)

SQL>

SQL> insert into dhafner.tab1 (select object_id,object_name from dba_objects);

90739 rows created.

SQL> commit;

Commit complete.

SQL> conn dhafner/dhafner
Connected.
SQL> create index tab1_idx on tab1(id);

Index created.

2. Test with CBO without statistics

SQL> explain plan for select text from tab1 where id=1000;

Explained.

SQL> select * from table(dbms_xplan.display());

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 2211052296

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 | 16398 |     2   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| TAB1 |     1 | 16398 |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

1 - filter("ID"=1000 AND INTERNAL_FUNCTION("TEXT"))

13 rows selected.

3. Change to RULE

SQL> alter session set optimizer_mode=rule;

Session altered.

SQL> explain plan for select text from tab1 where id=1000;

Explained.

SQL> select * from table(dbms_xplan.display());

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 926492477

------------------------------------------------
| Id  | Operation                   | Name     |
------------------------------------------------
|   0 | SELECT STATEMENT            |          |
|*  1 |  TABLE ACCESS BY INDEX ROWID| TAB1     |
|*  2 |   INDEX RANGE SCAN          | TAB1_IDX |
------------------------------------------------

Predicate Information (identified by operation id):

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

1 - filter(INTERNAL_FUNCTION("TEXT"))
2 - access("ID"=1000)

Note
-----
- rule based optimizer used (consider using cbo)

19 rows selected.

4. To show the effect test it now with CBO and statistics

SQL> exec dbms_stats.gather_table_stats('DHAFNER','TAB1',cascade=>true);

PL/SQL procedure successfully completed.

SQL> alter session set optimizer_mode=all_rows;

Session altered.

SQL> select * from table(dbms_xplan.display())

PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------
Plan hash value: 358219344

------------------------------------------------------------------------------------------------
| Id  | Operation                           | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                    |          |     1 |    30 |     2   (0)| 00:00:01 |
|*  1 |  TABLE ACCESS BY INDEX ROWID BATCHED| TAB1     |     1 |    30 |     2   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN                  | TAB1_IDX |     1 |       |     1   (0)| 00:00:01 |
------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

1 - filter(INTERNAL_FUNCTION("TEXT"))
2 - access("ID"=1000)

15 rows selected.

Database 12c: Extended Datatypes


Starting with 12c Extended Datatypes has been introduced. I’m going to show how to use the new feature. If you have installed default 12.1.0.1 database you will get the following error when trying to create a table with varchar2 greater 4000 bytes:

SQL> create table tab1 (id number,text varchar2(32767 byte));
create table tab1 (id number,text varchar2(32767 byte))
                                           *
ERROR at line 1:
ORA-00910: specified length too long for its datatype

There is a new parameter called “MAX_STRING_SIZE”. Here the parameter and values:

  • 32767 bytes or characters if MAX_STRING_SIZE = EXTENDED
  • 4000 bytes or characters if MAX_STRING_SIZE = STANDARD

The parameter cannot be changed at session level…

SQL> alter session set max_string_size=EXTENDED;
alter session set max_string_size=EXTENDED
*
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this option

If you try to change a system level:

SQL> alter system set max_string_size=EXTENDED scope=both;
alter system set max_string_size=EXTENDED scope=both
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration

OK enough for testing. Here the steps to change this parameter:

0. Requirements

To activate the feature the parameter COMPATIBLE must at least 12.0.0.0.

1. change parameter

SQL>  alter system set max_string_size=EXTENDED scope=spfile;

System altered.

SQL>

2. shutdown immediate

[bash]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Jul 22 21:53:59 2013

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

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

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

3. startup upgrade

SQL> startup upgrade
ORACLE instance started.

Total System Global Area 2488635392 bytes
Fixed Size                  2291424 bytes
Variable Size             671090976 bytes
Database Buffers         1795162112 bytes
Redo Buffers               20090880 bytes
Database mounted.
Database opened.

5. run script utl32k.sql

SQL> @?/rdbms/admin/utl32k.sql

Session altered.

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause an "ORA-01722: invalid number"
DOC>   error if the database has not been opened for UPGRADE.
DOC>
DOC>   Perform a "SHUTDOWN ABORT"  and
DOC>   restart using UPGRADE.
DOC>#######################################################################
DOC>#######################################################################
DOC>#

no rows selected

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause an "ORA-01722: invalid number"
DOC>   error if the database does not have compatible >= 12.0.0
DOC>
DOC>   Set compatible >= 12.0.0 and retry.
DOC>#######################################################################
DOC>#######################################################################
DOC>#

PL/SQL procedure successfully completed.

Session altered.

0 rows updated.

Commit complete.

System altered.

PL/SQL procedure successfully completed.

Commit complete.

System altered.

Session altered.

PL/SQL procedure successfully completed.

No errors.

Session altered.

PL/SQL procedure successfully completed.

Commit complete.

Package altered.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2013-07-22 21:43:09

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.

TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2013-07-22 21:43:11

DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0

Function created.

PL/SQL procedure successfully completed.

Function dropped.

...Database user "SYS", database schema "APEX_040200", user# "98" 21:43:19
...Compiled 0 out of 2998 objects considered, 0 failed compilation 21:43:20
...263 packages
...255 package bodies
...453 tables
...11 functions
...16 procedures
...3 sequences
...458 triggers
...1322 indexes
...207 views
...0 libraries
...6 types
...0 type bodies
...0 operators
...0 index types
...Begin key object existence check 21:43:20
...Completed key object existence check 21:43:20
...Setting DBMS Registry 21:43:20
...Setting DBMS Registry Complete 21:43:20
...Exiting validate 21:43:20

PL/SQL procedure successfully completed.

SQL>

This script is mandatory, else you will get the following error:

SQL> startup
ORACLE instance started.

Total System Global Area 2488635392 bytes
Fixed Size                  2291424 bytes
Variable Size             671090976 bytes
Database Buffers         1795162112 bytes
Redo Buffers               20090880 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-14695: MAX_STRING_SIZE migration is incomplete
Process ID: 6324
Session ID: 355 Serial number: 5

NOTE:
The utl32k.sql script increases the maximum size of the VARCHAR2, NVARCHAR2, and RAW columns
for the views where this is required. The script does not increase the maximum size of the
VARCHAR2, NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

5. startup normal

SQL> startup
ORACLE instance started.

Total System Global Area 2488635392 bytes
Fixed Size                  2291424 bytes
Variable Size             671090976 bytes
Database Buffers         1795162112 bytes
Redo Buffers               20090880 bytes
Database mounted.
Database opened.
SQL> show parameter max_string_size

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_string_size                      string      EXTENDED
SQL>

NOW: test it

SQL> conn hr/hr
Connected.
SQL> create table tab1 (id number,text varchar2(32767));

Table created.

SQL> desc tab1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER
 TEXT                                               VARCHAR2(32767)

SQL>

Changing MAX_STRING_SIZE in PDBs

  1. Shut down the PDB.
  2. Restart the PDB in UPGRADE mode.
  3. Change the setting of MAX_STRING_SIZE in the PDB to EXTENDED.
  4. Run the @?/rdbms/admin/utl32k.sql script in the PDB. You must be connected AS SYSDBA to run the utl32k.sql script.
  5. Restart the PDB in NORMAL mode.

Changing MAX_STRING_SIZE in RAC

  1. Shut down all of the Oracle RAC database instances, except one.
  2. Restart the Oracle RAC database instance in UPGRADE mode.
  3. Change the setting of MAX_STRING_SIZE to EXTENDED.
  4. Run the @?/rdbms/admin/utl32k.sql script in the Oracle RAC database instance. You must be connected AS SYSDBA to run the script.
  5. Restart the Oracle RAC database instance in NORMAL mode.
  6. Restart the other Oracle RAC database instances in NORMAL mode.

Changing MAX_STRING_SIZE in DG Environment

  1. Shut down the Oracle Data Guard primary database and logical standby database.
  2. Restart the primary database and logical standby database in UPGRADE mode.
  3. Change the setting of MAX_STRING_SIZE to EXTENDED on the primary database and logical standby database.
  4. Run the @?rdbms/admin/utl32k.sql script on both the primary database and the logical standby database. You must be connected AS SYSDBA to run the script.
  5. Restart the primary database and logical standby database in NORMAL mode and start SQL Apply.

Bug 15845247

If you change the MAX_STRING_SIZE initialization parameter while creating a database using DBCA with a template that includes data files, the database creation fails with the following error:
ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration

Workaround: Leave the MAX_STRING_SIZE initialization parameter set to the default (STANDARD) or whatever it was set to in the template during DBCA. If you need to create a database with MAX_STRING_SIZE=EXTENDED, use the custom database template in DBCA.In a multitenant container database (CDB), the MAX_STRING_SIZE initialization parameter is a per-PDB parameter. The root CDB always uses STANDARD semantics, regardless of the parameter. You can change the MAX_STRING_SIZE initialization parameter for PDBs as needed after the CDB is created.

AOUG Migration Day: Save the date 19th September 2013


Austrian Oracle User Group (AOUG) announced the oracle “Migration Day”.

Save the date:

19th September 2013, starting 15:30

Tech Gate Vienna
Donau City Strasse 1
A-1220 Wien

Check this out and save the date here