Search This Blog

Total Pageviews

Sunday 30 April 2017

Oracle Upgrade path as Per Metalink Note 2189854.1


Oracle Upgrade path as Per Metalink Note 2189854.1  ...


Database Server Upgrade/Downgrade Compatibility Matrix (Doc ID 551141.1)




Direct Upgrade to 12.2:
Source DatabaseTarget Database
11.2.0.3 and higher12.2.0.x
12.1.0.x (12.1.0.1 - 12.1.0.2)12.2.0.x

Indirect Upgrade to 12.2:
Source DatabaseUpgrade PathTarget Database
7.3.3 (lower)7.3.4 --> 9.2.0.8 --> 11.2.0.3 or higher12.2.0.x
8.0.5 ( or lower )8.0.6 --> 9.2.0.8 --> 11.2.0.3 or higher12.2.0.x
8.1.7 ( or lower )8.1.7 --> 9.2.0.8 --> 11.2.0.3 or higher12.2.0.x
9.0.1.3 ( or lower )9.0.1.3 --> 9.2.0.8 --> 11.2.0.3 or higher12.2.0.x
9.2.0.7 ( or lower )9.2.0.7 --> 11.2.0.3 or higher12.2.0.x
10.2.0.4 ( or lower )10.2.0.4 --> 11.2.0.3 or higher12.2.0.x
11.1.0.611.1.0.6 --> 11.2.0.3 or higher12.2.0.x
11.2.0.111.2.0.1 --> 11.2.0.3 or higher12.2.0.x




Helpful metalink note ..
Note: 2173141.1 Complete Checklist for Manual Upgrades to non-CDB Oracle Database 12.2
Note: 2173144.1 Complete Checklist for Manual Upgrade for Multitenant Architecture Oracle Databases from 12.1. to 12.2.
Note: 2189854.1 Complete Checklist for Upgrading to Oracle Database 12.2 using DBUA for Known Issues and Alerts
Note: 2239820.1 12.2.0.1 Base Release – Availability and Known Issues


Friday 28 April 2017

Oracle 12c cloning pdb without local undo tablespace ...

Oracle 12c clone pdb !!!



[oracle@vbgeneric ~]$  export TWO_TASK=
[oracle@vbgeneric ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 28 04:14:36 2017

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


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


set linesize 200
COL VERSION FORMAT A15
COL STATUS  FORMAT A20
COL PRODUCT FORMAT a50
SELECT * FROM PRODUCT_COMPONENT_VERSION;

PRODUCT                                            VERSION         STATUS
-------------------------------------------------- --------------- --------------------
NLSRTL                                             12.1.0.2.0      Production
Oracle Database 12c Enterprise Edition             12.1.0.2.0      64bit Production
PL/SQL                                             12.1.0.2.0      Production
TNS for Linux:                                     12.1.0.2.0      Production


SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE    12.1.0.2.0      Production
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production



SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
ORCL                           READ WRITE <<<<<<Create duplicate database from this database to ORCLDB
ORDS                           READ WRITE
ANUJ                           MOUNTED
VIHAAN                         MOUNTED


In tnsname.ora file 

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

 tnsping ORCL

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 28-APR-2017 04:19:24

Copyright (c) 1997, 2014, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.1.0.2/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)



check sys connection ..


[oracle@vbgeneric dbs]$ sqlplus 'sys/vihaan@orcl as sysdba'

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 28 04:52:17 2017

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



set linesize 200 pagesize 200
col FILE_NAME   for a70
SELECT CON_ID, TABLESPACE_NAME,FILE_NAME FROM CDB_DATA_FILES ;

    CON_ID TABLESPACE_NAME                FILE_NAME
---------- ------------------------------ ----------------------------------------------------------------------
         3 SYSTEM                         /u01/app/oracle/oradata/orcl12c/orcl/system01.dbf
         3 SYSAUX                         /u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf
         3 USERS                          /u01/app/oracle/oradata/orcl12c/orcl/SAMPLE_SCHEMA_users01.dbf
         3 EXAMPLE                        /u01/app/oracle/oradata/orcl12c/orcl/example01.dbf
         3 APEX_1851336378250219          /u01/app/oracle/oradata/orcl12c/orcl/APEX_1851336378250219.dbf
         3 APEX_5457999048253711          /u01/app/oracle/oradata/orcl12c/orcl/APEX_5457999048253711.dbf
         3 APEX_5500333564645084          /u01/app/oracle/oradata/orcl12c/orcl/APEX_5500333564645084.dbf

7 rows selected.

create dir ...

cd /u01/app/oracle/oradata/orcl12c/

[oracle@vbgeneric orcl12c]$ mkdir orcldp

[oracle@vbgeneric orcl12c]$ ls -ld */
drwxr-x--- 2 oracle oinstall 4096 Apr 21 16:01 ANUJ/
drwxr-x--- 2 oracle oinstall 4096 Nov 20 12:14 orcl/
drwxr-xr-x 2 oracle oinstall 4096 Apr 28 05:10 orcldp/
drwxr-x--- 2 oracle oinstall 4096 Apr 21 14:12 ORDS/
drwxr-x--- 2 oracle oinstall 4096 Jun  2  2016 pdbseed/
drwxr-xr-x 2 oracle oinstall 4096 Apr 23 14:13 VIHAAN/



[oracle@vbgeneric ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 28 04:14:36 2017

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


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


SET LINESIZE 200 PAGESIZE 100 SERVEROUTPUT ON
COLUMN "DB DETAILS" FORMAT A100
SELECT
 'DB_NAME: ' ||sys_context('userenv', 'db_name')                  ||
 ' \CDB:-' ||(select cdb from v$database)                         ||
 ' \AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity') ||
 ' \USER: ' ||sys_context('userenv', 'current_user')              ||
 ' \CONTAINER:' ||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB') "DB DETAILS"
 FROM DUAL ;

DB DETAILS
----------------------------------------------------------------------------------------------------
DB_NAME: orcl12c \CDB:-YES \AUTH_ID: oracle \USER: SYS \CONTAINER:CDB$ROOT


SQL> create database link clone_link1 connect to clone identified by clone using 'orcl';
Database link created.


SQL> create pluggable database orcldp from orcl@clone_link1 file_name_convert=('orcl','orcldb');

Pluggable database created.


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO
         4 ORDS                           READ WRITE NO
         5 ANUJ                           READ WRITE NO
         6 VIHAAN                         READ WRITE NO
         7 ORCLDP                         MOUNTED  <<<<<<<< Duplicate database from ORCL to ORCLDP


SQL> alter pluggable database ORCLDP open;

Pluggable database altered.


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO
         4 ORDS                           READ WRITE NO
         5 ANUJ                           READ WRITE NO
         6 VIHAAN                         READ WRITE NO
         7 ORCLDP                         READ WRITE NO

Sunday 23 April 2017

How to change Pluggable databse parameter ?


How to change pluggable databse parameter ?  



 
The parameters are set for a PDB and are stored in table PDB_SPFILE$ , across PDB .

[oracle@vbgeneric ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Apr 22 09:49:19 2017

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


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


or 

alter session set container=cdb$root;


SET LINESIZE 200 PAGESIZE 100 SERVEROUTPUT ON
COLUMN "DB DETAILS" FORMAT A100
SELECT
 'DB_NAME: ' ||sys_context('userenv', 'db_name') ||
 ' \CDB:-' ||(select cdb from v$database) ||
 ' \AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity') ||
 ' \USER: ' ||sys_context('userenv', 'current_user') ||
 ' \CONTAINER:'||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB') "DB DETAILS..."
 FROM DUAL ;

DB DETAILS
----------------------------------------------------------------------------------------------------
DB_NAME: orcl12c \CDB:-YES \AUTH_ID: oracle \USER: SYS \CONTAINER:ANUJ


SQL> show pdbs

 CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
 2 PDB$SEED READ ONLY NO
 3 ORCL READ WRITE NO
 4 ORDS READ WRITE NO
 5 ANUJ READ WRITE NO


