{"id":3292,"date":"2021-03-29T09:34:34","date_gmt":"2021-03-29T09:34:34","guid":{"rendered":"https:\/\/swiv.com.br\/creating-a-proxy-pdb\/"},"modified":"2026-05-27T20:02:49","modified_gmt":"2026-05-27T19:02:49","slug":"creating-a-proxy-pdb","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/29\/creating-a-proxy-pdb\/","title":{"rendered":"Creating a PROXY PDB"},"content":{"rendered":"\n<p>Cada vez que descubro mais recursos do Multitenant, fico admirado com o n\u00famero de op\u00e7\u00f5es que temos em m\u00e3os. O Proxy PDB \u00e9 um deles. Basicamente usado como um ponto de conex\u00e3o local que faz refer\u00eancia autom\u00e1tica para algum PDB remoto. Neste artigo vou tentar simular a cria\u00e7\u00e3o deste tipo de PDB em meu ambiente laborat\u00f3rio.<\/p>\n\n\n<figure class=\\\"wp-block-table\\\"><table><tbody><tr><td><strong>CDB ORIGEM<\/strong><\/td><td><strong>CDB DESTINO<\/strong><\/td><td><strong>PDB ORIGEM<\/strong><\/td><td><strong>PDB DESTINO<\/strong><\/td><\/tr><tr><td>TALAMO<\/td><td>SINAPSE<\/td><td>HIPOFISE1<\/td><td>HIPOPROXY<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<p>Conectando no CDB de destino e realizando teste do DB_LINK p\u00fablico que aponta para o CDB de origem (no meu caso eu j\u00e1 o havia criado em outro artigo):<\/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@oel8 admin]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 29 05:48:47 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; select * from dual@BSS;\n \nD\n-\nX\n<\/pre><\/div>\n\n\n<p>Criando o Proxy PDB no ambiente de destino:<\/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 DB_CREATE_FILE_DEST=&#039;\/oracle\/SINAPSE\/dados&#039;;\n \nSession altered.\n \nSQL&gt; CREATE PLUGGABLE DATABASE HIPOPROXY AS PROXY FROM HIPOFISE1@BSS;\n \nPluggable database created.\n<\/pre><\/div>\n\n\n<p>Ao abrir o PDB, \u00e9 reportado diferen\u00e7a de vers\u00e3o entre o PDB e CDB. Precisaremos realizar um datapatch. Creio que isso esteja acontecendo pois quando apliquei o PSU no CDB de origem, n\u00e3o fiz o datapatch no SEED:<\/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 HIPOPROXY OPEN;\n \nWarning: PDB altered with errors.\n \nSQL&gt; SELECT TIME,CAUSE,MESSAGE,TYPE FROM PDB_PLUG_IN_VIOLATIONS WHERE NAME=&#039;HIPOPROXY&#039;;\n \nTIME\n---------------------------------------------------------------------------\nCAUSE\n----------------------------------------------------------------\nMESSAGE\n--------------------------------------------------------------------------------\nTYPE\n---------\n29-MAR-21 05.57.14.755414 AM\nParameter\nCDB parameter ddl_lock_timeout mismatch: Previous 666 Current 0\nWARNING\n \n \nTIME\n---------------------------------------------------------------------------\nCAUSE\n----------------------------------------------------------------\nMESSAGE\n--------------------------------------------------------------------------------\nTYPE\n---------\n29-MAR-21 05.57.15.024817 AM\nSQL Patch\n&#039;18.13.0.0.0 Release_Update 2012231849&#039; is installed in the CDB but &#039;18.3.0.0.0\nRelease_Update 1806280943&#039; is installed in the PDB\nERROR\n \nTIME\n---------------------------------------------------------------------------\nCAUSE\n----------------------------------------------------------------\nMESSAGE\n--------------------------------------------------------------------------------\nTYPE\n---------\n<\/pre><\/div>\n\n\n<p>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=\"\">\n&#x5B;oracle@oel8 dados]$ cd $ORACLE_HOME\/OPatch\n&#x5B;oracle@oel8 OPatch]$ .\/datapatch -verbose -pdbs HIPOPROXY\nSQL Patching tool version 18.0.0.0.0 Production on Mon Mar 29 06:00:34 2021\nCopyright (c) 2012, 2020, Oracle.  All rights reserved.\n \nLog file for this invocation: \/oracle\/18.0.0\/base\/cfgtoollogs\/sqlpatch\/sqlpatch_24906_2021_03_29_06_00_34\/sqlpatch_invocation.log\n \nConnecting to database...OK\nGathering database info...done\n \nNote:  Datapatch will only apply or rollback SQL fixes for PDBs\n       that are in an open state, no patches will be applied to closed PDBs.\n       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation\n       (Doc ID 1585822.1)\n \nBootstrapping registry and package to current versions...done\nDetermining current state...done\n \nCurrent state of interim SQL patches:\nInterim patch 27923415 (OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)):\n  Binary registry: Installed\n  PDB HIPOPROXY: Applied successfully on 02-MAR-21 06.44.54.948445 AM\n \nCurrent state of release update SQL patches:\n  Binary registry:\n    18.13.0.0.0 Release_Update 2012231849: Installed\n  PDB HIPOPROXY:\n    Applied 18.3.0.0.0 Release_Update 1806280943 successfully on 02-MAR-21 06.44.54.938616 AM\n \nAdding patches to installation queue and performing prereq checks...done\nInstallation queue:\n  For the following PDBs: HIPOPROXY\n    No interim patches need to be rolled back\n    Patch 32204699 (Database Release Update : 18.13.0.0.210119 (32204699)):\n      Apply from 18.3.0.0.0 Release_Update 1806280943 to 18.13.0.0.0 Release_Update 2012231849\n    No interim patches need to be applied\n \nInstalling patches...\nPatch installation complete.  Total patches installed: 1\n \nValidating logfiles...done\nPatch 32204699 apply (pdb HIPOPROXY): SUCCESS\n  logfile: \/oracle\/18.0.0\/base\/cfgtoollogs\/sqlpatch\/32204699\/24011084\/32204699_apply_SINAPSE_HIPOPROXY_2021Mar29_06_01_32.log (no errors)\nSQL Patching tool complete on Mon Mar 29 06:12:00 2021\n<\/pre><\/div>\n\n\n<p>Reiniciando o PDB:<\/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 HIPOPROXY CLOSE;\n \nPluggable database altered.\n \nSQL&gt; ALTER PLUGGABLE DATABASE HIPOPROXY OPEN;\n \nPluggable database altered.\n \nSQL&gt; ALTER PLUGGABLE DATABASE HIPOPROXY SAVE STATE;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Com a consulta abaixo, podemos saber que o PDB \u00e9 do tipo PROXY:<\/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; SELECT PDB_NAME, CON_ID, IS_PROXY_PDB FROM CDB_PDBS WHERE PDB_NAME=&#039;HIPOPROXY&#039;;\n \nPDB_NAME\n--------------------------------------------------------------------------------\n    CON_ID IS_\n---------- ---\nHIPOPROXY\n         4 YES\n<\/pre><\/div>\n\n\n<p>Checando o CDB_ID do novo PDB de destino:<\/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; select CON_ID,name from v$pdbs where name=&#039;HIPOPROXY&#039;;\n \n    CON_ID\n----------\nNAME\n--------------------------------------------------------------------------------\n         4\nHIPOPROXY\n<\/pre><\/div>\n\n\n<p>O interessante \u00e9 que os \u00fanicos datafiles que o mesmo possui s\u00e3o a SYSTEM, SYSAUX e UNDO:<\/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; SELECT T.NAME TABLESPACE_NAME, D.NAME FROM V$TABLESPACE T, V$DATAFILE D WHERE T.TS# = D.TS# AND T.CON_ID=4 AND D.CON_ID=4;\n \nTABLESPACE_NAME\n------------------------------\nNAME\n--------------------------------------------------------------------------------\nSYSTEM\n\/oracle\/SINAPSE\/dados\/SINAPSE\/BEAA0D2DC3C85BEBE0536B00A8C05826\/datafile\/o1_mf_sy\nstem_j635k5qk_.dbf\n \nSYSAUX\n\/oracle\/SINAPSE\/dados\/SINAPSE\/BEAA0D2DC3C85BEBE0536B00A8C05826\/datafile\/o1_mf_sy\nsaux_j635k5qq_.dbf\n \nUNDOTBS1\n \nTABLESPACE_NAME\n------------------------------\nNAME\n--------------------------------------------------------------------------------\n\/oracle\/SINAPSE\/dados\/SINAPSE\/BEAA0D2DC3C85BEBE0536B00A8C05826\/datafile\/o1_mf_un\ndotbs1_j635k5qq_.dbf\n<\/pre><\/div>\n\n\n<p>Para testar o recurso de Proxy PDB, vamos criar um schema no ambiente de Origem, com uma tabela:<\/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 admin]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 29 06:26:33 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; select instance_name,status from v$instance;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\nTALAMO           OPEN\n \nSQL&gt; ALTER SESSION SET CONTAINER=HIPOFISE1;\n \nSession altered.\n \nSQL&gt; CREATE USER TESTE IDENTIFIED BY TESTE DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS;\n \nUser created.\n \nSQL&gt; GRANT CREATE SESSION, CREATE TABLE TO TESTE;\n \nGrant succeeded.\n \nSQL&gt; CREATE TABLE TESTE.TABELA (DESCRICAO VARCHAR2(100));\n \nTable created.\n \nSQL&gt; INSERT INTO TESTE.TABELA (DESCRICAO) VALUES (&#039;TEXTO NA ORIGEM&#039;);\n \n1 row created.\n \nSQL&gt; COMMIT;\n \nCommit complete.\n<\/pre><\/div>\n\n\n<p>Conectando no PDB Proxy no CDB de destino, e inserindo uma linha nesta mesma tabela de teste:<\/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@oel8 admin]$ sqlplus system\/oracle@HIPOPROXY\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 29 06:31:46 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \nLast Successful login time: Mon Mar 29 2021 06:22:03 -03:00\n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.13.0.0.0\n \nSQL&gt; INSERT INTO TESTE.TABELA (DESCRICAO) VALUES (&#039;TEXTO NO DESTINO&#039;);\n \n1 row created.\n \nSQL&gt; COMMIT;\n \nCommit complete.\n<\/pre><\/div>\n\n\n<p>Consultando a tabela na origem:<\/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 admin]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 29 06:32:43 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; select instance_name,status from v$instance;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\nTALAMO           OPEN\n \nSQL&gt; ALTER SESSION SET CONTAINER=HIPOFISE1;\n \nSession altered.\n \nSQL&gt; SELECT * FROM TESTE.TABELA;\n \nDESCRICAO\n--------------------------------------------------------------------------------\nTEXTO NA ORIGEM\nTEXTO NO DESTINO\n<\/pre><\/div>\n\n\n<p>Consultando tabela no destino:<\/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@oel8 admin]$ sqlplus system\/oracle@HIPOPROXY\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Mar 29 06:33:36 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \nLast Successful login time: Mon Mar 29 2021 06:31:46 -03:00\n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.13.0.0.0\n \nSQL&gt; SELECT * FROM TESTE.TABELA;\n \nDESCRICAO\n--------------------------------------------------------------------------------\nTEXTO NA ORIGEM\nTEXTO NO DESTINO\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>Cada vez que descubro mais recursos do Multitenant, fico admirado com o n\u00famero de op\u00e7\u00f5es que temos em m\u00e3os. O Proxy PDB \u00e9 um deles. Basicamente usado como um ponto de conex\u00e3o local que faz refer\u00eancia autom\u00e1tica para algum PDB remoto. Neste artigo vou tentar simular a cria\u00e7\u00e3o deste tipo de PDB em meu ambiente [&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-3292","post","type-post","status-publish","format-standard","hentry","category-multitenant"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3292","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=3292"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3292\/revisions"}],"predecessor-version":[{"id":9198,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3292\/revisions\/9198"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=3292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=3292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=3292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}