Changing the Oracle Global Database Name of a PDB

Criando um PDB a partir do SEED:

[oracle@oel8 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 18.0.0.0.0 - Production on Tue Mar 16 11:03:03 2021
Version 18.3.0.0.0
 
Copyright (c) 1982, 2018, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
 
SQL> SELECT NAME,OPEN_MODE,CDB FROM V$DATABASE;
 
NAME      OPEN_MODE            CDB
--------- -------------------- ---
TALAMO    READ WRITE           YES
 
SQL> CREATE PLUGGABLE DATABASE BSS ADMIN USER BSSADMIN IDENTIFIED BY BSS;
 
Pluggable database created.
 
SQL> ALTER PLUGGABLE DATABASE BSS OPEN;
 
Pluggable database altered.

Baixando o banco de dados e subindo em modo restrito:

SQL> ALTER PLUGGABLE DATABASE BSS CLOSE IMMEDIATE;
 
Pluggable database altered.
 
SQL> ALTER PLUGGABLE DATABASE BSS OPEN RESTRICTED;
 
Pluggable database altered.
 
SQL> SELECT CON_ID, OPEN_MODE, RESTRICTED FROM V$PDBS WHERE NAME='BSS';
 
    CON_ID OPEN_MODE  RES
---------- ---------- ---
         5 READ WRITE YES

Realizando a alteração:

SQL> ALTER SESSION SET CONTAINER=BSS;
 
Session altered.
 
SQL> ALTER PLUGGABLE DATABASE BSS RENAME GLOBAL_NAME to AXONIO;
 
Pluggable database altered.
 
SQL> SELECT CON_ID, OPEN_MODE, RESTRICTED FROM V$PDBS WHERE NAME='AXONIO';
 
    CON_ID OPEN_MODE  RES
---------- ---------- ---
         5 READ WRITE YES
 
SQL> ALTER PLUGGABLE DATABASE AXONIO CLOSE IMMEDIATE;
 
Pluggable database altered.
 
SQL> ALTER PLUGGABLE DATABASE AXONIO OPEN;
 
Pluggable database altered.
 
SQL> SELECT CON_ID, OPEN_MODE, RESTRICTED FROM V$PDBS WHERE NAME='AXONIO';
 
    CON_ID OPEN_MODE  RES
---------- ---------- ---
         5 READ WRITE NO

Realizando o teste de conexão usando easyconnect:

SQL> conn BSSADMIN/BSS@//oel8.localdomain:1521/AXONIO.localdomain
Connected.

Dropando o banco de dados:

SQL> ALTER PLUGGABLE DATABASE AXONIO CLOSE IMMEDIATE;
 
Pluggable database altered.
 
SQL> DROP PLUGGABLE DATABASE AXONIO INCLUDING DATAFILES;
 
Pluggable database dropped.
 
SQL> col name format a10
SQL> SELECT NAME, CON_ID, OPEN_MODE, RESTRICTED FROM V$PDBS ORDER BY 1;
 
NAME           CON_ID OPEN_MODE  RES
---------- ---------- ---------- ---
HIPOFISE1           3 READ WRITE NO
HIPOFISE2           4 READ WRITE NO
PDB$SEED            2 READ ONLY  NO

Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laboratório pessoal para fins de aprendizado.

Leave a Comment

Your email address will not be published.