{"id":5754,"date":"2021-07-12T22:42:34","date_gmt":"2021-07-12T22:42:34","guid":{"rendered":"https:\/\/swiv.com.br\/performing-application-patch-tasks\/"},"modified":"2026-05-27T20:02:30","modified_gmt":"2026-05-27T19:02:30","slug":"performing-application-patch-tasks","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/07\/12\/performing-application-patch-tasks\/","title":{"rendered":"Performing Application Patch Tasks"},"content":{"rendered":"\n<p>Neste artigo, vamos simular a aplica\u00e7\u00e3o de Patch em um ambiente Multitenant, especificamente em um Application Container e seus Application PDBs.<\/p>\n\n\n\n<p>Na consulta abaixo, vemos que a vers\u00e3o de nossa aplica\u00e7\u00e3o atual \u00e9 2.0:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@quiasma ~]$ sqlplus sys\/oracle@HR_AC as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Jul 12 19:24:14 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.13.0.0.0\n \nSQL&gt; column app_name format a15\nSQL&gt; column app_version format a10\nSQL&gt; column app_status format a15\nSQL&gt; SELECT APP_NAME, APP_VERSION, APP_STATUS FROM DBA_APPLICATIONS WHERE APP_IMPLICIT=&#039;N&#039;;\n \nAPP_NAME        APP_VERSIO APP_STATUS\n--------------- ---------- ---------------\nHR_APP          2.0        NORMAL\n<\/pre><\/div>\n\n\n<p>Para iniciar o processo de Patch, vamos executar o script abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER PLUGGABLE DATABASE APPLICATION HR_APP BEGIN PATCH 201 MINIMUM VERSION &#039;2.0&#039;;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Vamos alterar uma tabela j\u00e1 existente, adicionando nela uma coluna:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER TABLE HR.JOB_HISTORY ADD ( NOTES VARCHAR2(20));\n \nTable altered.\n<\/pre><\/div>\n\n\n<p>Finalizando o processo de patch:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER PLUGGABLE DATABASE APPLICATION HR_APP END PATCH 201;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Percebemos que, diferente do processo de UPGRADE, n\u00e3o \u00e9 criamos um clone do Application Container (o Container &#8220;F3315411449_3_1&#8221; foi criado no \u00faltimo artigo):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; conn \/ as sysdba\nConnected.\nSQL&gt; col name format a20\nSQL&gt; SELECT CON_ID, NAME, APPLICATION_ROOT, OPEN_MODE, APPLICATION_ROOT_CON_ID FROM V$PDBS ORDER BY 3,1;\n \n    CON_ID NAME                 APP OPEN_MODE  APPLICATION_ROOT_CON_ID\n---------- -------------------- --- ---------- -----------------------\n         2 PDB$SEED             NO  READ ONLY\n         3 HIPOFISE2            NO  READ WRITE\n         4 HIPOFISE1            NO  READ WRITE\n         6 HR_PDB1              NO  READ WRITE                       5\n         7 HR_PDB2              NO  READ WRITE                       5\n         5 HR_AC                YES READ WRITE\n         9 F3315411449_3_1      YES READ WRITE                       5\n \n7 rows selected.\n<\/pre><\/div>\n\n\n<p>Com a consulta abaixo, podemos ver que o Patch foi aplicado com sucesso:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; conn sys\/oracle@HR_AC as sysdba\nConnected.\nSQL&gt; SELECT APP_NAME, PATCH_NUMBER, PATCH_MIN_VERSION, PATCH_STATUS FROM DBA_APP_PATCHES WHERE APP_NAME=&#039;HR_APP&#039;;\n \nAPP_NAME        PATCH_NUMBER PATCH_MIN_VERSION              PATCH_STAT\n--------------- ------------ ------------------------------ ----------\nHR_APP                   201 2.0                            INSTALLED\n<\/pre><\/div>\n\n\n<p>Por\u00e9m o mesmo ainda n\u00e3o foi refletido para os Application PDBs, e por conta disso, vamos realizar este sincronismo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER SESSION SET CONTAINER=HR_PDB1;\n \nSession altered.\n \nSQL&gt; ALTER PLUGGABLE DATABASE APPLICATION HR_APP SYNC;\n \nPluggable database altered.\n \nSQL&gt; ALTER SESSION SET CONTAINER=HR_PDB2;\n \nSession altered.\n \nSQL&gt; ALTER PLUGGABLE DATABASE APPLICATION HR_APP SYNC;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Apesar de n\u00e3o conseguir validar qual PDB est\u00e1 com o patch aplicado (caso algu\u00e9m saiba como se faz, me mande mensagem por favor!), podemos ver que o patch foi replicado para os Application PDBs com as evid\u00eancias que vir\u00e3o mais adiante:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER SESSION SET CONTAINER=HR_AC;\n \nSession altered.\n \nSQL&gt; SELECT APP_NAME, PATCH_NUMBER, PATCH_MIN_VERSION, PATCH_STATUS FROM DBA_APP_PATCHES WHERE APP_NAME=&#039;HR_APP&#039;;\n \nAPP_NAME        PATCH_NUMBER PATCH_MIN_VERSION              PATCH_STAT\n--------------- ------------ ------------------------------ ----------\nHR_APP                   201 2.0                            INSTALLED\n \nSQL&gt; column name format a15\nSQL&gt; column app_name format a15\nSQL&gt; column app_version format a10\nSQL&gt; SELECT C.NAME, APS.APP_NAME, APS.APP_VERSION, APS.APP_STATUS FROM DBA_APP_PDB_STATUS APS JOIN V$CONTAINERS C ON C.CON_UID = APS.CON_UID WHERE APS.APP_NAME = &#039;HR_APP&#039;;\n \nNAME            APP_NAME        APP_VERSIO APP_STATUS\n--------------- --------------- ---------- ---------------\nHR_PDB2         HR_APP          2.0        NORMAL\nHR_PDB1         HR_APP          2.0        NORMAL\n<\/pre><\/div>\n\n\n<p>Constatando que a nova coluna (NOTES) se encontra nos Application PDBs:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ALTER SESSION SET CONTAINER=HR_PDB1;\n \nSession altered.\n \nSQL&gt; DESC HR.JOB_HISTORY\n Name                                      Null?    Type\n ----------------------------------------- -------- ----------------------------\n EMPLOYEE_ID                               NOT NULL NUMBER(6)\n START_DATE                                NOT NULL DATE\n END_DATE                                  NOT NULL DATE\n JOB_ID                                    NOT NULL VARCHAR2(10)\n DEPARTMENT_ID                                      NUMBER(4)\n NOTES                                              VARCHAR2(20)\n \nSQL&gt; ALTER SESSION SET CONTAINER=HR_PDB2;\n \nSession altered.\n \nSQL&gt; DESC HR.JOB_HISTORY;\n Name                                      Null?    Type\n ----------------------------------------- -------- ----------------------------\n EMPLOYEE_ID                               NOT NULL NUMBER(6)\n START_DATE                                NOT NULL DATE\n END_DATE                                  NOT NULL DATE\n JOB_ID                                    NOT NULL VARCHAR2(10)\n DEPARTMENT_ID                                      NUMBER(4)\n NOTES                                              VARCHAR2(20)\n<\/pre><\/div>\n\n\n<p>Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laborat\u00f3rio pessoal para fins de aprendizado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Neste artigo, vamos simular a aplica\u00e7\u00e3o de Patch em um ambiente Multitenant, especificamente em um Application Container e seus Application PDBs. Na consulta abaixo, vemos que a vers\u00e3o de nossa aplica\u00e7\u00e3o atual \u00e9 2.0: Para iniciar o processo de Patch, vamos executar o script abaixo: Vamos alterar uma tabela j\u00e1 existente, adicionando nela uma coluna: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-5754","post","type-post","status-publish","format-standard","hentry","category-multitenant"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=5754"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5754\/revisions"}],"predecessor-version":[{"id":9082,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5754\/revisions\/9082"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=5754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=5754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=5754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}