SET SERVEROUTPUT ON
COLUMN "RESTRICTED" FORMAT A10
select 
 v.name, 
 v.open_mode, 
 nvl(v.restricted, 'n/a') "RESTRICTED", 
 d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;

NAME OPEN_MODE RESTRICTED STATUS
------------------------- ---------- ---------- ---------
PDB$SEED READ ONLY NO NORMAL
ORCL READ WRITE NO NORMAL
ORDS READ WRITE NO NORMAL
ANUJ READ WRITE NO NORMAL



Pluggable database parameter ..

col container_name for a20
col parameter for a20
col value$ for a30
select container.con_id,container.name container_name, par.name PARAMETER,par.value$ from pdb_spfile$ par, v$containers container
where par.pdb_uid = container.con_uid
order by 1

 CON_ID CONTAINER_NAME PARAMETER VALUE$
---------- -------------------- -------------------- ------------------------------
 2 PDB$SEED max_string_size 'EXTENDED'
 3 ORCL max_string_size 'EXTENDED'
 3 ORCL job_queue_processes 2
 3 ORCL db_securefile 'PREFERRED'
 3 ORCL open_cursors 50
 4 ORDS max_string_size 'EXTENDED'
 5 ANUJ max_string_size 'EXTENDED'
 5 ANUJ open_cursors 300

8 rows selected.



SQL> alter session set container=ANUJ;

Session altered.



set linesize 200 
col name for a25
col VALUE for a20
select name, con_id, value from v$system_parameter where name='open_cursors';

NAME CON_ID VALUE
------------------------- ---------- --------------------
open_cursors 0 300


SQL> alter system set open_cursors=301 scope=both;

System altered.

SQL> show parameter open_cursors

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
open_cursors integer 301



set linesize 200
col name for a25
col VALUE for a20
select name, con_id, value from v$system_parameter where name='open_cursors';

NAME CON_ID VALUE
------------------------- ---------- --------------------
open_cursors 5 301



set linesize 200
col name for a25
col VALUE for a20
col CON_NAME for a20
select s.name, s.con_id, p.name CON_NAME,s.value from v$system_parameter s,v$pdbs p 
where 1=1
and s.con_id=p.con_id
and s.name='open_cursors';

NAME CON_ID CON_NAME VALUE
------------------------- ---------- -------------------- --------------------
open_cursors 5 ANUJ 301


set linesize 200
col name for a25
col VALUE for a20
col CON_NAME for a20
select s.name, s.con_id, p.name CON_NAME,s.value from v$system_parameter s,v$pdbs p 
where 1=1
and s.con_id=p.con_id
-- and s.name='open_cursors';

NAME CON_ID CON_NAME VALUE
------------------------- ---------- -------------------- --------------------
resource_manager_plan 5 ANUJ
open_cursors 5 ANUJ 301
max_string_size 5 ANUJ EXTENDED



alter session set container=cdb$root;


SET LINESIZE 200 PAGESIZE 100 SERVEROUTPUT ON
COLUMN "DB DETAILS" FORMAT A100
SELECT
 'DB_NAME: ' ||sys_context('userenv', 'db_name') ||
 ' \CDB:-' ||(select cdb from v$database) ||
 ' \AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity') ||
 ' \USER: ' ||sys_context('userenv', 'current_user') ||
 ' \CONTAINER:' ||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB') "DB DETAILS"
 FROM DUAL ;

DB DETAILS
----------------------------------------------------------------------------------------------------
DB_NAME: orcl12c \CDB:-YES \AUTH_ID: oracle \USER: SYS \CONTAINER:CDB$ROOT



set linesize 200
col name for a25
col VALUE for a20
col CON_NAME for a20
select s.name, s.con_id, p.name CON_NAME,s.value from v$system_parameter s,v$pdbs p 
where 1=1
and s.con_id=p.con_id
and s.name='open_cursors';


NAME CON_ID CON_NAME VALUE
------------------------- ---------- -------------------- --------------------
open_cursors 3 ORCL 50
open_cursors 5 ANUJ 301



col container_name for a10
col parameter for a20
col value$    for a30
select container.name container_name, par.name PARAMETER,par.value$ from pdb_spfile$ par, v$containers container
where par.pdb_uid = container.con_uid
-- and par.name = 'cursor_sharing';

CONTAINER_ PARAMETER            VALUE$
---------- -------------------- ------------------------------
ORCL       job_queue_processes  2
PDB$SEED   max_string_size      'EXTENDED'
ORCL       max_string_size      'EXTENDED'
ORCL       db_securefile        'PREFERRED'
ORDS       max_string_size      'EXTENDED'
ORCL       open_cursors         50
ANUJ       max_string_size      'EXTENDED'
ANUJ       open_cursors         301

8 rows selected.


How to create Pluggable database from SEED database ?



How to Create   Pluggable database ??


To check current environment of CDB and PDB


SET LINESIZE 200 PAGESIZE 100 SERVEROUTPUT ON
COLUMN "DB DETAILS" FORMAT A100
SELECT
 'DB_NAME: ' ||sys_context('userenv', 'db_name') ||
 ' \CDB:-' ||(select cdb from v$database) ||
 ' \AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity') ||
 ' \USER: ' ||sys_context('userenv', 'current_user') ||
 ' \CONTAINER:' ||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB') "DB DETAILS"
 FROM DUAL ;


DB DETAILS
----------------------------------------------------------------------------------------------------
DB_NAME: orcl12c \CDB:-YES \AUTH_ID: oracle \USER: SYS \CONTAINER:ANUJ


set linesize 200 pagesize 200 
col FILE_NAME for a70
SELECT CON_ID, TABLESPACE_NAME,FILE_NAME FROM CDB_DATA_FILES ;

 CON_ID TABLESPACE_NAME FILE_NAME
---------- ------------------------------ ----------------------------------------------------------------------
 3 SYSTEM /u01/app/oracle/oradata/orcl12c/orcl/system01.dbf
 3 SYSAUX /u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf
 3 USERS /u01/app/oracle/oradata/orcl12c/orcl/SAMPLE_SCHEMA_users01.dbf
 3 EXAMPLE /u01/app/oracle/oradata/orcl12c/orcl/example01.dbf
 3 APEX_1851336378250219 /u01/app/oracle/oradata/orcl12c/orcl/APEX_1851336378250219.dbf
 3 APEX_5457999048253711 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5457999048253711.dbf
 3 APEX_5500333564645084 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5500333564645084.dbf
 1 SYSTEM /u01/app/oracle/oradata/orcl12c/system01.dbf
 1 SYSAUX /u01/app/oracle/oradata/orcl12c/sysaux01.dbf
 1 USERS /u01/app/oracle/oradata/orcl12c/users01.dbf
 1 UNDOTBS2 /u01/app/oracle/oradata/orcl12c/undotbs2.dbf
 1 APEX /u01/app/oracle/oradata/orcl12c/apex01.dbf
 5 SYSTEM /u01/app/oracle/oradata/orcl12c/ANUJ/system01.dbf
 5 SYSAUX /u01/app/oracle/oradata/orcl12c/ANUJ/sysaux01.dbf
 5 USERS /u01/app/oracle/oradata/orcl12c/ANUJ/users01.dbf
 4 SYSTEM /u01/app/oracle/oradata/orcl12c/ORDS/system01.dbf
 4 SYSAUX /u01/app/oracle/oradata/orcl12c/ORDS/sysaux01.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users02.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users01.dbf

19 rows selected.


How to check seed database path ?


SQL> alter session set exclude_seed_cdb_view=false;

Session altered.

show parameter EXCLUDE_SEED_CDB_VIEW

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
exclude_seed_cdb_view boolean FALSE


Now seed database file ..

set linesize 200 pagesize 200 
col FILE_NAME for a70
SELECT CON_ID, TABLESPACE_NAME,FILE_NAME FROM CDB_DATA_FILES ;

 CON_ID TABLESPACE_NAME FILE_NAME
