Tuesday 8 January 2019

Apply PSU Oct 2018 patch(Patch 28349311) on 12c RAC Database Step by step





============================= Apply PSU Oct 2018 patch on 12c RAC Database Step by step =============

Apply PSU Oct 2018 patch on TestDB residing on node1/node2


Patch 28349311: GRID INFRASTRUCTURE PATCH SET UPDATE 12.1.0.2.181016

Note : This patch will used for both Grid Home and Database patching and before applying patch on rdbms home ,it need to applied on Grid Home

1)Download PSU Oct 2018 (28349311)
and Unzip the Latest OPatch to all cluster nodes using Grid user

chown oracrs:dba p28349311_121020_AIX64-5L.zip

2)Stop oem Agent and Oswatcher on both node in case it is running and check free space in RDBMS Home (atleast 22 GB free space) and /TMP
3)Stop database instance on node1
4)Take backup of oracle RDBMS home on node1(delete unnecessary log from RDBMS home, otherwise backup will take more time , remove file like old trc, aud log
find . -name '*.trc' -mtime +10 -exec ls -lrt {} \;

find . -name '*.trc' -mtime +10 -exec rm -rf {} \;

5)Star database instance on node1
Since opatchauto will stop automatically while patching .Database instance should be up and running
7) Validate inventory using using opatch lsinventory 8) Verify  database registry 
select to_char(action_time,'DD-MON-YYYY') as action_time_2, patch_id, patch_uid, action, version,  description from dba_registry_sqlpatch  order by action_time;
9) check invalid objects , components on database
set head on feed on pagesize 200 linesize 200
select owner, object_name, object_type from dba_objects where owner in ('SYS','SYSTEM') and status like 'INVALID';
col action_time format a13;
col action format a10;
col namespace format a10;
col comments format a25;
col version format a13;
set lin 200 head on feed on pagesize 100;
select i.instance_name,r.* from v$instance i, registry$history r;
10) run gather stats for dictionary

 EXECUTE dbms_stats.gather_dictionary_stats;

14)Upgrade the Opatch version to 12.2.0.1.16 or later. it is recommended to have latest opatch version

To update Opatch, use the following instructions:
A. Download the OPatch utility to a temporary directory.
B. For each Oracle RAC database home that are being patched, run the following commands as the home owner to extract the OPatch utility.
$ unzip <OPATCH-ZIP> -d <ORACLE_HOME>
$ <ORACLE_HOME>/OPatch/opatch version

or
rename old Opatch folder in rdbms home and uzipped downloaded patch using instance owner user
or change permission after uzipped

chown fuo44ppt:dba p6880880_121010_AIX64-5L.zip


11)Perform Validation of Oracle Home Inventory on both node
 <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME>

12)  Verify the Patches on both GI and RDBMS HOMES:
$ORACLE_HOME/OPatch/opatch lsinventory -oh $RDBMS_HOME
$ORACLE_HOME/OPatch/opatch lsinventory -oh $RDBMS_HOME | grep <patch no>

13)Check for conflicts in  the 12.1 GI home from root user
#ORACLE_HOME/OPatch/opatchauto apply <UNZIPPED_PATCH_LOCATION>/26635815 -analyze -oh <ORACLE_RAC_HOME>


15)
Go to opatch directory and validate/analyze patch  using opatchauto utility from root user as below

[node1:root:/u06/oracle/testdb/product/12.1.0.2/OPatch:]

export PATH=$PATH:/u06/oracle/testdb/product/12.1.0.2/OPatch
cd /u06/oracle/testdb/product/12.1.0.2/OPatch


 ./opatchauto apply  /oswatcher/28349311 -analyze -oh /u06/oracle/testdb/product/12.1.0.2

 16) apply patch on RDBMS  from root user


[node1:root:/u06/oracle/testdb/product/12.1.0.2/OPatch:]

export PATH=$PATH:/u06/oracle/testdb/product/12.1.0.2/OPatch
cd /u06/oracle/testdb/product/12.1.0.2/OPatch


 ./opatchauto apply  /oswatcher/28349311  -oh /u06/oracle/testdb

17)Start database instance instances on node1 if not started automatically
10)Stop database instance on node2
4)Take backup of oracle RAC home and inventory  on node2
5)Star database instance on node2
Since opatchauto will stop automatically while patching .Database instance  should be up and running
11)Repeat Steps   on node2
12)Start database database instances on node2 in case not started automatically
13)verify select * from dba_registry_sqlpatch ;
14)Validate objects , components and verify if patch is installed properly
15)Start the application and Release all related jobs which were on hold
16)Application team will check the application if that working as it is


Note:
The step "Loading Modified SQL Files into the Database" has been removed from this section as the execution of opatchauto automatically performs the load of the modified SQL files into the Database.


