{"id":2451,"date":"2021-03-07T19:08:45","date_gmt":"2021-03-07T19:08:45","guid":{"rendered":"https:\/\/swiv.com.br\/creating-an-oracle-pdb-from-the-seed-using-sql-plus\/"},"modified":"2026-05-27T20:02:52","modified_gmt":"2026-05-27T19:02:52","slug":"creating-an-oracle-pdb-from-the-seed-using-sql-plus","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/07\/creating-an-oracle-pdb-from-the-seed-using-sql-plus\/","title":{"rendered":"Creating an Oracle PDB from the seed using SQL *Plus"},"content":{"rendered":"\n<p>Apesar de ser poss\u00edvel definir o diret\u00f3rio que abrigar\u00e1 os arquivos no novo PDB, o indicado \u00e9 ter o recurso OMF no ambiente, para delegar ao Oracle a administra\u00e7\u00e3o dos arquivos e a defini\u00e7\u00e3o de seus diret\u00f3rios e nomes. Checando se o ambiente possui o OMF:<\/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 ~]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Sun Mar 7 15:41:50 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; show parameter DB_CREATE_FILE_DEST\n \nNAME                                 TYPE        VALUE\n------------------------------------ ----------- ------------------------------\ndb_create_file_dest                  string      \/oracle\/dados\nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Criando o PDB chamado HIPOFISE1:<\/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 HIPOFISE1\nADMIN USER BSS IDENTIFIED BY BSS\nDEFAULT TABLESPACE USERS\nSTORAGE (MAXSIZE 2G);  2    3    4\n \nPluggable database created.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Realizando a abertura do banco de dados:<\/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 OPEN;\n \nPluggable database altered.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Verificando se o PDB novo est\u00e1 registrado no listener:<\/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 ~]$ lsnrctl service\n \nLSNRCTL for Linux: Version 18.0.0.0.0 - Production on 07-MAR-2021 15:52:34\n \nCopyright (c) 1991, 2018, Oracle.  All rights reserved.\n \nConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel8.localdomain)(PORT=1521)))\nServices Summary...\nService &quot;TALAMO.localdomain&quot; has 1 instance(s).\n  Instance &quot;TALAMO&quot;, status READY, has 1 handler(s) for this service...\n    Handler(s):\n      &quot;DEDICATED&quot; established:0 refused:0 state:ready\n         LOCAL SERVER\nService &quot;TALAMOXDB.localdomain&quot; has 1 instance(s).\n  Instance &quot;TALAMO&quot;, status READY, has 1 handler(s) for this service...\n    Handler(s):\n      &quot;D000&quot; established:0 refused:0 current:0 max:1022 state:ready\n         DISPATCHER &amp;lt;machine: oel8.localdomain, pid: 4391&gt;\n         (ADDRESS=(PROTOCOL=tcp)(HOST=oel8.localdomain)(PORT=33655))\nService &quot;bcf7b920ca5c126ae0536b00a8c0b4f1.localdomain&quot; has 1 instance(s).\n  Instance &quot;TALAMO&quot;, status READY, has 1 handler(s) for this service...\n    Handler(s):\n      &quot;DEDICATED&quot; established:0 refused:0 state:ready\n         LOCAL SERVER\nService &quot;hipofise1.localdomain&quot; has 1 instance(s).\n  Instance &quot;TALAMO&quot;, status READY, has 1 handler(s) for this service...\n    Handler(s):\n      &quot;DEDICATED&quot; established:0 refused:0 state:ready\n         LOCAL SERVER\nThe command completed successfully\n&#x5B;oracle@oel8 ~]$\n<\/pre><\/div>\n\n\n<p>Adicionando uma nova string de conex\u00e3o no arquivo tnsnames.ora:<\/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]$ cat tnsnames.ora\n# tnsnames.ora Network Configuration File: \/oracle\/18.0.0\/product\/network\/admin\/tnsnames.ora\n# Generated by Oracle configuration tools.\n \nCORTEX =\n  (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP)(HOST = oel7.localdomain)(PORT = 1521))\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = cortex.localdomain)\n    )\n  )\n \nTALAMO =\n  (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP)(HOST = oel8.localdomain)(PORT = 1521))\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = TALAMO.localdomain)\n    )\n  )\n \nLISTENER_TALAMO =\n  (ADDRESS = (PROTOCOL = TCP)(HOST = oel8.localdomain)(PORT = 1521))\n \nHIPOFISE1 =\n  (DESCRIPTION =\n    (ADDRESS_LIST =\n        (ADDRESS = (PROTOCOL = TCP)(HOST = oel8.localdomain)(PORT = 1521))\n        )\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = HIPOFISE1.localdomain)\n    )\n  )\n&#x5B;oracle@oel8 admin]$\n<\/pre><\/div>\n\n\n<p>Realizando o teste de conex\u00e3o via listener:<\/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 BSS\/BSS@HIPOFISE1\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Sun Mar 7 16:01:17 2021\nVersion 18.3.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \nLast Successful login time: Sun Mar 07 2021 15:59:49 -03:00\n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.3.0.0.0\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Fazendo consulta no container sobre os seus PDBs. Uma coluna importante \u00e9 a GUID, que \u00e9 um ID \u00fanico para cada PDB, e que \u00e9 utilizado pelo OMF para cria\u00e7\u00e3o de diret\u00f3rios:<\/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 Sun Mar 7 16:03:09 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; SELECT INSTANCE_NAME,STATUS FROM V$INSTANCE;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\nTALAMO           OPEN\n \nSQL&gt; col name format a10\nSELECT NAME, CON_ID, OPEN_MODE, GUID FROM V$PDBS ORDER BY 1;SQL&gt;\n \nNAME           CON_ID OPEN_MODE  GUID\n---------- ---------- ---------- --------------------------------\nHIPOFISE1           3 READ WRITE BCF7B920CA5C126AE0536B00A8C0B4F1\nPDB$SEED            2 READ ONLY  BC8B772AA6A82204E0536B00A8C0CF6B\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Checando diret\u00f3rio criado OMF:<\/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]$ ll\ntotal 4\ndrwxr-x---. 3 oracle oinstall   22 Mar  7 15:45 BCF7B920CA5C126AE0536B00A8C0B4F1\ndrwxr-x---. 2 oracle oinstall   33 Mar  2 06:30 controlfile\ndrwxr-x---. 2 oracle oinstall 4096 Mar  2 06:36 datafile\ndrwxr-x---. 2 oracle oinstall   93 Mar  2 06:30 onlinelog\n&#x5B;oracle@oel8 TALAMO]$ pwd\n\/oracle\/dados\/TALAMO\n&#x5B;oracle@oel8 TALAMO]$ cd BCF7B920CA5C126AE0536B00A8C0B4F1\n&#x5B;oracle@oel8 BCF7B920CA5C126AE0536B00A8C0B4F1]$ ll\ntotal 0\ndrwxr-x---. 2 oracle oinstall 175 Mar  7 15:49 datafile\n&#x5B;oracle@oel8 BCF7B920CA5C126AE0536B00A8C0B4F1]$ cd datafile\/\n&#x5B;oracle@oel8 datafile]$ ll\ntotal 860248\n-rw-r-----. 1 oracle oinstall 387981312 Mar  7 16:04 o1_mf_sysaux_j4b7tm62_.dbf\n-rw-r-----. 1 oracle oinstall 283123712 Mar  7 16:04 o1_mf_system_j4b7tm5g_.dbf\n-rw-r-----. 1 oracle oinstall  65019904 Mar  7 15:49 o1_mf_temp_j4b7tm65_.dbf\n-rw-r-----. 1 oracle oinstall 104865792 Mar  7 16:01 o1_mf_undotbs1_j4b7tm63_.dbf\n-rw-r-----. 1 oracle oinstall 104865792 Mar  7 15:54 o1_mf_users_j4b81g2r_.dbf\n&#x5B;oracle@oel8 datafile]$\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>Apesar de ser poss\u00edvel definir o diret\u00f3rio que abrigar\u00e1 os arquivos no novo PDB, o indicado \u00e9 ter o recurso OMF no ambiente, para delegar ao Oracle a administra\u00e7\u00e3o dos arquivos e a defini\u00e7\u00e3o de seus diret\u00f3rios e nomes. Checando se o ambiente possui o OMF: Criando o PDB chamado HIPOFISE1: Realizando a abertura do [&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-2451","post","type-post","status-publish","format-standard","hentry","category-multitenant"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2451","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=2451"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2451\/revisions"}],"predecessor-version":[{"id":9246,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2451\/revisions\/9246"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}