---------- ------------------------------ ----------------------------------------------------------------------
 1 SYSTEM /u01/app/oracle/oradata/orcl12c/system01.dbf
 1 SYSAUX /u01/app/oracle/oradata/orcl12c/sysaux01.dbf
 1 USERS /u01/app/oracle/oradata/orcl12c/users01.dbf
 1 UNDOTBS2 /u01/app/oracle/oradata/orcl12c/undotbs2.dbf
 1 APEX /u01/app/oracle/oradata/orcl12c/apex01.dbf
 2 SYSTEM /u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf
 2 SYSAUX /u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf
 3 SYSTEM /u01/app/oracle/oradata/orcl12c/orcl/system01.dbf
 3 SYSAUX /u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf
 3 USERS /u01/app/oracle/oradata/orcl12c/orcl/SAMPLE_SCHEMA_users01.dbf
 3 EXAMPLE /u01/app/oracle/oradata/orcl12c/orcl/example01.dbf
 3 APEX_1851336378250219 /u01/app/oracle/oradata/orcl12c/orcl/APEX_1851336378250219.dbf
 3 APEX_5457999048253711 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5457999048253711.dbf
 3 APEX_5500333564645084 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5500333564645084.dbf
 5 SYSTEM /u01/app/oracle/oradata/orcl12c/ANUJ/system01.dbf
 5 SYSAUX /u01/app/oracle/oradata/orcl12c/ANUJ/sysaux01.dbf
 5 USERS /u01/app/oracle/oradata/orcl12c/ANUJ/users01.dbf
 4 SYSTEM /u01/app/oracle/oradata/orcl12c/ORDS/system01.dbf
 4 SYSAUX /u01/app/oracle/oradata/orcl12c/ORDS/sysaux01.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users02.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users01.dbf

21 rows selected.




 alter system set "EXCLUDE_SEED_CDB_VIEW"=FALSE ;

System altered.


set linesize 200 pagesize 200 
col FILE_NAME for a70
SELECT CON_ID, TABLESPACE_NAME,FILE_NAME FROM CDB_DATA_FILES ;

 CON_ID TABLESPACE_NAME FILE_NAME
---------- ------------------------------ ----------------------------------------------------------------------
 2 SYSTEM /u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf
 2 SYSAUX /u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf
 4 SYSTEM /u01/app/oracle/oradata/orcl12c/ORDS/system01.dbf
 4 SYSAUX /u01/app/oracle/oradata/orcl12c/ORDS/sysaux01.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users02.dbf
 4 USERS /u01/app/oracle/oradata/orcl12c/ORDS/users01.dbf
 3 SYSTEM /u01/app/oracle/oradata/orcl12c/orcl/system01.dbf
 3 SYSAUX /u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf
 3 USERS /u01/app/oracle/oradata/orcl12c/orcl/SAMPLE_SCHEMA_users01.dbf
 3 EXAMPLE /u01/app/oracle/oradata/orcl12c/orcl/example01.dbf
 3 APEX_1851336378250219 /u01/app/oracle/oradata/orcl12c/orcl/APEX_1851336378250219.dbf
 3 APEX_5457999048253711 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5457999048253711.dbf
 3 APEX_5500333564645084 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5500333564645084.dbf
 1 SYSTEM /u01/app/oracle/oradata/orcl12c/system01.dbf
 1 SYSAUX /u01/app/oracle/oradata/orcl12c/sysaux01.dbf
 1 USERS /u01/app/oracle/oradata/orcl12c/users01.dbf
 1 UNDOTBS2 /u01/app/oracle/oradata/orcl12c/undotbs2.dbf
 1 APEX /u01/app/oracle/oradata/orcl12c/apex01.dbf

18 rows selected.



SET SERVEROUTPUT ON
COLUMN "RESTRICTED" FORMAT A10
select 
 v.name, 
 v.open_mode, 
 nvl(v.restricted, 'n/a') "RESTRICTED", 
 d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;

NAME OPEN_MODE RESTRICTED STATUS
------------------------------ ---------- ---------- ---------
PDB$SEED READ ONLY NO NORMAL
ORCL READ WRITE NO NORMAL
ORDS READ WRITE NO NORMAL
=========================================
To check seed database file only 
set linesize 200
col FILE_NAME for a80
select TABLESPACE_NAME, FILE_NAME  from cdb_data_files   where CON_ID=( select CON_ID from v$pdbs where NAME='PDB$SEED' ) 
union 
select TABLESPACE_NAME, FILE_NAME  from cdb_temp_files where CON_ID=( select CON_ID from v$pdbs where NAME='PDB$SEED' );



set linesize 200
col FILE_NAME for a80
select TABLESPACE_NAME, FILE_NAME  from cdb_data_files   where CON_ID=( select CON_ID from v$pdbs where NAME='PDB$SEED' )
union
select TABLESPACE_NAME, FILE_NAME  from cdb_temp_files where CON_ID=( select CON_ID   from v$pdbs where NAME='PDB$SEED' );

no rows selected


Check this parameter ...

SQL> show parameter EXCLUDE_SEED_CDB_VIEW

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
exclude_seed_cdb_view                boolean     TRUE


SQL> alter session set EXCLUDE_SEED_CDB_VIEW=false ;

Session altered.


set linesize 200
col FILE_NAME for a80
select TABLESPACE_NAME, FILE_NAME  from cdb_data_files   where CON_ID=( select CON_ID from v$pdbs where NAME='PDB$SEED' )
union
select TABLESPACE_NAME, FILE_NAME  from cdb_temp_files where CON_ID=( select CON_ID from v$pdbs where NAME='PDB$SEED' );


TABLESPACE_NAME                FILE_NAME
------------------------------ --------------------------------------------------------------------------------
TEMP                           /u01/app/oracle/oradata/orcl12c/pdbseed/pdbseed_temp012016-06-02_07-10-28-AM.dbf
SYSAUX                         /u01/app/oracle/oradata/orcl12c/pdbseed/sysaux01.dbf
SYSTEM                         /u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf


==========================================================

 As seed database path 

from 
/u01/app/oracle/oradata/orcl12c/pdbseed/system01.dbf
to 
/u01/app/oracle/oradata/orcl12c/ANUJ/users01.dbf

So convert parameter .. 
FILE_NAME_CONVERT = ('/pdbseed/', '/ANUJ/')




Create Pluggable databse ..


SQL> SQL>
CREATE PLUGGABLE DATABASE anuj ADMIN USER vihaan IDENTIFIED BY vihaan123
storage (maxsize 5G MAX_SHARED_TEMP_SIZE 500M)
DEFAULT TABLESPACE "USERS" DATAFILE '/u01/app/oracle/oradata/orcl12c/ANUJ/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON
FILE_NAME_CONVERT = ('/pdbseed/', '/ANUJ/');

Pluggable database created.


SET SERVEROUTPUT ON
COLUMN "RESTRICTED" FORMAT A10
select
 v.name,
 v.open_mode,
 nvl(v.restricted, 'n/a') "RESTRICTED",
 d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;

NAME OPEN_MODE RESTRICTED STATUS
------------------------------ ---------- ---------- ---------
PDB$SEED READ ONLY NO NORMAL
ORCL READ WRITE NO NORMAL
ORDS READ WRITE NO NORMAL
ANUJ MOUNTED n/a NEW

SQL> alter pluggable database ANUJ open ;

Pluggable database altered.


NAME OPEN_MODE RESTRICTED STATUS
------------------------------ ---------- ---------- ---------
PDB$SEED READ ONLY NO NORMAL
ORCL READ WRITE NO NORMAL
ORDS READ WRITE NO NORMAL
ANUJ READ WRITE NO NORMAL


==============================
 pwd
/u01/app/oracle/oradata/vihcdb1

 ls -ltr