Details:


Precheck


node1[/u06/oracle/TestDB]$ cd
node1[/u06/oracle/TestDB]$ adrci

ADRCI: Release 12.1.0.2.0 - Production on Mon Dec 31 07:47:29 2018

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u06/oracle/TestDB"
adrci> show alert

Choose the home from which to view the alert log:

1: diag/asm/user_TestDB/host_2865234568_80
2: diag/asmtool/user_TestDB/host_2865234568_80
3: diag/clients/user_TestDB/host_2865234568_80
4: diag/clients/user_TestDB/host_2865234568_82
5: diag/rdbms/TestDB/TestDB1
Q: to quit

Please select option:
node1[/u06/oracle/TestDB]$ cd /u06/oracle/TestDB
node1[/u06/oracle/TestDB]$ cd diag/rdbms/TestDB/TestDB1
node1[/u06/oracle/TestDB/diag/rdbms/TestDB/TestDB1]$ ls -ltr
total 624
drwxr-x---    2 TestDB dba             256 Dec 30 2011  metadata_dgif
drwxr-x---    2 TestDB dba             256 Dec 30 2011  incpkg
drwxr-x---    2 TestDB dba             256 Dec 30 2011  hm
drwxr-x---    2 TestDB dba             256 Dec 30 2011  cdump
drwxr-x---    2 TestDB dba             256 May 26 2014  ir
drwxr-x---    6 TestDB dba             256 Jun  1 2016  log
drwxr-x---    2 TestDB dba             256 Jun  1 2016  metadata_pv
drwxr-x---    2 TestDB dba            4096 Jun  1 2016  metadata
drwxr-x---    4 TestDB dba             256 Oct 15 01:28 incident
drwxr-x---    2 TestDB dba             256 Oct 15 01:28 sweep
drwxr-x---    2 TestDB dba             256 Oct 15 01:28 stage
drwxr-x---    2 TestDB dba            4096 Oct 15 01:28 lck
drwxr-x---    2 TestDB dba            4096 Oct 15 12:28 alert
drwxr-x---    2 TestDB dba          290816 Dec 31 07:45 trace
node1[/u06/oracle/TestDB/diag/rdbms/TestDB/TestDB1]$

find . -name '*.trc' -mtime +10 -exec ls -lrt {} \;

find . -name '*.trc' -mtime +10 -exec rm -rf {} \;

audit file is in base location

node1[/u06/oracle/TestDB]$
node1[/u06/oracle/TestDB]$ pwd
/u06/oracle/TestDB
node1[/u06/oracle/TestDB]$ echo $ORACLE_BASE
/u06/oracle/TestDB
node1[/u06/oracle/TestDB]$


find ./ -name "*.aud" -mtime +10 -exec ls -l {} \;

find ./ -name "*.aud" -mtime +10 -exec rm {} \;



SQL>
select name,open_mode from v$databaseSQL>
  2  ;

NAME      OPEN_MODE
--------- --------------------
TestDB  READ WRITE

SQL>
select count(1),inst_id from gv$session group by inst_id;SQL>

  COUNT(1)    INST_ID
---------- ----------
       735          1
       718          2




SQL> alter system archive log current;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL>


SQL>
SQL> set linesize 200
SQL>
SQL> spool precheck.log
SQL>
SQL> select to_char(action_time,'DD-MON-YYYY') as action_time_2, patch_id, patch_uid, action, version,  description from dba_registry_sqlpatch  order by action_time;
SP2-0734: unknown command beginning "elect to_c..." - rest of line ignored.
SQL> select to_char(action_time,'DD-MON-YYYY') as action_time_2, patch_id, patch_uid, action, version,  description from dba_registry_sqlpatch  order by action_time;

ACTION_TIME_2          PATCH_ID  PATCH_UID ACTION          VERSION              DESCRIPTION
-------------------- ---------- ---------- --------------- -------------------- ----------------------------------------------------------------------------------------------------
01-JUN-2016            22291127   19983562 APPLY           12.1.0.2             Database Patch Set Update : 12.1.0.2.160419 (22291127)
28-DEC-2016            24006101   20648640 APPLY           12.1.0.2             Database Patch Set Update : 12.1.0.2.161018 (24006101)
28-JAN-2018            26713565   21606134 APPLY           12.1.0.2             DATABASE PATCH SET UPDATE 12.1.0.2.171017

SQL> set head on feed on pagesize 200 linesize 200
SQL> select owner, object_name, object_type from dba_objects where owner in ('SYS','SYSTEM') and status like 'INVALID';

no rows selected

