Patch Set Update 12.1.0.2 190416

Notes for the Oracle PSU for 12.1 (check carefully - very easy to download the 12.2 version). This is for a RAC one node server, please check the patch info when using RAC / Dataguard, as this process will differ.

See ➊ at bottom of post when using replication, will expand later.

Make sure you are using the latest Opatch, i.e. p6880880). See here :

Unzip the p6880880 patch (check latest patch downloaded) - ensure you have a valid backup of the Opatch directory :
ORA01:+ASM:gridhome>unzip p6880880_122010_Linux-x86-64.zip

This will create a new OPatch directory with new versions of OPatchauto and OPatch:

Do this on both the GI and rdbms home otherwise you will hit opatch mis-match errors when running combo patches.

Check the version is as expected - i.e. run $./opatch version

Now run opatch with the analyze option to confirm everything ok :

OPatch>./opatchauto apply /u99/media/29176115 -analyze
If the analyze completes ok against the GI and DB home then apply the patch :

Initially, I ran against the GI and then the DB Home but running against both homes is the better option.

Check you don't have any apps running. We had to shutdown Oracle Golden Gate and the EM Agent on this server; otherwise you will hit errors if processes are connection to Oracle and this will stop the patch in it's tracks. 

++++++++++++++

ORA01::OPatch>./opatchauto apply /u99/media/29176115
OPatchauto session is initiated at Thu Jun  6 01:05:19 2019

 System initialization log file is /u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/opatchautodb/systemconfig2019-06-06_01-05-21AM.log.
 Session log file is apr*

/u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/opatchauto/opatchauto2019-06-06_01-05-33AM.log
The id for this session is M521

 Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.1.0.2/dbhome
Patch applicability verified successfully on home /u01/app/oracle/product/12.1.0.2/dbhome

Verifying SQL patch applicability on home /u01/app/oracle/product/12.1.0.2/dbhome

SQL patch applicability verified successfully on home /u01/app/oracle/product/12.1.0.2/dbhome
 Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/grid/12.1.0.2/gridhome

Patch applicability verified successfully on home /u01/app/oracle/grid/12.1.0.2/gridhome
Preparing to bring down database service on home /u01/app/oracle/product/12.1.0.2/dbhome

Successfully prepared home /u01/app/oracle/product/12.1.0.2/dbhome to bring down database service
Bringing down database service on home /u01/app/oracle/product/12.1.0.2/dbhome

Following database has been stopped and will be restarted later during the session: oradb1,oradb2
Database service successfully brought down on home /u01/app/oracle/product/12.1.0.2/dbhome

 Bringing down CRS service on home /u01/app/oracle/grid/12.1.0.2/gridhome
Prepatch operation log file location: /u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/crsconfig/hapatch_2019-06-06_01-08-58AM.log

CRS service brought down successfully on home /u01/app/oracle/grid/12.1.0.2/gridhome
 Start applying binary patch on home /u01/app/oracle/product/12.1.0.2/dbhome

Binary patch applied successfully on home /u01/app/oracle/product/12.1.0.2/dbhome
 Start applying binary patch on home /u01/app/oracle/grid/12.1.0.2/gridhome

Binary patch applied successfully on home /u01/app/oracle/grid/12.1.0.2/gridhome
 Starting CRS service on home /u01/app/oracle/grid/12.1.0.2/gridhome

Postpatch operation log file location: /u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/crsconfig/hapatch_2019-06-06_01-17-34AM.log
CRS service started successfully on home /u01/app/oracle/grid/12.1.0.2/gridhome

Starting database service on home /u01/app/oracle/product/12.1.0.2/dbhome
Database service successfully started on home /u01/app/oracle/product/12.1.0.2/dbhome

Preparing home /u01/app/oracle/product/12.1.0.2/dbhome after database service restarted
No step execution required.........