total 2439372
drwxr-xr-x 2 oracle oinstall      4096 Sep 23 13:53 pdbseed
-rw-r----- 1 oracle oinstall  20979712 Sep 23 15:15 temp01.dbf
-rw-r----- 1 oracle oinstall  52429312 Sep 23 21:16 redo02a.log
-rw-r----- 1 oracle oinstall 524296192 Sep 23 21:21 users01.dbf
-rw-r----- 1 oracle oinstall 734011392 Sep 24 03:52 system01.dbf
-rw-r----- 1 oracle oinstall  52429312 Sep 24 04:01 redo03a.log
-rw-r----- 1 oracle oinstall 466624512 Sep 24 04:05 undotbs01.dbf
-rw-r----- 1 oracle oinstall 576724992 Sep 24 04:05 sysaux01.dbf
-rw-r----- 1 oracle oinstall  52429312 Sep 24 04:05 redo01a.log
-rw-r----- 1 oracle oinstall  18038784 Sep 24 04:05 ora_control1.ctl
-rw-r----- 1 oracle oinstall  18038784 Sep 24 04:05 ora_control2.ctl

[oracle@cl-ora vihcdb1]$ mkdir ANUJ
[oracle@cl-ora vihcdb1]$ cd ANUJ/
[oracle@cl-ora ANUJ]$ pwd
/u01/app/oracle/oradata/vihcdb1/ANUJ
[oracle@cl-ora ANUJ]$ !sql



CREATE PLUGGABLE DATABASE anuj ADMIN USER vihaan IDENTIFIED BY vihaan123
SQL>   2  storage (maxsize 5G MAX_SHARED_TEMP_SIZE 500M)
  3  DEFAULT TABLESPACE "USERS" DATAFILE '/u01/app/oracle/oradata/vihcdb1/ANUJ/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON
  4  FILE_NAME_CONVERT = ('/pdbseed/', '/ANUJ/');


Pluggable database created.


CREATE PLUGGABLE DATABASE anuj ADMIN USER vihaan IDENTIFIED BY vihaan123
SQL>   2  storage (maxsize 5G MAX_SHARED_TEMP_SIZE 500M)
  3  DEFAULT TABLESPACE "USERS" DATAFILE '/u01/app/oracle/oradata/vihcdb1/ANUJ/users01.dbf' SIZE 5M REUSE AUTOEXTEND ON
  4  FILE_NAME_CONVERT = ('/pdbseed/', '/ANUJ/');


Pluggable database created.

SQL> SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ANUJ                           MOUNTED
SQL> alter session set container=anuj ;
 
Session altered.

SQL> startup ;
Pluggable Database opened.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 ANUJ                           READ WRITE NO

Friday 21 April 2017

Pluggable database database add datafile ...

How to add datafile in  Pluggable database !!!


Pluggable database add datafile ..... 


set linesize 200 pagesize 200 
col FILE_NAME for a70
col PDB_NAME for a20
select a.CON_ID,PDB_NAME,b.status pdbstatus,TABLESPACE_NAME,FILE_NAME ,trunc(BYTES/1024/1024/1024,2) Gb, trunc(MAXBYTES/1024/1024/1024,2) Max from cdb_data_files a,dba_pdbs b
where b.PDB_ID=a.CON_ID
order by 1;

 CON_ID PDB_NAME PDBSTATUS TABLESPACE_NAME FILE_NAME GB MAX
---------- -------------------- --------- ------------------------------ ---------------------------------------------------------------------- ---------- ----------
 3 ORCL NORMAL SYSTEM /u01/app/oracle/oradata/orcl12c/orcl/system01.dbf .39 31.99
 3 ORCL NORMAL APEX_5500333564645084 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5500333564645084.dbf 0 .09
 3 ORCL NORMAL APEX_5457999048253711 /u01/app/oracle/oradata/orcl12c/orcl/APEX_5457999048253711.dbf 0 .02
 3 ORCL NORMAL SYSAUX /u01/app/oracle/oradata/orcl12c/orcl/sysaux01.dbf 1.19 31.99
 3 ORCL NORMAL EXAMPLE /u01/app/oracle/oradata/orcl12c/orcl/example01.dbf 1.21 31.99
 3 ORCL NORMAL USERS /u01/app/oracle/oradata/orcl12c/orcl/SAMPLE_SCHEMA_users01.dbf .14 31.99
 3 ORCL NORMAL APEX_1851336378250219 /u01/app/oracle/oradata/orcl12c/orcl/APEX_1851336378250219.dbf 0 .02
 4 ORDS NORMAL SYSTEM /u01/app/oracle/oradata/orcl12c/ORDS/system01.dbf .25 31.99
 4 ORDS NORMAL USERS /u01/app/oracle/oradata/orcl12c/ORDS/users01.dbf .04 31.99
 4 ORDS NORMAL SYSAUX /u01/app/oracle/oradata/orcl12c/ORDS/sysaux01.dbf .72 31.99

10 rows selected.

alter session set container=ORDS; 

SQL> show con_id

CON_ID
------------------------------
4

SQL> show con_name

CON_NAME
------------------------------
ORDS

or


SQL> show con_id con_name

CON_ID
------------------------------
4

CON_NAME
------------------------------
ORDS


SQL> alter tablespace USERS add datafile '/u01/app/oracle/oradata/orcl12c/ORDS/users02.dbf' size 1g AUTOEXTEND ON;

Tablespace altered.

set linesize 200 pagesize 200
col FILE_NAME for a70
col PDB_NAME for a20
select a.CON_ID,PDB_NAME,b.status pdbstatus,TABLESPACE_NAME,FILE_NAME ,trunc(BYTES/1024/1024/1024,2) Gb, trunc(MAXBYTES/1024/1024/1024,2) Max from cdb_data_files a,dba_pdbs b
where b.PDB_ID=a.CON_ID
order by 1;

 CON_ID PDB_NAME PDBSTATUS TABLESPACE_NAME FILE_NAME GB MAX
---------- -------------------- --------- ------------------------------ ---------------------------------------------------------------------- ---------- ----------
 4 ORDS NORMAL SYSTEM /u01/app/oracle/oradata/orcl12c/ORDS/system01.dbf .25 31.99
 4 ORDS NORMAL SYSAUX /u01/app/oracle/oradata/orcl12c/ORDS/sysaux01.dbf .72 31.99
 4 ORDS NORMAL USERS /u01/app/oracle/oradata/orcl12c/ORDS/users02.dbf 1 31.99
 4 ORDS NORMAL USERS /u01/app/oracle/oradata/orcl12c/ORDS/users01.dbf .04 31.99

Sunday 16 April 2017

Oracle Open transactions Info ..


Oracle Open transactions ..






set linesize 300 pagesize 300
col USERNAME for a15
col object_name for a15
col owner       for a12
col kill   for a15
select ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''' kill ,t.start_scnw,t.start_scnb
,t.start_time -- <<<<--- format mm/dd/yy 
,s.username, o.object_name,o.owner,t.used_ublk ,t.used_urec ,s.event,s.sql_id,s.prev_sql_id,s.status 
from gv$transaction t, gv$session s, gv$locked_object l,dba_objects o 
where 1=1 
and t.ses_addr  = s.saddr 
and t.inst_id   = s.inst_id 
and t.xidusn    = l.xidusn 
and t.xidslot   = l.xidslot 
and t.xidsqn    = l.xidsqn 
and t.inst_id   = l.inst_id 
and l.object_id = o.object_id 
-- and username not in ( 'SYS' , 'SYSTEM' , 'DBSNMP' , 'SYSMAN' , 'OUTLN' , 'MDSYS' , 'ORDSYS' , 'EXFSYS' , 'DMSYS' , 'WMSYS' , 'CTXSYS' , 'ANONYMOUS' , 'XDB' , 'ORDPLUGINS' , 'OLAPSYS' , 'PUBLIC','WWV_FLOW_PLATFORM' )
-- l.object_id IN ('') ----< OBJECT ID FROM DBA_OBJECTS
--and s.status='KILLED'


==


set linesize 300 pagesize 300
col kill   			for a15
col USERNAME 		for a24
col "Roll Status"   for a27
col EVENT 			for a28
select ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''' kill ,s.username,sql_id,t.used_urec,t.used_ublk,event
,case when bitand(flag,power(2,7)) > 0 
then 'Rolling Back'
else 'Not Rolling Back' 
end   as "Roll Status" 
from gv$session s, gv$transaction t
where 1=1
and s.saddr = t.ses_addr
and s.inst_id = t.inst_id
order by t.used_ublk desc
;