SQL>
SQL>
SQL> col action_time format a13;
col action format a10;
col namespace format a10;
col comments format a25;
col version format a13;
set lin 200 head on feed on pagesize 100;
select i.instance_name,r.* from v$instance i, registry$history r;  SQL> SQL> SQL> SQL> SQL> SQL>

INSTANCE_NAME    ACTION_TIME   ACTION     NAMESPACE  VERSION               ID COMMENTS                  BUNDLE_SERIES
---------------- ------------- ---------- ---------- ------------- ---------- ------------------------- ------------------------------
TestDB1        21-OCT-11 04. APPLY      SERVER     11.2.0.3               0 Patchset 11.2.0.2.0       PSU
                 48.04.498723
                 AM

TestDB1        30-DEC-11 09. APPLY      SERVER     11.2.0.3               0 Patchset 11.2.0.2.0       PSU
                 38.34.326861
                 AM

TestDB1        04-FEB-13 05. APPLY      SERVER     11.2.0.3               5 CPUJan2013                CPU
                 41.51.480687
                 PM

TestDB1        26-MAY-14 10. APPLY      SERVER     11.2.0.3               9 PSU 11.2.0.3.9            PSU
                 57.13.686893
                 PM

TestDB1        01-JUN-16 01. VIEW INVAL                             8289601 view invalidation
                 14.51.453387  IDATE
                 PM

TestDB1                      BOOTSTRAP  DATAPATCH  12.1.0.2                 RDBMS_12.1.0.2.0DBPSU_AIX
                                                                              .PPC64_161210


6 rows selected.

SQL>  EXECUTE dbms_stats.gather_dictionary_stats;

PL/SQL procedure successfully completed.




To update Opatch, use the following instructions:
Download the OPatch utility to a temporary directory.
For each Oracle RAC database home and the GI home that are being patched, run the following commands as the home owner to extract the OPatch utility.
$ unzip <OPATCH-ZIP> -d <ORACLE_HOME>
$ <ORACLE_HOME>/OPatch/opatch version


/u06/oracle/TestDB/product/12.1.0.2

cd /oswatcher

cp    p6880880_121010_AIX64-5L.zip /u06/oracle/TestDB/product/12.1.0.2/

chown TestDB:dba p6880880_121010_AIX64-5L.zip




unzip <OPATCH-ZIP> -d <ORACLE_HOME>
or

drwxr-xr-x    2 TestDB dba           12288 Jan 28 2018  bin
drwxr-xr-x    4 TestDB dba             256 Aug 16 13:54 log
drwxr-x---   15 TestDB dba            4096 Oct 23 11:24 OPatch_old
drwxr-xr-x    2 TestDB dba            4096 Dec 31 04:42 dbs
drwxr-xr-x    2 TestDB dba             256 Dec 31 04:43 QOpatch
-rw-------    1 TestDB dba       148094631 Dec 31 07:16 p6880880_121010_AIX64-5L.zip
node1[/u06/oracle/TestDB/product/12.1.0.2]$ unzp
node1[/u06/oracle/TestDB/product/12.1.0.2]$ unzip p6880880_121010_AIX64-5L.zip


node1[/u06/oracle/TestDB/product/12.1.0.2]$
node1[/u06/oracle/TestDB/product/12.1.0.2]$ cd OPatch
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$ opatch version
OPatch Version: 12.2.0.1.16

OPatch succeeded.
node1[/u06/oracle/TestDB/product/12.1.0.2/Opatch]$


<ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME


node1[/u06/oracle/TestDB/product/12.1.0.2]$ cd OPatch
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$ opatch version
OPatch Version: 12.2.0.1.16

OPatch succeeded.
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$ opatch lsinventory -detail -oh $ORACLE_HOME
Oracle Interim Patch Installer version 12.2.0.1.16
Copyright (c) 2018, Oracle Corporation.  All rights reserved.


Oracle Home       : /u06/oracle/TestDB/product/12.1.0.2
Central Inventory : /u02/oracle/oraInventory
   from           : /u06/oracle/TestDB/product/12.1.0.2/oraInst.loc
OPatch version    : 12.2.0.1.16
OUI version       : 12.1.0.2.0
Log file location : /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatch/opatch2018-12-31_07-21-36AM_1.log

Lsinventory Output file location : /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatch/lsinv/lsinventory2018-12-31_07-21-36AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: node1
ARU platform id: 212
ARU platform description:: IBM_AIX

Installed Top-level Products (1):

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


Installed Products (133):