Trying to apply SQL patch on home /u01/app/oracle/product/12.1.0.2/dbhome
SQL patch applied successfully on home /u01/app/oracle/product/12.1.0.2/dbhome

 OPatchAuto successful.
--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:ora01

SIDB Home:/u01/app/oracle/product/12.1.0.2/dbhome
Version:12.1.0.2.0

Summary:
 ==Following patches were SKIPPED:

 Patch: /u99/media/29176115/26983807
Reason: This patch is not applicable to this specified target type - "oracle_database"

 Patch: /u99/media/29176115/29217637

Reason: This patch is not applicable to this specified target type - "oracle_database"
 ==Following patches were SUCCESSFULLY applied:

 Patch: /u99/media/29176115/29141015
Log:/u01/app/oracle/product/12.1.0.2/dbhome/cfgtoollogs/opatchauto/core/opatch/opatch2019-06-06_01-09-21AM_1.log

 Patch: /u99/media/apr2019_patches/29176115/29141168
Log:/u01/app/oracle/product/12.1.0.2/dbhome/cfgtoollogs/opatchauto/core/opatch/opatch2019-06-06_01-09-21AM_1.log

 Host:ora01
SIHA Home:/u01/app/oracle/grid/12.1.0.2/gridhome

Version:12.1.0.2.0
Summary:

 ==Following patches were SKIPPED:
 Patch: /u99/media/29176115/26983807

Reason: This patch is already been applied, so not going to apply again.
 ==Following patches were SUCCESSFULLY applied:

 Patch: /u99/media/29176115/29141015
Log:/u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/opatchauto/core/opatch/opatch2019-06-06_01-11-21AM_1.log

 Patch: /u99/media/29176115/29141168
Log:/u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/opatchauto/core/opatch/opatch2019-06-06_01-11-21AM_1.log

 Patch: /u99/media/29176115/29217637
Log:/u01/app/oracle/grid/12.1.0.2/gridhome/cfgtoollogs/opatchauto/core/opatch/opatch2019-06-06_01-11-21AM_1.log

OPatchauto session completed at Thu Jun  6 01:25:25 2019
Time taken to complete the session 20 minutes, 6 seconds
+++++++++++++++++++

Ran this sql to confirm the patch had completed :

select patch_id, status, action_time, description from dba_registry_sqlpatch

PATCH_ID STATUS ACTION_TIME DESCRIPTION

29141015 SUCCESS 06-JUN-19 01.20.44.735844 AM DATABASE PATCH SET UPDATE 12.1.0.2.190416

So far so good, next ran the patch 29251241:  OJVM PSU Patch

Run from the 29251241 patch directory.

+++++++++++++++++++

ORA01:29251241>$ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/12.1.0.2/dbhome
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0.2/dbhome/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/dbhome/cfgtoollogs/opatch/opatch2019-06-06_01-47-07AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   29251241
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/12.1.0.2/dbhome')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '29251241' to OH '/u01/app/oracle/product/12.1.0.2/dbhome'
ApplySession: Optional component(s) [ oracle.sqlj, 12.1.0.2.0 ]  not present in the Oracle Home or a higher version is found.
Patching component oracle.javavm.server, 12.1.0.2.0...
Patching component oracle.javavm.server.core, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.javavm.client, 12.1.0.2.0...
Patching component oracle.dbjava.jdbc, 12.1.0.2.0...
Patching component oracle.dbjava.ic, 12.1.0.2.0...
Patch 29251241 successfully applied.
Sub-set patch [27475603] has become inactive due to the application of a super-set patch [29251241].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/12.1.0.2/dbhome/cfgtoollogs/opatch/opatch2019-06-06_01-47-07AM_1.log
OPatch succeeded.
+++++++++++++++++++
Checked the dba_registry_sqlpatch table (see above) but nothing was reported for the OJVM patch. 
However, ran $./opatch lsinventory and the patch was listed - needed further investigation.
COL DBMS_JAVA.LONGNAME('OK') FORMAT a9

SELECT dbms_java.longname('OK') FROM dual;

