{"id":2878,"date":"2021-03-19T09:08:44","date_gmt":"2021-03-19T09:08:44","guid":{"rendered":"https:\/\/swiv.com.br\/creating-a-new-pdb-by-pluggin-in-an-unplugged-pdb-using-pdb-archive-file\/"},"modified":"2026-05-27T20:02:50","modified_gmt":"2026-05-27T19:02:50","slug":"creating-a-new-pdb-by-pluggin-in-an-unplugged-pdb-using-pdb-archive-file","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/19\/creating-a-new-pdb-by-pluggin-in-an-unplugged-pdb-using-pdb-archive-file\/","title":{"rendered":"Creating a new PDB by Pluggin in an Unplugged PDB using PDB Archive File"},"content":{"rendered":"\n<p>No procedimento tradicional de plug\/unplug de PDBs, n\u00f3s utilizamos um arquivo XML que descreve as informa\u00e7\u00f5es e estruturas do PDB que ser\u00e1 criado no novo CDB. A partir do XML, nos bastidores, o Oracle faz a c\u00f3pia dos datafiles referenciados ou at\u00e9 mesmo o seu move. Mas outra alternativa para esse processo s\u00e3o os PDBs Archive Files, que contempla as informa\u00e7\u00f5es do PDB + os seus datafiles, todos compactados em um \u00fanico arquivo com extens\u00e3o &#8220;.pdb&#8221;. Para explorar esse recurso, vamos checar a 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@oel8 TALAMO]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Thu Mar 18 21:18:10 2021\nVersion 18.3.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.3.0.0.0\n \nSQL&gt; ALTER SESSION SET CONTAINER=HIPOFISE1;\n \nSession altered.\n \nSQL&gt; SELECT ROUND(SUM(BYTES)\/1024\/1024,2) SPACE_IN_MB FROM DBA_SEGMENTS;\n \nSPACE_IN_MB\n-----------\n     623.44\n<\/pre><\/div>\n\n\n<p>Baixando PDB de origem:<\/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=CDB$ROOT;\n \nSession altered.\n \nSQL&gt; ALTER PLUGGABLE DATABASE HIPOFISE1 CLOSE IMMEDIATE;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Fazendo o unplug e criando o arquivo de archive 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 HIPOFISE1 UNPLUG INTO &#039;\/home\/oracle\/BSS.pdb&#039;;\n \nPluggable database altered.\n \nSQL&gt; ! ls -alh \/home\/oracle\/BSS.pdb\n-rw-r--r--. 1 oracle oinstall 174M Mar 18 21:20 \/home\/oracle\/BSS.pdb\n<\/pre><\/div>\n\n\n<p>Criando novo PDB, usando a cl\u00e1usula AS CLONE para que um novo GUID seja criado:<\/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; CREATE PLUGGABLE DATABASE HIPOFISE2 AS CLONE USING &#039;\/home\/oracle\/BSS.pdb&#039; COPY;\n \nPluggable database created.\n<\/pre><\/div>\n\n\n<p>Abrindo 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 HIPOFISE2 OPEN;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Comparando origem e 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; col pdb_name format a5\nSQL&gt; SELECT PDB_NAME, STATUS FROM CDB_PDBS WHERE PDB_NAME IN (&#039;HIPOFISE1&#039;,&#039;HIPOFISE2&#039;);\n \nPDB_N STATUS\n----- ----------\nHIPOF UNPLUGGED\nISE1\n \nHIPOF NORMAL\nISE2\n \n \nSQL&gt; SELECT OPEN_MODE FROM V$PDBS WHERE NAME IN (&#039;HIPOFISE1&#039;,&#039;HIPOFISE2&#039;);\n \nOPEN_MODE\n----------\nMOUNTED\nREAD WRITE\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>No procedimento tradicional de plug\/unplug de PDBs, n\u00f3s utilizamos um arquivo XML que descreve as informa\u00e7\u00f5es e estruturas do PDB que ser\u00e1 criado no novo CDB. A partir do XML, nos bastidores, o Oracle faz a c\u00f3pia dos datafiles referenciados ou at\u00e9 mesmo o seu move. Mas outra alternativa para esse processo s\u00e3o os PDBs [&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-2878","post","type-post","status-publish","format-standard","hentry","category-multitenant"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2878","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=2878"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2878\/revisions"}],"predecessor-version":[{"id":9217,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2878\/revisions\/9217"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}