set linesize 300 pagesize 300
col kill   			for a15
col USERNAME 		for a24
col "Roll Status"  	for a27
col EVENT 			for a28
col CLIENT_INFO 	for a20
select ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''' kill,USERNAME, s.client_info, t.addr,sql_id, sum(t.used_ublk) used_ublk
,case when bitand(flag,power(2,7)) > 0 
then 'Rolling Back'
else 'Not Rolling Back' 
end   as "Roll Status" 
    from gv$transaction t, gv$session s
    where t.addr = s.taddr
	and s.inst_id = t.inst_id
    group by ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''',USERNAME, s.client_info, t.addr,sql_id,bitand(flag,power(2,7))
	;



set linesize 300 pagesize 300
col kill   		for a15
col SQL_TEXT 	for a50 wrap 
select ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''' kill, t.used_urec records, t.used_ublk blocks,(t.used_ublk*8192/1024) kb,sql.sql_text 
from gv$transaction t,gv$session s, gv$sql sql
where t.addr=s.taddr
and s.sql_id = sql.sql_id
and s.inst_id = sql.inst_id
and s.inst_id = t.inst_id
and s.sql_id='&sql_id'
-- and s.username ='USERNAME'
;





set linesize 300 pagesize 300
col SQL_TEXT 	for a50 wrap 
select distinct s.CON_ID,s.sql_id,s.sql_text from gv$sql s, gv$undostat u where u.maxqueryid=s.sql_id  and s.inst_id = u.inst_id;




set lines 170
set pages 1000
col event format a35
select inst_id,event,count(*) from gv$session_wait
group by inst_id,event order by 3
/

col inst_id for 999
col sql format a35
col username format a20
col child format 999
col secs format 9999
col machine format a12
col event format a25
col state format a10
col MINS for 99999
select distinct
w.inst_id,w.sid,s.username,substr(w.event,1,25) event,s.type,substr(s.machine,1,12) machine,substr(w.state,1,10) state,s.SQL_ID,--q.CHILD_NUMBER CHILD,
substr(q.sql_text,1,33) "SQL",round(s.LAST_CALL_ET/60) "MINS"
from gv$session_wait w,gv$session s,gv$sql q
where 1=1
and w.event like '%&event%' 
and w.sid=s.sid 
and w.inst_id=s.inst_id 
and w.inst_id=q.inst_id 
and s.SQL_HASH_VALUE=q.HASH_VALUE 
and s.status='ACTIVE' 
and s.username is not null
order by "MINS"
/



alter session set nls_date_format='dd-mm-yyyy hh24:mi';
set linesize 300 pagesize 300 
col kill 			for a15 
col username 		for a20
col sqlcommand 		for a20
col module 			for a20
col action 			for a20
col program 		for a20
col machine 		for a20                                                        
col client_info 	for a20
select
''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''' kill,
 s.username,
 s.machine,
 NVL(s.client_info,'NA') client_info,
 NVL(s.sql_id, s.prev_sql_id) sql_id,
 NVL(sqlcom.command_name,'NA') sqlcommand,
 s.module, s.action, s.program, t.status, t.start_date, ROUND((SYSDATE-t.start_date)*24*60*60) AS secondsopen,
 SUM(t.used_urec) as "undo records used",
 SUM(t.used_ublk) as "undo blocks used"
from gv$transaction t, gv$session s, gv$sqlcommand sqlcom
where 1=1
and t.addr = s.taddr
and sqlcom.command_type=s.command
and t.inst_id = s.inst_id
--and rownum <10
 GROUP BY ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||'''',
s.username, s.machine, s.client_info, NVL(s.sql_id, s.prev_sql_id), NVL(sqlcom.command_name,'NA') , s.module, s.action, s.program, t.status, t.start_date, (sysdate-t.start_date)*24*60*60
order by  "undo blocks used" desc;
 

select count(f.block#) "Should Increase >", count(u.block#) "Should Decrease <" from fet$ f ,uet$ u;
===========
from Web
DEFINE BYTES_DIVIDER="1024/1024"
DEFINE BYTES_HEADING="MB"
DEFINE BYTES_FORMAT="999,999,999"
COLUMN xid                      HEADING "XID"                      FORMAT a16 
COLUMN transaction_status       HEADING "Tran|Status"              FORMAT a8 
COLUMN transaction_start_date   HEADING "Tran|StartDate"           FORMAT a18 
COLUMN tran_duration            HEADING "Tran|Duration"            FORMAT a15
COLUMN space                    HEADING "Space|Tran"               FORMAT a5 
COLUMN recursive                HEADING "Recu|rsive|Tran"          FORMAT a5 
COLUMN noundo                   HEADING "No|Undo|Tran"             FORMAT a4 
COLUMN ptx                      HEADING "Par'l|Tran"               FORMAT a5 
COLUMN used_undo                HEADING "Undo|(&&BYTES_HEADING)"   FORMAT &&BYTES_FORMAT
COLUMN log_io                   HEADING "Logical|IO"               FORMAT 999,999,999
COLUMN phy_io                   HEADING "Physical|IO"              FORMAT 999,999,999
COLUMN cr_get                   HEADING "Consistent|Gets"          FORMAT 999,999,999
COLUMN name                     HEADING "Tran Name"                FORMAT a15 WRAP


set heading off
select 
  'Session id           : ' || s.sid      || chr(10) 
||  'USERNAME           : ' || s.USERNAME      || chr(10) 
       ||  'Transaction Name     : ' || TRIM(t.name)      || chr(10) 
       || 'XID                  : ' || TRIM(t.xid)       || chr(10)  
       || 'Parent XID           : ' || TRIM(t.ptx_xid)   || chr(10)  
       || 'Tran Status          : ' || TRIM(t.status)    || chr(10)  
       || 'Tran Start Time      : ' || TO_CHAR(t.start_date,'DD-MON-YY HH24:MI:SS')  || chr(10)  
       || 'Tran Duration        : ' || FLOOR(sysdate - t.start_date) || 'd '
                                        || LPAD(FLOOR(MOD((sysdate - t.start_date) , 1) * 24 ) ,2) || 'h '
                                        || LPAD(FLOOR(MOD((sysdate - t.start_date) * 24 , 1) * 60 ) ,2) || 'm '
                                        || LPAD(FLOOR(MOD((sysdate - t.start_date) * 24 * 60 , 1) * 60 ) ,2) || 's '  || chr(10)  
       || 'Parallel Tran        : ' || TRIM(t.ptx)       || chr(10)  
       || 'Space Tran           : ' || TRIM(t.space)     || chr(10)  
       || 'Recursive Tran       : ' || TRIM(t.recursive) || chr(10)  
       || 'No UNDO Tran         : ' || TRIM(t.noundo)    || chr(10)  
       || 'Undo                 : ' || TRIM(TO_CHAR(ROUND((t.used_ublk * p.value)/&&BYTES_DIVIDER),'&&BYTES_FORMAT')) || ' &&BYTES_HEADING' || chr(10)  
       || 'Logical IO           : ' || TRIM(TO_CHAR(t.log_io,'999,999,999'))    || chr(10)  
       || 'Physical IO          : ' || TRIM(TO_CHAR(t.phy_io,'999,999,999'))    || chr(10)  
       || 'Consistent Gets      : ' || TRIM(TO_CHAR(t.cr_get,'999,999,999'))    || chr(10)  
     || 'SQl id                 : ' || s.sql_id    || chr(10)  
     || 'PREV SQL ID            : ' || PREV_SQL_ID    || chr(10)  
     ||'EVENT                   : ' || EVENT    || chr(10)  
     ||'alter system kill Session  ' || ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||''''||' immediate;'          || chr(10)  
FROM gv$transaction t
     INNER JOIN gv$session s ON t.inst_id = s.inst_id   AND t.ses_addr = s.saddr
     INNER JOIN v$parameter p ON p.name = 'db_block_size'