Assistant Common Files                                               12.1.0.2.0
Buildtools Common Files                                              12.1.0.2.0
Cluster Verification Utility Common Files                            12.1.0.2.0
Database Configuration and Upgrade Assistants                        12.1.0.2.0
Database Migration Assistant for Unicode                             12.1.0.2.0
Database SQL Scripts                                                 12.1.0.2.0
Database Workspace Manager                                           12.1.0.2.0
DB TOOLS Listener                                                    12.1.0.2.0
Deinstallation Tool                                                  12.1.0.2.0
Enterprise Edition Options                                           12.1.0.2.0
Expat libraries                                                       2.0.1.0.2









from root user


ls -ltr /u06/oracle/TestDB/product/12.1.0.2

ls -ltr /oswatcher/28349311

node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$
node1[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$ echo $ORACLE_HOME
/u06/oracle/TestDB/product/12.1.0.2
node1[/u06/oracle/TestDB/product/12.1.0.2/Opatch]$

node1:root:/u06/oracle/TestDB/product/12.1.0.2:]
[node1:root:/u06/oracle/TestDB/product/12.1.0.2:] id
uid=0(root) gid=0(system) groups=208(tivlogs)
[node1:root:/u06/oracle/TestDB/product/12.1.0.2:] cd OPatch
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/Opatch:]

[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:] df -g /u06/oracle/TestDB/product/12.1.0.2/OPatch
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/u06_lv       94.00     61.74   35%   130298     1% /u06
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/Opatch:]

[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:] df -g /tmp
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd3           1.25      1.21    4%      560     1% /tmp
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]

export PATH=$PATH:/u06/oracle/TestDB/product/12.1.0.2/OPatch


 ./opatchauto apply  /oswatcher/28349311 -analyze -oh /u06/oracle/TestDB/product/12.1.0.2



[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:] ./opatchauto apply  /oswatcher/28349311 -analyze -oh /u06/oracle/TestDB/product/12.1.0.2

OPatchauto session is initiated at Mon Dec 31 07:29:37 2018

System initialization log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchautodb/systemconfig2018-12-31_07-30-37AM.log.

Session log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/opatchauto2018-12-31_07-32-41AM.log
The id for this session is UDM5

Executing OPatch prereq operations to verify patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
Patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Verifying SQL patch applicability on home /u06/oracle/TestDB/product/12.1.0.2

Following step failed during analysis:
 /bin/sh -c 'cd /u06/oracle/TestDB/product/12.1.0.2; ORACLE_HOME=/u06/oracle/TestDB/product/12.1.0.2 ORACLE_SID=TestDB1 /u06/oracle/TestDB/product/12.1.0.2/OPatch/datapatch -prereq -verbose'

SQL patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2

OPatchAuto successful.

--------------------------------Summary--------------------------------

Analysis for applying patches has completed successfully:

Host:node1
RAC Home:/u06/oracle/TestDB/product/12.1.0.2
Version:12.1.0.2.0


==Following patches were SKIPPED:

Patch: /oswatcher/28349311/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /oswatcher/28349311/28259950
Reason: This patch is not applicable to this specified target type - "rac_database"


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /oswatcher/28349311/28259833
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_07-33-12AM_1.log

Patch: /oswatcher/28349311/28259914
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_07-33-12AM_1.log



OPatchauto session completed at Mon Dec 31 07:35:04 2018
Time taken to complete the session 5 minutes, 30 seconds
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/Opatch:]


=============apply patch on particular database===============


 ./opatchauto apply  /oswatcher/28349311  -oh /u06/oracle/TestDB/product/12.1.0.2




OPatchauto session completed at Mon Dec 31 10:00:46 2018
Time taken to complete the session 4 minutes, 19 seconds
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]  ./opatchauto apply  /oswatcher/28349311  -oh /u06/oracle/TestDB/product/12.1.0.2

OPatchauto session is initiated at Mon Dec 31 10:01:34 2018

System initialization log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchautodb/systemconfig2018-12-31_10-02-13AM.log.

Session log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/opatchauto2018-12-31_10-03-14AM.log
The id for this session is GV9N

Executing OPatch prereq operations to verify patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
Patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Verifying SQL patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
SQL patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Preparing to bring down database service on home /u06/oracle/TestDB/product/12.1.0.2
Successfully prepared home /u06/oracle/TestDB/product/12.1.0.2 to bring down database service


Bringing down database service on home /u06/oracle/TestDB/product/12.1.0.2
Following database(s) and/or service(s) are stopped and will be restarted later during the session: TestDB
Database service successfully brought down on home /u06/oracle/TestDB/product/12.1.0.2


Performing prepatch operation on home /u06/oracle/TestDB/product/12.1.0.2
Perpatch operation completed successfully on home /u06/oracle/TestDB/product/12.1.0.2


Start applying binary patch on home /u06/oracle/TestDB/product/12.1.0.2
Successfully executed command: /usr/sbin/slibclean

Binary patch applied successfully on home /u06/oracle/TestDB/product/12.1.0.2


