{"id":2870,"date":"2021-03-19T08:48:53","date_gmt":"2021-03-19T08:48:53","guid":{"rendered":"https:\/\/swiv.com.br\/creating-a-new-pdb-by-plugging-in-an-unplugged-pdb-with-move-clause\/"},"modified":"2026-05-27T20:02:50","modified_gmt":"2026-05-27T19:02:50","slug":"creating-a-new-pdb-by-plugging-in-an-unplugged-pdb-with-move-clause","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/19\/creating-a-new-pdb-by-plugging-in-an-unplugged-pdb-with-move-clause\/","title":{"rendered":"Creating a new PDB by Plugging in an Unplugged PDB (with MOVE clause)"},"content":{"rendered":"\n<p>A cl\u00e1usula MOVE nos permite direcionar os arquivos descritos no arquivo XML para um novo local, e em vez de ter sua c\u00f3pia realizada, teremos a sua movimenta\u00e7\u00e3o. Checando dados do PDB de origem e o desligando:<\/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 NAME FROM V$PDBS;\n \nNAME\n--------------------------------------------------------------------------------\nPDB$SEED\nHIPOFISE1\nHIPOFISE2\n \nSQL&gt; set linesize 100\nSQL&gt; col name format a100\nSQL&gt; SELECT NAME FROM V$DATAFILE WHERE CON_ID = (SELECT CON_ID FROM V$PDBS WHERE NAME=&#039;HIPOFISE2&#039;);\n \nNAME\n----------------------------------------------------------------------------------------------------\n\/oracle\/dados\/TALAMO\/BD02D62DBD0C163FE0536B00A8C0EF43\/datafile\/o1_mf_system_j57ozm1w_.dbf\n\/oracle\/dados\/TALAMO\/BD02D62DBD0C163FE0536B00A8C0EF43\/datafile\/o1_mf_sysaux_j57ozm1z_.dbf\n\/oracle\/dados\/TALAMO\/BD02D62DBD0C163FE0536B00A8C0EF43\/datafile\/o1_mf_undotbs1_j57ozm23_.dbf\n\/oracle\/dados\/TALAMO\/BD02D62DBD0C163FE0536B00A8C0EF43\/datafile\/o1_mf_users_j57ozm23_.dbf\n \nSQL&gt; SELECT GUID FROM V$PDBS WHERE NAME=&#039;HIPOFISE2&#039;;\n \nGUID\n--------------------------------\nBD02D62DBD0C163FE0536B00A8C0EF43\n \nSQL&gt; ALTER PLUGGABLE DATABASE HIPOFISE2 CLOSE IMMEDIATE;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Realizando o UNPLUG:<\/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 UNPLUG INTO &#039;\/home\/oracle\/BSS.xml&#039;;\n \nPluggable database altered.\n<\/pre><\/div>\n\n\n<p>Checando compatibilidade do PDB com o CDB. \u00c9 reportado um erro pois o PDB de origem fica no mesmo CDB de destino, e n\u00e3o quero drop\u00e1-lo antes do move para ver o comportamento do processo:<\/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; set serveroutput on\nDECLARE\n        compatible BOOLEAN := FALSE;\nBEGIN\n        compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY( PDB_DESCR_FILE =&gt; &#039;\/home\/oracle\/BSS.xml&#039;);\n        if compatible then\n                DBMS_OUTPUT.PUT_LINE(&#039;It is compatible&#039;);\n        else\n        DBMS_OUTPUT.PUT_LINE(&#039;It is NOT compatible&#039;);\n        end if;\nEND;\n\/SQL&gt;   2    3    4    5    6    7    8    9   10   11\nDECLARE\n*\nERROR at line 1:\nORA-65012: Pluggable database HIPOFISE2 already exists.\nORA-06512: at &quot;SYS.DBMS_PDB&quot;, line 32\nORA-06512: at line 4\n<\/pre><\/div>\n\n\n<p>Realizando o clone e confirmando que o GUID do PDB novo \u00e9 diferente do 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; CREATE PLUGGABLE DATABASE HIPOFISE3 AS CLONE USING &#039;\/home\/oracle\/BSS.xml&#039; MOVE;\n \nPluggable database created.\n \nSQL&gt; SELECT GUID FROM V$PDBS WHERE NAME=&#039;HIPOFISE3&#039;;\n \nGUID\n--------------------------------\nBDD845CA2D5E45ABE0536B00A8C0F2F1\n<\/pre><\/div>\n\n\n<p>Validando arquivos 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=\"\">\nSQL&gt; ! ls -lthr \/oracle\/dados\/TALAMO\/BDD845CA2D5E45ABE0536B00A8C0F2F1\/datafile\ntotal 746M\n-rw-r-----. 1 oracle oinstall  75M Mar 18 20:58 o1_mf_temp_j57t9v0q_.dbf\n-rw-r-----. 1 oracle oinstall 5.1M Mar 18 20:58 o1_mf_users_j57t9v0r_.dbf\n-rw-r-----. 1 oracle oinstall 101M Mar 18 20:58 o1_mf_undotbs1_j57t9v0q_.dbf\n-rw-r-----. 1 oracle oinstall 271M Mar 18 20:58 o1_mf_system_j57t9v0p_.dbf\n-rw-r-----. 1 oracle oinstall 371M Mar 18 20:58 o1_mf_sysaux_j57t9v0q_.dbf\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>A cl\u00e1usula MOVE nos permite direcionar os arquivos descritos no arquivo XML para um novo local, e em vez de ter sua c\u00f3pia realizada, teremos a sua movimenta\u00e7\u00e3o. Checando dados do PDB de origem e o desligando: Realizando o UNPLUG: Checando compatibilidade do PDB com o CDB. \u00c9 reportado um erro pois o PDB de [&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-2870","post","type-post","status-publish","format-standard","hentry","category-multitenant"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2870","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=2870"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2870\/revisions"}],"predecessor-version":[{"id":9218,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2870\/revisions\/9218"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}