Database
 sql >> Base de Dados >  >> RDS >> Database

Renomeando banco de dados plugável


Objetivo
Renomear um banco de dados plugável (PDB) de PDBWFM para PDBWFM01.
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Tue May 5 12:22:30 2020

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBWFM READ WRITE NO

Para operação de renomeação um PDB deve estar no modo RESTRICTED:
SQL> alter pluggable database PDBWFM close immediate;
Pluggable database altered.

SQL> alter pluggable database PDBWFM open restricted;
Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME OPEN_MODE RESTRICTED
------------------------------ ---------- ----------
PDB$SEED READ ONLY NO
PDBWFM READ WRITE YES

Execute a renomeação e reinicie (CLOSE/OPEN) um PDB:

SQL> alter session set container = PDBWFM;
Session altered.

SQL> alter pluggable database PDBWFM rename global_name to PDBWFM01;
Pluggable database altered.

SQL> alter pluggable database PDBWFM01 close immediate;
Pluggable database altered.

SQL> alter pluggable database PDBWFM01 open;
Pluggable database altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDBWFM01 READ WRITE NO

Os diretórios correspondentes ao PDB não são renomeados. Caso queira mover os datafiles para um novo diretório utilize o recurso “Online Move Datafile” do Oracle 12c.
Para renomear Oracle Managed-Files (OMF) consulte a documentação disponível na referência deste artigo [1].

Referências
[1] Como renomear arquivos gerenciados pela Oracle (OMFs) (Doc ID 191574.1). Disponível em:https://support.oracle.com/knowledge/Oracle%20Database%20Products/191574_1.html