-- OK Example Output

DBMS_JAVA
---------
OK

-- Not OK Example Output

ORA-29548: Java system class reported: release of Java system classes in the database
(12.1.0.2.181016 1.6) does not match that of the oracle executable (12.1.0.2.180717 1.6)

We hit the ORA-29548 issue - if you search on the web you will see instruction on rebuilding java and lots of other stuff - in this situation ignore!
The patch had worked on other environments without issue so knew it worked.


The oracle executable on the o/s is different to that on the database - as in the error.

So we ran the a ./datapatch verbose command from the OPatch directory for each of the databases in that home and et voilla!!

The java in the database was ok - SELECT dbms_java.longname('OK') FROM dual;

DBMS_JAVA.LONGNAME('OK')

OK✔

and the dba_registry_sqlpatch was reporting correctly :

PATCH_ID STATUS          ACTION_TIME                    DESCRIPTION

29141015 SUCCESS         06-JUN-19 01.20.44.735844 AM   DATABASE PATCH SET UPDATE 12.1.0.2.190416
29251241 SUCCESS         06-JUN-19 03.59.27.168461 AM   Database PSU 12.1.0.2.190416, Oracle JavaVM Component (APR2019)


There is a good note here :

https://mikedietrichde.com/2018/04/19/do-you-have-to-execute-datapatch-when-you-create-a-new-database/

So it looks like if you running 12.2 you probably don't need to run the datapatch verbose but for the patching on 12.1 above it looks like it is necessary.

We ran a full "shake down" and integrity test on the server and it is 100% but please. please, please check patches on a test / "sand box" / QA  environment before running on Production.
For standby first patching (see section1.25 in the link below) :






Also:


So you stop replication.
Patch the standby binaries but not the data patch.
Patch the primary , but not the data patch.
Start replication.
Apply the data patch to the primary , and this will get replicated to the standby.
++++++++++++++

Oracle Database Total Size / top tables

An oracle database consists of data files, redo log files, control files, temporary files.

The size of the database actually means the total size of all these files.
select
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_files ) +
( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size from v$controlfile) "Size in GB"
from dual;



-- break down by schema  :

select owner, round(sum(bytes)/1024/1024,2) as size_in_megs from dba_segments group by owner order by 2 desc;

-- top 10 tables

select * from (
select owner, segment_name, bytes/1024/1024/1024 GB from dba_segments
where segment_type = 'TABLE' order by bytes/1024/1024 desc)
where rownum <= 10;


-- top 10 objects

select * from (
select SEGMENT_NAME, SEGMENT_TYPE, BYTES/1024/1024/1024 GB, TABLESPACE_NAME
from dba_segments order by 3 desc)
where rownum <= 10





Oracle Golden Gate - quick notes



DIRDAT                 Location of the local trail files
DIRDMP               Location of the dump files and the DEFGEN files
DIRPRM               Contains extract/datapump process config files
DIRCHK                 Location of checkpoint files
DIRDEF                 Location for data definition files created by DEFGEN
DIRPCS                 Default location for status files, do not edit these files
DIRRPT                 Location of process report files and the discard file (.dsc)
DIRTMP                Default location for storing transaction data when the size exceeds the memory size, do not edit these files

The command show all will show the location of all the relevant files:

OBY files are used to store all the configuration details
The files will be name beginning with the name of the source system, e.g. abp_ ods_ cng_
dblogin.oby        Database login details
login.oby            Golden Gate login details
mgrport.oby      Details of where and on what port the manager process is running
ora_env.oby      Oracle environment variable settings
setup.oby           alters tables for supplemental logging and registers the GG processes
tables.oby          Lists the tables to be processed
trandata.oby     Adds trandata for the tables to be processed so that the process can get the transactional data for that table.
tables_x.oby      List the tables and columns to extract
ggserr.log           Logfile that is located in the OGG home directory.

Thanks to Russell W. for putting theses notes together :)