12c 补丁架构 以及opatch 功能

cd $ORACLE_HOME/ccr/bin
./emocmrsp


oracle@qc550705:/oracle/app/oracle/product/12.1.0.2/db_1/ccr/bin>ls
-rlt ocm.rsp
-rw-r--r--    1 oracle   oinstall        623 Aug 07 12:34 ocm.rsp


PSU, SPU(CPU), Bundle Patches

 
12.1.0.2
 PSU    GI PSU Proactive Bundle Patch  Bundle Patch (Windows 32bit & 64bit)
 24006101 (12.1.0.2.161018)  24412235 (12.1.0.2.161018)   24448103 (12.1.0.2.161018)  24591642 (12.1.0.2.161018)
 23054246 (12.1.0.2.160719)  23273629 (12.1.0.2.160719)  23273686 (12.1.0.2.160719)  23530387 (12.1.0.2.160719)
 22291127 (12.1.0.2.160419)  22646084 (12.1.0.2.160419)  22899531  22809813 (12.1.0.2.160419)
 21948354 (12.1.0.2.160119)  22191349 (12.1.0.2.160119)  22243551  22310559 (12.1.0.2.160119)
 21359755 (12.1.0.2.5)  21523234 (12.1.0.2.5)  21744410 (12.1.0.2.13)  21821214 (12.1.0.2.10)
 20831110 (12.1.0.2.4)  20996835 (12.1.0.2.4)  21188742 (12.1.0.2.10)  21126814 (12.1.0.2.7)
 20299023 (12.1.0.2.3)  20485724 (12.1.0.2.3)  20698050 (12.1.0.2.7)  20684004 (12.1.0.2.4)
 19769480 (12.1.0.2.2)  19954978 (12.1.0.2.2)  20141343 (12.1.0.2.4)  19720843 (12.1.0.2.1)
 19303936 (12.1.0.2.1)  19392646 (12.1.0.2.1)  19404326 (12.1.0.2.1)  N/A

 windows 以bundle patch 为一线。

linux  以psu 为 一线

http://blog.itpub.net/53956/viewspace-1789203/

升级12.1.0.2 从0419 到 1019 。

step 1:


 
 opatch rollback -id 22839633 -silent

opatch rollback -id  22809813 -silent

datapatch.bat -rollback 22839633 -verbose  
datapatch.bat -rollback 22809813 -verbose 


    
opatch patch apply  -silent 24591642
 
cd c:appsoftwarePSU_OJVM_20161018_winX64
opatch apply   -silent 24591630




 step 2:
   
shutdown immediate
startup upgrade
alter pluggable database PtestDEV open upgrade;
alter pluggable database PtestUAT open upgrade;
alter pluggable database PtestDEV close immediate;
alter pluggable database PtestUAT close immediate;
   
 

step 3:
   select con_id,name, OPEN_MODE from v$pdbs;
    CON_ID NAME                           OPEN_MODE
---------- ------------------------------ ----------
         2 PDB$SEED                       MIGRATE
         3 PtestUAT                       MIGRATE
         5 PtestDEV                       MIGRATE

         cd D:appOra12cAdministratorproduct12.1.0dbhome_1OPatch
      datapatch.bat -verbose

 

step 4:

col action for a70
select status,action from PDB_PLUG_IN_VIOLATIONS;

set linesize 999
set pagesize 999
SQL>  select * from dba_registry_sqlpatch;



select PATCH_ID,ACTION,STATUS,ACTION_TIME from dba_registry_sqlpatch
order by ACTION_TIME;


 shutdown immediate
 startup
alter pluggable database PtestDEV open ;
alter pluggable database PtestUAT open ;

---

 --11g

--select * from dba_registry_history

opatch prereq CheckConflictAgainstOHWithDetail -ph .

opatch prereq CheckSystemSpace -ph .

使用 datapatch.bat -verbose 安装opatch

Go to window server to start all oracle services, then do open all pluggable DB.

c:stage_oraCDPSU24591642>sqlplus /nolog

SQL*Plus: Release 12.1.0.2.0 Production on 星期四 12月 22 16:03:42 2016

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

SQL> conn / as sysdba

已连接。

SQL> alter pluggable database all open;

插接式数据库已变更。

SQL>

*** Note: Must use ‘datapatch.bat’ for patching window’s ORACLE_HOME not ‘datapatch’, the result should see ‘No Error’

C:apporacleproduct12.1.0dbhome_1OPatch>datapatch.bat -verbose

SQL Patching tool version 12.1.0.2.0 on Fri Dec 23 10:15:46 2016

Copyright (c) 2016, Oracle.  All rights reserved.

Log file for this invocation: C:appsissadmincfgtoollogssqlpatchsqlpatch_290

8_2016_12_23_10_15_46sqlpatch_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 161018 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 PSISSDEV

    Nothing to roll back

    The following patches will be applied:

      24591642 (WINDOWS DB BUNDLE PATCH 12.1.0.2.161018(64bit):24591642)

Installing patches...

Patch installation complete.  Total patches installed: 3

Validating logfiles...

Patch 24591642 apply (pdb CDB$ROOT): SUCCESS

  logfile: C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_appl

y_SISSUAT_CDBROOT_201612月23_10_16_31.log (no errors)

Patch 24591642 apply (pdb PDB$SEED): SUCCESS

  logfile: C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_appl

