Rename PDB in 12.2
Create test pdb called s24pdb:
SQL> create pluggable database s24pdb admin user s24test identified by ****;
Pluggable database created.
SQL> alter pluggable database S24PDB open;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB READ WRITE NO
SQL> alter pluggable database S24PDB close;
Pluggable database altered.
SQL> alter pluggable database S24PDB open restricted;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB READ WRITE YES
SQL> alter session set container=S24PDB;
Session altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB READ WRITE YES
SQL> alter pluggable database rename global_name to S24PDB_NEW;
Pluggable database altered.
SQL> SHO PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB_NEW READ WRITE YES
SQL> alter pluggable database S24PDB_NEW CLOSE;
Pluggable database altered.
SQL> alter pluggable database S24PDB_NEW OPEN;
Pluggable database altered.
SQL> SHO PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB_NEW READ WRITE NO
SQL>
SQL> CONN /as sysdba
Connected.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB_NEW READ WRITE NO
IF we want to move datafiles to new PDB directory we can use ONLINE MOVE feature .
alter database move datafile
SQL> create pluggable database s24pdb admin user s24test identified by ****;
Pluggable database created.
SQL> alter pluggable database S24PDB open;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB READ WRITE NO
SQL> alter pluggable database S24PDB close;
Pluggable database altered.
SQL> alter pluggable database S24PDB open restricted;
Pluggable database altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB READ WRITE YES
SQL> alter session set container=S24PDB;
Session altered.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB READ WRITE YES
SQL> alter pluggable database rename global_name to S24PDB_NEW;
Pluggable database altered.
SQL> SHO PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB_NEW READ WRITE YES
SQL> alter pluggable database S24PDB_NEW CLOSE;
Pluggable database altered.
SQL> alter pluggable database S24PDB_NEW OPEN;
Pluggable database altered.
SQL> SHO PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 S24PDB_NEW READ WRITE NO
SQL>
SQL> CONN /as sysdba
Connected.
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TEST1 READ WRITE NO
5 S24PDB_NEW READ WRITE NO
IF we want to move datafiles to new PDB directory we can use ONLINE MOVE feature .
alter database move datafile
Comments
Post a Comment