Performing postpatch operation on home /u06/oracle/TestDB/product/12.1.0.2
Postpatch operation completed successfully on home /u06/oracle/TestDB/product/12.1.0.2


Starting database service on home /u06/oracle/TestDB/product/12.1.0.2
Database service successfully started on home /u06/oracle/TestDB/product/12.1.0.2


Preparing home /u06/oracle/TestDB/product/12.1.0.2 after database service restarted
No step execution required.........


Trying to apply SQL patch on home /u06/oracle/TestDB/product/12.1.0.2
SQL patch applied successfully on home /u06/oracle/TestDB/product/12.1.0.2

OPatchAuto successful.

--------------------------------Summary--------------------------------

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

Host:node1
RAC Home:/u06/oracle/TestDB/product/12.1.0.2
Version:12.1.0.2.0
Summary:

==Following patches were SKIPPED:

Patch: /oswatcher/28349311/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /oswatcher/28349311/28259950
Reason: This patch is not applicable to this specified target type - "rac_database"


==Following patches were SUCCESSFULLY applied:

Patch: /oswatcher/28349311/28259833
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-06-06AM_1.log

Patch: /oswatcher/28349311/28259914
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-06-06AM_1.log



OPatchauto session completed at Mon Dec 31 10:12:12 2018
Time taken to complete the session 10 minutes, 39 seconds
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]
[node1:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]




=========Database TestDB====node2


drwxr-xr-x    2 TestDB dba           16384 Jan 28 2018  lib
drwxr-xr-x    7 TestDB dba            4096 Jan 28 2018  install
drwxr-xr-x    2 TestDB dba           12288 Jan 28 2018  bin
drwxr-xr-x    2 TestDB dba             256 Dec 31 05:41 dbs
drwxr-xr-x    2 TestDB dba             256 Dec 31 07:34 QOpatch
node2[/u06/oracle/TestDB/product/12.1.0.2]$ mv OPatch OPatch_31_dec
node2[/u06/oracle/TestDB/product/12.1.0.2]$ exit
logout
[node2:root:/home/root:] cd /oswatcher
[node2:root:/oswatcher:] ls -ltr
total 6001304
drwxr-xr-x    2 root     system          256 Jun 24 2015  lost+found
drwxr-xr-x    3 oracrs   dba             256 Jul  6 2015  osw_install
drwxrwxr-x    4 fub44ppt dba            4096 Jan 11 2016  orachk
-rw-------    1 oracrs   dba               0 Jul 10 2016  nohup.out
drwxr-xr-x    7 oracrs   dba             256 Oct 12 13:43 28349311
-rw-rw-r--    1 oracrs   dba          256911 Oct 24 11:34 PatchSearch.xml
-rw-------    1 eibm994  staff     167499907 Dec 24 15:07 p6880880_112000_AIX64-5L.zip
-rw-------    1 oracrs   dba       148094631 Dec 24 15:09 p6880880_121010_AIX64-5L.zip
-rwx------    1 oracrs   dba      2753239498 Dec 24 15:19 p28349311_121020_AIX64-5L.zip
-rw-r--r--    1 oracrs   dba         3553280 Dec 27 11:16 grid_home_inventory.tar
[node2:root:/oswatcher:]


[node2:root:/oswatcher:] cp p6880880_121010_AIX64-5L.zip /u06/oracle/TestDB/product/12.1.0.2/
[node2:root:/oswatcher:] id
uid=0(root) gid=0(system) groups=208(tivlogs)
[node2:root:/oswatcher:]


chown TestDB:dba p6880880_121010_AIX64-5L.zip


unzip then


