文章目录
一、修改PDB的global_name
sql
SYS@orcl1>sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB READ WRITE NO
SYS@orcl1>alter session set container=pdb;
Session altered.
SYS@orcl1>select * from global_name;
GLOBAL_NAME
---------------------------------------------------------------------------------------------------------------------------
PDB.CN.OSC.ORACLE.COM
SYS@orcl1>sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 PDB READ WRITE NO
SYS@orcl1>
SYS@orcl1>sho parameter domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string cn.osc.oracle.com
SYS@orcl1>
SYS@orcl1>UPDATE GLOBAL_NAME SET GLOBAL_NAME='orcl';
1 row updated.
SYS@orcl1>commit;
Commit complete.
SYS@orcl1>select * from global_name;
GLOBAL_NAME
---------------------------------------------------------------------------------------------------------------------------
orcl
cdb信息确认:
sql
SYS@orcl1>alter session set container=cdb$root;
Session altered.
SYS@orcl1>sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB READ WRITE NO
--- there is nothing change for cdb
SYS@orcl1>select * from global_name;
GLOBAL_NAME
---------------------------------------------------------------------------------------------------------------------------
ORCL.CN.OSC.ORACLE.COM
二、重启数据库实例
sql
#grid
srvctl stop database -o immediate -d orcl
srvctl start database -d orcl
测试:
创建dblink后,查询字典表dba_db_links来确认dblink名称是否可以创建为不带域名的。
三、修改domain后重试
如以上未成功可尝试此操作
sql
#首先show parameter domain看参数值,需要设为null
alter system set db_domain='' scope=spfile sid='*';
#重启数据库实例