WHERE 1=1 
--and s.inst_id = :INST_ID
 -- AND s.sid     = :SID
ORDER BY t.start_date
;

===
From Web


set linesize 500
col username   for a30
col osuser     for a14
col module     for a20
col program    for a30
col status     for a12
col name       for a5
col start_time for a18
col EVENT  for a25
col kill for a16
with v as (
      select 
	  ''''||s.sid ||','|| s.serial#||',@'||s.inst_id ||''''  as kill,
	  --s.sid,
	  s.username
            ,s.osuser
            ,s.module,s.program
			,s.sql_id
			,s.event
            --,addr,ses_addr
            ,tr.xid
            ,tr.xidusn
            ,tr.xidslot
            ,tr.xidsqn
            --,ubafil,ubablk,ubasqn,ubarec
            ,tr.status
            ,tr.start_time
            --,tr.start_date
            ,tr.used_ublk
            ,tr.used_urec
            ,tr.log_io
            ,tr.phy_io
            ,tr.cr_get
            ,tr.cr_change
            ,tr.flag
            ,tr.space
            ,tr.recursive
            ,tr.noundo
            ,tr.ptx        parallel_tx
            ,tr.name
            ,tr.start_scn 
            --,dependent_scn
            --,start_scnb,start_scnw,start_uext,start_ubafil,start_ubablk,start_ubasqn,start_ubarec
            --,prv_xidusn,prv_xidslt,prv_xidsqn
            --,ptx_xidusn,ptx_xidslt,ptx_xidsqn
            --,dscn-b,dscn-w
            --,dscn_base,dscn_wrap
            --,prv_xid,ptx_xid
            ,row_number()over(order by used_ublk desc) blks_rn
            ,row_number()over(order by used_urec desc) recs_rn
            ,row_number()over(order by start_time desc) time_rn
      from gv$transaction tr
          ,gv$session s
      where 1=1
	  and tr.ses_addr = s.saddr(+)
	 and tr.inst_id = s.inst_id
)
select 
 kill
   ,sql_id
,event
 ,username
 ,osuser
 ,substr(module,1,30) as module
 ,program
 --,xid
 --,xidusn,xidslot,xidsqn
 ,status
 ,start_time
 ,used_ublk
 ,used_urec
 ,log_io
 ,phy_io
 ,cr_get
 ,cr_change
 --,flag
 ,space,recursive,noundo,parallel_tx
 ,name
 ,start_scn
from v
where blks_rn<=10
   or recs_rn<=10
   or time_rn<=10
order by blks_rn
/
col username   clear
col osuser     clear
col module     clear
col program    clear
col status     clear
col name       clear
col start_time clear

 

Saturday 15 April 2017

Patch 24968615: DATABASE PROACTIVE BUNDLE PATCH 12.1.0.2.170117

Oracle 12c database patch 

Patch 24968615: DATABASE PROACTIVE BUNDLE PATCH 12.1.0.2.170117


17-Jan-2017 15:26 (2+ months ago)
Oracle Database - Enterprise Edition
Oracle 12.1.0.2.0
Linux x86-64



Imp matalink Note 
Oracle Recommended Patches -- Oracle Database (Doc ID 756671.1)

Recommendations / Certifications
Mandatory for Oracle Exadata Real Application Clusters 12.1.0.2.0
Recommended for Oracle Exadata Real Application Clusters 12.1.0.2.0
Recommended when Oracle Clusterware 12.1.0.2.0 is used with:
Oracle Exadata Database 12.1.0.2.0
Oracle Exadata Real Application Clusters 12.1.0.2.0
System Patch Contents
The following patches are included. Disabled items are included in the system patch and cannot be downloaded independently. Some patches may not apply to your configuration. Use Configuration Manager for a detailed applicability analysis.
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
25101514 MERGE REQUEST ON TOP OF OCW PSU 12.1.0.2.170117 FOR BUGS 21210985 21692274 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)
24732088 DATABASE BUNDLE PATCH 12.1.0.2.170117 (Oracle Database)



patch file info ..


-rw-r--r--  1 oracle oinstall 1419459488 Apr 14 16:08 p24917825_121020_Linux-x86-64.zip
-rw-r--r--  1 oracle oinstall   79808592 Apr 14 16:20 p6880880_122010_Linux-x86-64.zip



ora12c:/u01/app/oracle/product/12.1.0.2/db_1:N          # line added by Agent
#orawin:/u01/app/oracle/product/12.1.0.2/db_1:N         # line added by Agent
orawin:/u01/app/oracle/product/11.2.0.4/db_1:N          # line added by Agent
vihaan:/u01/app/oracle/product/11.2.0.4/db_1:N          # line added by Agent
+ASM:/u01/app/12.1.0.2/grid:N           # line added by Agent

[oracle@oraasm12c ~]$ . oraenv
ORACLE_SID = [oracle] ? ora12c
The Oracle base has been set to /u01/app/oracle

[oracle@oraasm12c ~]$ . oraenv
ORACLE_SID = [ora12c] ?
The Oracle base remains unchanged with value /u01/app/oracle


[root@oraasm12c ~]# . oraenv
ORACLE_SID = [root] ? ora12c
The Oracle base has been set to /u01/app/oracle
[root@oraasm12c ~]# export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch


unzip p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME/



[root@oraasm12c oracle]# opatchauto apply /home/oracle/24917825 -oh /u01/app/oracle/product/12.1.0.2/db_1

OPatchauto session is initiated at Sat Apr 15 08:51:47 2017

System initialization log file is /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchautodb/systemconfig2017-04-15_08-51-55AM.log.

Session log file is /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchauto/opatchauto2017-04-15_08-52-06AM.log
The id for this session is TWWV

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


Verifying patch inventory on home /u01/app/oracle/product/12.1.0.2/db_1
Patch inventory verified successfully on home /u01/app/oracle/product/12.1.0.2/db_1


Preparing to bring down database service on home /u01/app/oracle/product/12.1.0.2/db_1
Successfully prepared home /u01/app/oracle/product/12.1.0.2/db_1 to bring down database service


Bringing down database service on home /u01/app/oracle/product/12.1.0.2/db_1
Database service successfully brought down on home /u01/app/oracle/product/12.1.0.2/db_1


Start applying binary patch on home /u01/app/oracle/product/12.1.0.2/db_1
Binary patch applied successfully on home /u01/app/oracle/product/12.1.0.2/db_1





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


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


Trying to apply SQL patch on home /u01/app/oracle/product/12.1.0.2/db_1

[WARNING] The local database(s) on "/u01/app/oracle/product/12.1.0.2/db_1" is not running. SQL changes, if any, cannot be applied;
[WARNING] The database instance 'ora12c' from '/u01/app/oracle/product/12.1.0.2/db_1', in host'oraasm12c' is not running. SQL changes, if any,  will not be applied.
To apply. the SQL changes, bring up the database instance and run the command manually from any one node (run as oracle).
Refer to the readme to get the correct steps for applying the sql changes.

SQL patch applied successfully on home /u01/app/oracle/product/12.1.0.2/db_1


Verifying patches applied on home /u01/app/oracle/product/12.1.0.2/db_1
Patch verification completed with warning on home /u01/app/oracle/product/12.1.0.2/db_1

OPatchAuto successful.

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

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

Host:oraasm12c
SIDB Home:/u01/app/oracle/product/12.1.0.2/db_1
Summary:

==Following patches were SKIPPED:

Patch: /home/oracle/24917825/21436941
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /home/oracle/24917825/24828643
Reason: This patch is not applicable to this specified target type - "oracle_database"


==Following patches were SUCCESSFULLY applied:

Patch: /home/oracle/24917825/24732082
Log: /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-04-15_08-53-33AM_1.log

Patch: /home/oracle/24917825/24828633
Log: /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-04-15_08-53-33AM_1.log



OPatchauto session completed at Sat Apr 15 09:07:03 2017
Time taken to complete the session 15 minutes, 17 seconds