y_SISSUAT_PDBSEED_201612月23_10_17_53.log (no errors)

Patch 24591642 apply (pdb PSISSDEV): SUCCESS

  logfile: C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_appl

y_SISSUAT_PSISSDEV_201612月23_10_17_53.log (no errors)

SQL Patching tool complete on Fri Dec 23 10:19:07 2016

C:apporacleproduct12.1.0dbhome_1OPatch>

SQL>  select * from registry$sqlpatch;

  PATCH_ID ACTION

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

ACTION_TIME

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

DESCRIPTION

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

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

LOGFILE

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

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

STATUS                         VERSION                                   PATCH_U

ID

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

--

FLAGS                BUNDLE_SERIES

   BUNDLE_ID

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

- ----------

BUNDLE_DATA

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

  24591642 APPLY

23-12月-16 10.19.01.662000 上午

WINDOWS DB BUNDLE PATCH 12.1.0.2.161018(64bit):24591642

C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_apply_SISSUAT_C

DBROOT_201612月23_10

_16_31.log

SUCCESS                        12.1.0.2                                   206503

31

NB                   PSU

      161018

<?xml version="1.0"?>

<!--  $Header: rdbms/admin/bundledata_PSU.xml  -->

<!--

 C

SQL>  select * from pdb_plug_in_violations;

未选定行

SQL>

SQL> select * from v$pdbs;

    CON_ID       DBID    CON_UID GUID

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

NAME                                                         OPEN_MODE

  RESTRI

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

- ------

OPEN_TIME                                                                   CREA

TE_SCN TOTAL_SIZE

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

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

BLOCK_SIZE RECOVERY_STATUS  SNAPSHOT_PARENT_CON_ID

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

         2 1811739569 1811739569 06928CC7E3C742419A3C228AD6E2BFBA

PDB$SEED                                                     READ ONLY

  NO

23-12月-16 10.19.05.177 上午 +08:00                                            2

233954  933232640

      8192 ENABLED                               0

         3  224741511  224741511 219D128682FE4428936342B153B15B2E

PSISSDEV                                                     READ WRITE

  NO

23-12月-16 09.59.42.739 上午 +08:00                                            2

380325  969932800

      8192 ENABLED                               0

SQL>

SQL> alter session set container=psissdev;

会话已更改。

SQL> select * from registry$sqlpatch;

  PATCH_ID ACTION

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

ACTION_TIME

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

DESCRIPTION

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

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

LOGFILE

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

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

STATUS                         VERSION                                   PATCH_U

ID

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

--

FLAGS                BUNDLE_SERIES

   BUNDLE_ID

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

- ----------

BUNDLE_DATA

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

  24591642 APPLY

23-12月-16 10.19.03.709000 上午

WINDOWS DB BUNDLE PATCH 12.1.0.2.161018(64bit):24591642

C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_apply_SISSUAT_P

SISSDEV_201612月23_1

0_17_53.log

SUCCESS                        12.1.0.2                                   206503

31

NB                   PSU

      161018

<?xml version="1.0"?>

<!--  $Header: rdbms/admin/bundledata_PSU.xml  -->

<!--

 C

SQL>

SQL> alter session set container=pdb$seed;

会话已更改。

SQL> select * from registry$sqlpatch;

  PATCH_ID ACTION

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

ACTION_TIME

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

DESCRIPTION

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

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

LOGFILE

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

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

STATUS                         VERSION                                   PATCH_U

ID

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

--

FLAGS                BUNDLE_SERIES

   BUNDLE_ID

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

- ----------

BUNDLE_DATA

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

  24591642 APPLY

23-12月-16 10.19.02.630000 上午

WINDOWS DB BUNDLE PATCH 12.1.0.2.161018(64bit):24591642

C:appsissadmincfgtoollogssqlpatch2459164220650331/24591642_apply_SISSUAT_P

DBSEED_201612月23_10

_17_53.log

SUCCESS                        12.1.0.2                                   206503

31

NB                   PSU

      161018

<?xml version="1.0"?>

<!--  $Header: rdbms/admin/bundledata_PSU.xml  -->

<!--

 C

SQL>

 Apply OJVM PSU, first stop all ‘Oracle’ window services for below (ensure DB stopped, lsnrctl stopped):

OracleServiceSISSUAT

OracleOraDB12Home1TNSListenerVSISSUAT

OracleOraDB12HomeMTRecover..

OracleRpmExecServicesV2

OracleVssWriterSISSUAT

Udayseelan,

Case 1 : You have already Installed the opatch to your Inventory then you can get the corresponding details by

$ORACLE_HOME/OPatch/opatch lsinventory -all -details

Case 2: The above patch is registered in your DB only if you run your catbundle.sql. You can query the following view and filter your details accordingly.  (when you forget running the catbundle.sql, the result is not exact.)

select * from registry$history;

or

SELECT * FROM dba_registry_history;  (11g or 10g)

select substr(action_time,1,30) action_time,substr(id,1,10) id,substr(action,1,10) action,substr(version,1,8) version,substr(BUNDLE_SERIES,1,6) bundle,substr(comments,1,20) comments from registry$history;  (11g)

 SELECT * FROM dba_registry_sqlpatch;   (12c)

Bhaskar

原文地址:https://www.cnblogs.com/feiyun8616/p/6224812.html