新特性:CDB/PDB的维护命令:修改PDB名称

将PDB3_WHS修改为PDB4_WHS

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1_WHS                       READ WRITE NO
         4 PDB2_WHS                       MOUNTED
         5 PDB3_WHS                       READ WRITE NO
SQL> alter session set container=PDB3_WHS;

Session altered.

SQL> alter pluggable database rename global_name to PDB4_WHS;
alter pluggable database rename global_name to PDB4_WHS
*
ERROR at line 1:
ORA-65045: pluggable database not in a restricted mode

提示必须在restricted mode下修改


SQL> alter pluggable database close immediate;

Pluggable database altered.

SQL> alter pluggable database  open restricted;

Pluggable database altered.

SQL> alter pluggable database rename global_name to PDB4_WHS;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         5 PDB4_WHS                       READ WRITE YES

可以看到修改成功,再还原回去


SQL> alter pluggable database rename global_name to PDB3_WHS;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         5 PDB3_WHS                       READ WRITE YES

回复数据库到正常开启状态

SQL>  alter pluggable database close immediate;

Pluggable database altered.

SQL> alter pluggable database  open;

Pluggable database altered.

Related Posts