node2[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$
node2[/u06/oracle/TestDB/product/12.1.0.2/OPatch]$ opatch version
OPatch Version: 12.2.0.1.16

OPatch succeeded.
node2[/u06/oracle/TestDB/product/12.1.0.2/Opatch]$


node1[/u06/oracle/TestDB]$ cd
node1[/u06/oracle/TestDB]$ adrci

ADRCI: Release 12.1.0.2.0 - Production on Mon Dec 31 07:47:29 2018

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u06/oracle/TestDB"
adrci> show alert

Choose the home from which to view the alert log:

1: diag/asm/user_TestDB/host_2865234568_80
2: diag/asmtool/user_TestDB/host_2865234568_80
3: diag/clients/user_TestDB/host_2865234568_80
4: diag/clients/user_TestDB/host_2865234568_82
5: diag/rdbms/TestDB/TestDB1
Q: to quit

Please select option:
node1[/u06/oracle/TestDB]$ cd /u06/oracle/TestDB
node1[/u06/oracle/TestDB]$ cd diag/rdbms/TestDB/TestDB1
node1[/u06/oracle/TestDB/diag/rdbms/TestDB/TestDB1]$ ls -ltr
total 624
drwxr-x---    2 TestDB dba             256 Dec 30 2011  metadata_dgif
drwxr-x---    2 TestDB dba             256 Dec 30 2011  incpkg
drwxr-x---    2 TestDB dba             256 Dec 30 2011  hm
drwxr-x---    2 TestDB dba             256 Dec 30 2011  cdump
drwxr-x---    2 TestDB dba             256 May 26 2014  ir
drwxr-x---    6 TestDB dba             256 Jun  1 2016  log
drwxr-x---    2 TestDB dba             256 Jun  1 2016  metadata_pv
drwxr-x---    2 TestDB dba            4096 Jun  1 2016  metadata
drwxr-x---    4 TestDB dba             256 Oct 15 01:28 incident
drwxr-x---    2 TestDB dba             256 Oct 15 01:28 sweep
drwxr-x---    2 TestDB dba             256 Oct 15 01:28 stage
drwxr-x---    2 TestDB dba            4096 Oct 15 01:28 lck
drwxr-x---    2 TestDB dba            4096 Oct 15 12:28 alert
drwxr-x---    2 TestDB dba          290816 Dec 31 07:45 trace
node1[/u06/oracle/TestDB/diag/rdbms/TestDB/TestDB1]$

find . -name '*.trc' -mtime +10 -exec ls -lrt {} \;

find . -name '*.trc' -mtime +10 -exec rm -rf {} \;

audit file is in base location

node1[/u06/oracle/TestDB]$
node1[/u06/oracle/TestDB]$ pwd
/u06/oracle/TestDB
node1[/u06/oracle/TestDB]$ echo $ORACLE_BASE
/u06/oracle/TestDB
node1[/u06/oracle/TestDB]$


find ./ -name "*.aud" -mtime +10 -exec ls -l {} \;

find ./ -name "*.aud" -mtime +10 -exec rm {} \;


Backup Database home


cd /u02/oracle/oraInventory


Backup for inventory


srvctl stop instance -d TestDB -i TestDB2 -o immediate

cd /u02/oracle/oraInventory

tar -cvf /oswatcher/Database_TestDB_inventory.tar .
tar -cvf /oswatcher/Database_TestDB_home.tar .

du -sg  /oswatcher/Database_TestDB home_.tar

srvctl start instance -d TestDB -i TestDB2


from root user

export PATH=$PATH:/u06/oracle/TestDB/product/12.1.0.2/OPatch

./opatchauto apply  /oswatcher/28349311 -analyze -oh /u06/oracle/TestDB/product/12.1.0.2


 ./opatchauto apply  /oswatcher/28349311  -oh /u06/oracle/TestDB/product/12.1.0.2



[node2:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]
[node2:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:] ps -ef|grep pmon
  oracrs 12189922        1   0 05:31:26      -  0:00 asm_pmon_+ASM2
    root 16122084 30998976   0 10:49:23  pts/0  0:00 grep pmon
TestDB 20447448        1   0 10:44:41      -  0:00 ora_pmon_TestDB2
fub44ppt 28115072        1   0 05:42:09      -  0:03 ora_pmon_fub44ppt2
   fsnft 29819116        1   0 05:42:52      -  0:01 ora_pmon_FSNFT2
fug44ppt 42598422        1   0 05:43:51      -  0:01 ora_pmon_fug44ppt2
[node2:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:] ./opatchauto apply  /oswatcher/28349311 -analyze -oh /u06/oracle/TestDB/product/12.1.0.2

OPatchauto session is initiated at Mon Dec 31 10:49:33 2018

System initialization log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchautodb/systemconfig2018-12-31_10-50-27AM.log.

Session log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/opatchauto2018-12-31_10-51-32AM.log
The id for this session is 7KG3

Executing OPatch prereq operations to verify patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
Patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Verifying SQL patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
SQL patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2

OPatchAuto successful.

--------------------------------Summary--------------------------------

Analysis for applying patches has completed successfully:

Host:node2
RAC Home:/u06/oracle/TestDB/product/12.1.0.2
Version:12.1.0.2.0


==Following patches were SKIPPED:

Patch: /oswatcher/28349311/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /oswatcher/28349311/28259950
Reason: This patch is not applicable to this specified target type - "rac_database"


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /oswatcher/28349311/28259833
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-52-01AM_1.log

Patch: /oswatcher/28349311/28259914
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-52-01AM_1.log



OPatchauto session completed at Mon Dec 31 10:53:49 2018
Time taken to complete the session 4 minutes, 18 seconds
[node2:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]  ./opatchauto apply  /oswatcher/28349311  -oh /u06/oracle/TestDB/product/12.1.0.2

OPatchauto session is initiated at Mon Dec 31 10:54:31 2018

System initialization log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchautodb/systemconfig2018-12-31_10-55-09AM.log.

Session log file is /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/opatchauto2018-12-31_10-56-06AM.log
The id for this session is TRJ4

Executing OPatch prereq operations to verify patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
Patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Verifying SQL patch applicability on home /u06/oracle/TestDB/product/12.1.0.2
SQL patch applicability verified successfully on home /u06/oracle/TestDB/product/12.1.0.2


Preparing to bring down database service on home /u06/oracle/TestDB/product/12.1.0.2
Successfully prepared home /u06/oracle/TestDB/product/12.1.0.2 to bring down database service


Bringing down database service on home /u06/oracle/TestDB/product/12.1.0.2
Following database(s) and/or service(s) are stopped and will be restarted later during the session: TestDB
Database service successfully brought down on home /u06/oracle/TestDB/product/12.1.0.2


Performing prepatch operation on home /u06/oracle/TestDB/product/12.1.0.2
Perpatch operation completed successfully on home /u06/oracle/TestDB/product/12.1.0.2


Start applying binary patch on home /u06/oracle/TestDB/product/12.1.0.2
Successfully executed command: /usr/sbin/slibclean

Binary patch applied successfully on home /u06/oracle/TestDB/product/12.1.0.2


Performing postpatch operation on home /u06/oracle/TestDB/product/12.1.0.2
Postpatch operation completed successfully on home /u06/oracle/TestDB/product/12.1.0.2


Starting database service on home /u06/oracle/TestDB/product/12.1.0.2
Database service successfully started on home /u06/oracle/TestDB/product/12.1.0.2


Preparing home /u06/oracle/TestDB/product/12.1.0.2 after database service restarted
No step execution required.........


Trying to apply SQL patch on home /u06/oracle/TestDB/product/12.1.0.2
SQL patch applied successfully on home /u06/oracle/TestDB/product/12.1.0.2

OPatchAuto successful.

--------------------------------Summary--------------------------------

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

Host:node2
RAC Home:/u06/oracle/TestDB/product/12.1.0.2
Version:12.1.0.2.0
Summary:

==Following patches were SKIPPED:

Patch: /oswatcher/28349311/26983807
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /oswatcher/28349311/28259950
Reason: This patch is not applicable to this specified target type - "rac_database"


==Following patches were SUCCESSFULLY applied:

Patch: /oswatcher/28349311/28259833
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-58-58AM_1.log

Patch: /oswatcher/28349311/28259914
Log: /u06/oracle/TestDB/product/12.1.0.2/cfgtoollogs/opatchauto/core/opatch/opatch2018-12-31_10-58-58AM_1.log



OPatchauto session completed at Mon Dec 31 11:05:50 2018
Time taken to complete the session 11 minutes, 20 seconds
[node2:root:/u06/oracle/TestDB/product/12.1.0.2/OPatch:]






SQL> set linesize 200
SQL>
SQL> select to_char(action_time,'DD-MON-YYYY') as action_time_2, patch_id, patch_uid, action, version,  description from dba_registry_sqlpatch  order by action_time;

ACTION_TIME_2          PATCH_ID  PATCH_UID ACTION          VERSION              DESCRIPTION
-------------------- ---------- ---------- --------------- -------------------- ----------------------------------------------------------------------------------------------------
01-JUN-2016            22291127   19983562 APPLY           12.1.0.2             Database Patch Set Update : 12.1.0.2.160419 (22291127)
28-DEC-2016            24006101   20648640 APPLY           12.1.0.2             Database Patch Set Update : 12.1.0.2.161018 (24006101)
28-JAN-2018            26713565   21606134 APPLY           12.1.0.2             DATABASE PATCH SET UPDATE 12.1.0.2.171017
31-DEC-2018            28259833   22490763 APPLY           12.1.0.2             DATABASE PATCH SET UPDATE 12.1.0.2.181016

SQL>



SQL> set head on feed on pagesize 200 linesize 200
select owner, object_name, object_type from dba_objects where owner in ('SYS','SYSTEM') and status like 'INVALID';SQL>

no rows selected

SQL> col action_time format a13;
col action format a10;
col namespace format a10;
col comments format a25;
col version format a13;
set lin 200 head on feed on pagesize 100;
select i.instance_name,r.* from v$instance i, registry$history r;  SQL> SQL> SQL> SQL> SQL> SQL>

INSTANCE_NAME    ACTION_TIME   ACTION     NAMESPACE  VERSION               ID COMMENTS                  BUNDLE_SERIES
---------------- ------------- ---------- ---------- ------------- ---------- ------------------------- ------------------------------
TestDB2        21-OCT-11 04. APPLY      SERVER     11.2.0.3               0 Patchset 11.2.0.2.0       PSU
                 48.04.498723
                 AM

TestDB2        30-DEC-11 09. APPLY      SERVER     11.2.0.3               0 Patchset 11.2.0.2.0       PSU
                 38.34.326861
                 AM

TestDB2        04-FEB-13 05. APPLY      SERVER     11.2.0.3               5 CPUJan2013                CPU
                 41.51.480687
                 PM

TestDB2        26-MAY-14 10. APPLY      SERVER     11.2.0.3               9 PSU 11.2.0.3.9            PSU
                 57.13.686893
                 PM

TestDB2        01-JUN-16 01. VIEW INVAL                             8289601 view invalidation
                 14.51.453387  IDATE
                 PM

TestDB2                      BOOTSTRAP  DATAPATCH  12.1.0.2                 RDBMS_12.1.0.2.0DBPSU_AIX


                                                                              .PPC64_161210


6 rows selected.

SQL>  EXECUTE dbms_stats.gather_dictionary_stats;

select * from dba_registry_sqlpatch




SQL> select * from dba_registry_sqlpatch;

  PATCH_ID  PATCH_UID VERSION       FLAGS      ACTION     STATUS          INSTALL_ID ACTION_TIME   DESCRIPTION
---------- ---------- ------------- ---------- ---------- --------------- ---------- ------------- ----------------------------------------------------------------------------------------------------
BUNDLE_SERIES                   BUNDLE_ID BUNDLE_DATA
------------------------------ ---------- --------------------------------------------------------------------------------
PATCH_DESCRIPTOR
--------------------------------------------------------------------------------
PATCH_DIRECTORY
----------------------------------------------------------------------------------------------------------------------------------------------------------------
LOGFILE
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  22291127   19983562 12.1.0.2      NB         APPLY      SUCCESS                    01-JUN-16 03. Database Patch Set Update : 12.1.0.2.160419 (22291127)
                                                                                     26.32.189231
                                                                                     PM
PSU                                160419 <bundledata version="12.1.0.2.1" series="Patch Set Update">
                                            <bundle id="1" des


/u06/oracle/TestDB/cfgtoollogs/sqlpatch/22291127/19983562/22291127_apply_TestDB_2016Jun01_15_25_36.log

  24006101   20648640 12.1.0.2      NB         APPLY      SUCCESS                    28-DEC-16 03. Database Patch Set Update : 12.1.0.2.161018 (24006101)
                                                                                     14.12.963805
                                                                                     PM
PSU                                161018 <bundledata version="12.1.0.2.1" series="Patch Set Update">
                                            <bundle id="1" des


/u06/oracle/TestDB/cfgtoollogs/sqlpatch/24006101/20648640/24006101_apply_TestDB_2016Dec28_15_13_51.log

  26713565   21606134 12.1.0.2      NB         APPLY      SUCCESS                  1 28-JAN-18 02. DATABASE PATCH SET UPDATE 12.1.0.2.171017
                                                                                     01.27.971955
                                                                                     PM
PSU                                171017 <bundledata version="12.1.0.2.1" series="Patch Set Update">
                                            <bundle id="1" des
<?xml version="1.0" encoding="utf-8"?>
<sqlPatch ID="26713565" uniquePatchID="21
504B03041400000008008D60434B06D872AA8C020000321000000C00000032363731333536352E786D6CBD9759739B3010C7DFF329347A6E6D8E806106C850DB3D669ADAAD9D4CFBE41120BBAA252173
/u06/oracle/TestDB/cfgtoollogs/sqlpatch/26713565/21606134/26713565_apply_TestDB_2018Jan28_14_00_44.log

  28259833   22490763 12.1.0.2      NB         APPLY      SUCCESS                  2 31-DEC-18 11. DATABASE PATCH SET UPDATE 12.1.0.2.181016
                                                                                     05.49.384504
                                                                                     AM
PSU                                181016 <?xml version="1.0" encoding="UTF-8"?>
                                          <bundledata version="12.1.0.2.1" series="
<?xml version="1.0" encoding="utf-8"?>
<sqlPatch ID="28259833" uniquePatchID="22
504B0304140000000800016D4C4D2F53D926F7020000641600000C00000032383235393833332E786D6CBD985D73E2201486EFFB2B18AE7735898D4D66341DB7BA1F33BBD55D6DA77BE524012D150892
/u06/oracle/TestDB/cfgtoollogs/sqlpatch/28259833/22490763/28259833_apply_TestDB_2018Dec31_11_05_01.log


4 rows selected.

SQL>

No comments:

Post a Comment