=====


SQL> startup ;
ORACLE instance started.

Total System Global Area  725614592 bytes
Fixed Size                  2928632 bytes
Variable Size             557842440 bytes
Database Buffers          159383552 bytes
Redo Buffers                5459968 bytes
Database mounted.
Database opened.



SQL> startup ;
ORACLE instance started.

Total System Global Area  725614592 bytes
Fixed Size                  2928632 bytes
Variable Size             557842440 bytes
Database Buffers          159383552 bytes
Redo Buffers                5459968 bytes
Database mounted.
Database opened.


SQL> alter pluggable database all open;

SQL> SELECT name, open_mode FROM v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
ORA12CPDB                      READ WRITE



SQL> select * from  dba_registry_sqlpatch ;

no rows selected



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



Oracle Database 12c after restarting the database simply run datapatch from the OPatch directory:

cd $ORACLE_HOME/OPatch

or

[oracle@oraasm12c ~]$ cd /u01/app/oracle/product/12.1.0.2/db_1/OPatch/


[oracle@oraasm12c OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Sat Apr 15 09:15:11 2017
Copyright (c) 2012, 2016, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_18210_2017_04_15_09_15_11/sqlpatch_invocation.log

Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
  ID 170117 in the binary registry and not installed in any PDB

Adding patches to installation queue and performing prereq checks...
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    Nothing to roll back
    The following patches will be applied:
      24732082 (DATABASE PATCH SET UPDATE 12.1.0.2.170117)

Installing patches...
Patch installation complete.  Total patches installed: 2

Validating logfiles...
Patch 24732082 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/24732082/20904347/24732082_apply_ORA12C_CDBROOT_2017Apr15_09_16_35.log (no errors)
Patch 24732082 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/24732082/20904347/24732082_apply_ORA12C_PDBSEED_2017Apr15_09_17_35.log (no errors)
SQL Patching tool complete on Sat Apr 15 09:18:52 2017



col owner for a20
col DIRECTORY_NAME for a25
col DIRECTORY_PATH for a50
select owner, directory_name, directory_path from dba_directories where directory_name like 'OPATCH%' order by 2;

OWNER                DIRECTORY_NAME            DIRECTORY_PATH
-------------------- ------------------------- --------------------------------------------------
SYS                  OPATCH_INST_DIR           /u01/app/oracle/product/12.1.0.2/db_1/OPatch
SYS                  OPATCH_LOG_DIR            /u01/app/oracle/product/12.1.0.2/db_1/QOpatch
SYS                  OPATCH_SCRIPT_DIR         /u01/app/oracle/product/12.1.0.2/db_1/QOpatch


 ls -ltr /u01/app/oracle/product/12.1.0.2/db_1/QOpatch
total 16
-r-xr-xr-- 1 oracle oinstall 1372 Apr  7  2013 qopiprep.bat
-rw-r----- 1 oracle asmadmin  120 Mar 12 19:43 qopatch.log
-rw-r--r-- 1 oracle asmadmin 7251 Apr 15 09:35 qopatch_log.log
[oracle@oraasm12c OPatch]$ cd /u01/app/oracle/product/12.1.0.2/db_1/QOpatch

-r-xr-xr-- 1 oracle oinstall 1372 Apr  7  2013 qopiprep.bat
-rw-r----- 1 oracle asmadmin  120 Mar 12 19:43 qopatch.log
-rw-r--r-- 1 oracle asmadmin 7251 Apr 15 09:35 qopatch_log.log


Patch log file info ... 

[oracle@oraasm12c QOpatch]$ cat qopatch_log.log


 LOG file opened at 03/12/17 19:47:59

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader
KUP-04004: error while reading file /u01/app/oracle/product/12.1.0.2/db_1/QOpatch/qopiprep.bat
KUP-04017: OS message: Error 0
KUP-04017: OS message: /u01/app/oracle/product/12.1.0.2/db_1/QOpatch/qopiprep.bat: line 38: /u01/app/oracle/product/12.1.0.2/db_1/QOpatch/stout.txt: Permission denied
/u01/app/oracle/
KUP-04118: operation "pipe read", location "skudmir"


 LOG file opened at 03/12/17 19:48:28

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 03/12/17 19:48:35

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:10:05

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:15:59

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:16:07

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:16:14

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:16:21

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:27:15

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:27:56

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:34:06

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


 LOG file opened at 04/15/17 09:35:01

KUP-05004:   Warning: Intra source concurrency disabled because parallel select was not requested.

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by "UIJSVTBOEIZBEFFQBL"
      Trim whitespace same as SQL Loader


*****************************************************

SQL> !$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | egrep -i 'DATABASE'
Oracle Database 12c                                                  12.1.0.2.0
                                                    OF DATABASE RESOURCES
                                                    THE MGMT DATABASE IS DROPPED
18850051   24828633  Sat Apr 15 09:06:06 BST 2017   HPI-12102 GOT TYPO IN THE OUTPUT OF DATABASE DEPEN
18920408   24828633  Sat Apr 15 09:06:06 BST 2017   SOLSP-12.1-GH-SCF MOVE DATABASE BACK TO THE
18956780   24828633  Sat Apr 15 09:06:06 BST 2017   LNX64-12.1-GH MOVE DATABASE WITHOUT PATH DOES NOT
                                                    DATABASE
19067804   24828633  Sat Apr 15 09:06:06 BST 2017   LNX64-12.1-GH MOVE DATABASE FROM UNMANAGED HOME
19148982   24828633  Sat Apr 15 09:06:06 BST 2017   LNX64-12.1-GH MOVE DATABASE FROM LOCAL NON-SHARED
19150313   24828633  Sat Apr 15 09:06:06 BST 2017   LNX64-12.1-GH MOVE DATABASE FAILED WHEN SOURCE
19632437   24828633  Sat Apr 15 09:06:06 BST 2017   ADD FAST DATABASE NODE DEATH DETECTION SUPPORT ON
19925992   24828633  Sat Apr 15 09:06:06 BST 2017   DATABASE UPGRADE FAILED FROM 11.2.0.3 11.2.0.4 TO
                                                    FOR DATABASE
24451580   24828633  Sat Apr 15 09:06:06 BST 2017   SERVICE RESOURE BECOMES UNKNOWN WHEN DATABASE
                                                    DATABASE 12.1
23170620   24732082  Sat Apr 15 08:59:16 BST 2017   STORE CONTENTS OF PATCH DIRECTORY INTO DATABASE
24437510   24732082  Sat Apr 15 08:59:16 BST 2017   DATAPATCH FAILED WITH 'THE DATABASE MUST BE IN
                                                    DATABASE VAULT ENVIRONMENT
20017509   24006101  Sat Apr 15 08:58:50 BST 2017   SRVCTL STOP DATABASE -D HUNG AT CJQ PROCESS
20139391   24006101  Sat Apr 15 08:58:50 BST 2017   BROKER CALLS CRS TO RESTART FOR DATABASES NOT
20627866   24006101  Sat Apr 15 08:58:50 BST 2017   LOGICAL DICTIONARY CORRUPTION WHEN DATABASE IS
24577566   24006101  Sat Apr 15 08:58:50 BST 2017   INVALID DATABASE VAULT DVSYS PACKAGES AFTER DB
                                                    DURING DATABASE/PDB OPEN
                                                    AFFECTING DATABASE PERFORMANCE
                                                    DATABASE NATIONAL CHARACTER SET
21847223   22291127  Sat Apr 15 08:57:41 BST 2017   ORA-07445 [KSUSIG] FROM PMON LEADING TO DATABASE C
19879746   21948354  Sat Apr 15 08:57:08 BST 2017   DATABASE CRASHED WITH ORA-600 [2251], [65535], [42
19902195   21948354  Sat Apr 15 08:57:08 BST 2017   SETTING COMPATIBLE=11.0.0 FOR A 10.2 DATABASE
                                                    DATABASE SMART FLASH CACHE
18909599   20299023  Sat Apr 15 08:56:15 BST 2017   MOVE DATABASE FROM SHARE NFS TO SHARE NFS REPORT
                                                    ORA$BASE EDITION IN SOURCE DATABASE
19524384   20299023  Sat Apr 15 08:56:15 BST 2017   ORA-704, ORA-604, ORA-2240 AND DATABASE DOESN'T
18250893   19769480  Sat Apr 15 08:55:54 BST 2017   TT12.1.0.2SQLFUZZ2 DATABASE GUARD ALL BLOCKS
                                                    UPGRADED NCDB DATABASE PLUGGED AS PDB
19178851   19769480  Sat Apr 15 08:55:54 BST 2017   SOLSP-12.1-GH MOVE DATABASE FAILED BECAUSE CAN'T
19195895   19769480  Sat Apr 15 08:55:54 BST 2017   ORA-16000 DATABASE OPEN FOR READ-ONLY ACCESS
19279273   19769480  Sat Apr 15 08:55:54 BST 2017   STANDBY DATABASE SEARCHES INCORRECT DIRECTORY
19303936   19769480  Sat Apr 15 08:55:54 BST 2017   DATABASE PATCH SET UPDATE 12.1.0.2.1 (OCT2014)
19597439   19769480  Sat Apr 15 08:55:54 BST 2017   PRIMARY DATABASE AUTO BLOCK MEDIA RECOVERY NOT
19769480   19769480  Sat Apr 15 08:55:54 BST 2017   DATABASE PATCH SET UPDATE 12.1.0.2.2 (JAN2015)



$ORACLE_HOME/OPatch/opatch lsinventory -bugs_fixed | egrep -i 'DATABASE PSU|DATABASE PATCH SET UPDATE'

19303936   19769480  Sat Apr 15 08:55:54 BST 2017   DATABASE PATCH SET UPDATE 12.1.0.2.1 (OCT2014)
19769480   19769480  Sat Apr 15 08:55:54 BST 2017   DATABASE PATCH SET UPDATE 12.1.0.2.2 (JAN2015)





On sqlplus 

[oracle@oraasm12c OPatch]$ !sql
sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat Apr 15 09:19:13 2017

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


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


col DESCRIPTION for a45
col ACTION_TIME for a30
col BUNDLE_SERIES for a15
select patch_id, patch_uid, description, action_time, action, status, bundle_series, bundle_id  from dba_registry_sqlpatch ;

 PATCH_ID  PATCH_UID DESCRIPTION                                   ACTION_TIME                    ACTION          STATUS          BUNDLE_SER  BUNDLE_ID
---------- ---------- --------------------------------------------- ------------------------------ --------------- --------------- ---------- ----------
  24732082   20904347 DATABASE PATCH SET UPDATE 12.1.0.2.170117     15-APR-17 09.18.38.433166 AM   APPLY           SUCCESS         PSU            170117




set linesize 200 pagesize 200
with a as (select dbms_qopatch.get_opatch_lsinventory patch_output from dual)
     select x.patch_id, x.patch_uid, x.description
       from a,
            xmltable('InventoryInstance/patches/*'
               passing a.patch_output
               columns
                  patch_id number path 'patchID',
                  patch_uid number path 'uniquePatchID',
                  description varchar2(80) path 'patchDescription',
                 sql_patch varchar2(8) path 'sqlPatch'
          ) x
 
 PATCH_ID  PATCH_UID DESCRIPTION
---------- ---------- --------------------------------------------------------------------------------
  24828633   20758346 OCW Patch Set Update : 12.1.0.2.170117 (24828633)
  24732082   20904347 Database Patch Set Update : 12.1.0.2.170117 (24732082)
  24006101   20683584 Database Patch Set Update : 12.1.0.2.161018 (24006101)
  23054246   20464632 Database Patch Set Update : 12.1.0.2.160719 (23054246)
  22291127   19694308 Database Patch Set Update : 12.1.0.2.160419 (22291127)
  21948354   19553095 Database Patch Set Update : 12.1.0.2.160119 (21948354)
  21359755   19194568 Database Patch Set Update : 12.1.0.2.5 (21359755)
  20831110   18977826 Database Patch Set Update : 12.1.0.2.4 (20831110)
  20299023   18703022 Database Patch Set Update : 12.1.0.2.3 (20299023)
  19769480   18350083 Database Patch Set Update : 12.1.0.2.2 (19769480)

10 rows selected.




set linesize 200 pagesize 200
col DESCRIPTION for a55
with a as (select dbms_qopatch.get_opatch_lsinventory patch_output from dual)
     select x.*
       from a,
     xmltable('InventoryInstance/patches/*'
     passing a.patch_output
     columns
        patch_id number path         'patchID',
        patch_uid number path        'uniquePatchID',
     description varchar2(80) path   'patchDescription',
     constituent number path         'constituent',
     patch_type varchar2(20) path    'patchType',
     rollbackable varchar2(20) path  'rollbackable',
     sql_patch varchar2(8) path      'sqlPatch',
     DBStartMode varchar2(10) path   'sqlPatchDatabaseStartupMode'
   ) x




  PATCH_ID  PATCH_UID DESCRIPTION                                             CONSTITUENT PATCH_TYPE           ROLLBACKABLE         SQL_PATC DBSTARTMOD
---------- ---------- ------------------------------------------------------- ----------- -------------------- -------------------- -------- ----------
  24828633   20758346 OCW Patch Set Update : 12.1.0.2.170117 (24828633)                   bundle_member        true                 false
  24732082   20904347 Database Patch Set Update : 12.1.0.2.170117 (24732082)     24732082 singleton            true                 true     normal
  24006101   20683584 Database Patch Set Update : 12.1.0.2.161018 (24006101)     24732082 singleton            true                 true     normal
  23054246   20464632 Database Patch Set Update : 12.1.0.2.160719 (23054246)     24732082 singleton            true                 true     normal
  22291127   19694308 Database Patch Set Update : 12.1.0.2.160419 (22291127)     24732082 singleton            true                 true     normal
  21948354   19553095 Database Patch Set Update : 12.1.0.2.160119 (21948354)     24732082 singleton            true                 true     normal
  21359755   19194568 Database Patch Set Update : 12.1.0.2.5 (21359755)          24732082 singleton            true                 true     normal
  20831110   18977826 Database Patch Set Update : 12.1.0.2.4 (20831110)          24732082 singleton            true                 true     normal
  20299023   18703022 Database Patch Set Update : 12.1.0.2.3 (20299023)          24732082 singleton            true                 true     normal
  19769480   18350083 Database Patch Set Update : 12.1.0.2.2 (19769480)          24732082 singleton            true                 true     normal

10 rows selected.


select xmltransform(dbms_qopatch.get_opatch_install_info, dbms_qopatch.get_opatch_xslt) from dual;

XMLTRANSFORM(DBMS_QOPATCH.GET_OPATCH_INSTALL_INFO,DBMS_QOPATCH.GET_OPATCH_XSLT)
--------------------------------------------------------------------------------

Oracle Home       : /u01/app/oracle/product/12.1.0.2/db_1
Inventory         : /




SQL> select xmltransform(dbms_qopatch.is_patch_installed('24828633'), dbms_qopatch.get_opatch_xslt) from dual;

XMLTRANSFORM(DBMS_QOPATCH.IS_PATCH_INSTALLED('24828633'),DBMS_QOPATCH.GET_OPATCH
--------------------------------------------------------------------------------

Patch Information:
         24828633:   applied on 2017-04-15T09:06:06+01:00


set linesize 200
select patch_id, patch_uid, version, status, description  from dba_registry_sqlpatch  where bundle_series = 'PSU'

  PATCH_ID  PATCH_UID VERSION              STATUS          DESCRIPTION
---------- ---------- -------------------- --------------- ----------------------------------------------------------------------------------------------------
  24732082   20904347 12.1.0.2             SUCCESS         DATABASE PATCH SET UPDATE 12.1.0.2.170117




for rollback 
$ORACLE_HOME/OPatch/datapatch -rollback 24828633 -force



Oracle DBA

anuj blog Archive