For some reason, a database has to be reconfigured with a domain name “.world”. After change the spfile and bounced the database, we need change the global_name manually.
- Check current global_name in CDB:
SQL> select * from global_name;
GLOBAL_NAME
--------------
TESTDB
2. Drop database links now, and need recreate them later. because they are inaccessible after global_name changed. Otherwise you will get the following errors:
SQL> drop database link TESTDBLINK;
drop database link TESTDBLINK
*
ERROR at line 1:
ORA-02024: database link not found
To fix this issue, you have to rename global_name back to without ‘.world’, and remove domain from GLOBAL_NAME. The only way to remove the domain is to manually update the props$ table.
SQL> connect / as sysdba SQL> show parameter domain NAME TYPE VALUE ------------------------------------ ----------- ----------------- db_domain string world SQL> alter database rename global_name to "TESTDB"; Database altered. SQL> select * from global_name; GLOBAL_NAME ------------- TESTDB SQL> update sys.props$ set value$ = 'TESTDB' where name = 'GLOBAL_DB_NAME'; 1 row updated. SQL> select * from global_name; GLOBAL_NAME -------------- TESTDB SQL> commit; SQL> drop database link TESTDB; -> Drop old dblinks Database link dropped. at this point, you should define db_domain to a not NULL value, rename GLOBAL_NAME to db_name.db_domain and drop and recreate all dblinks. SQL> alter database rename global_name to "TESTDB.WORLD"; Database altered. SQL> select * from global_name; GLOBAL_NAME ------------------------------ TESTDB.WORLD
3. Change global name in CDB.
QL> alter database TESTDB rename global_name to "TESTDB.WORLD";
Database altered.
SQL> select * from global_name;
GLOBAL_NAME
----------------------------------
TESTDB.WORLD
4. Connect to PDB and restart
This is can be done node by node to take advantage of RAC high availability. One node with domain and other one without domain. so the application can still be running during this change.
SQL> select * from global_name;
GLOBAL_NAME
----------------------------------
PDB1
SQL> alter session set container=PDB1;
Session altered.
SQL> alter pluggable database PDB1 close;
Pluggable database altered.
SQL> alter pluggable database PDB1 open;
Pluggable database altered.
-- Check global_name for PDB
SQL> select * from global_name;
GLOBAL_NAME
----------------------------------
PDB1.WORLD
Finally recreate all the necessary database links.
Interesting Case
After changing CDB global_name to “TESTDB.WORLD”, the PDB global_name ( PDB1) is not changed after database bounced. “Invalid Username/Password” errors occur when using user created services attached to PDB.
After trying to change CDB global_name to “TESTDB” without domain name, bounced the database, then CDB global_Name is still “TESTDB.WORLD”. The more interesting thing happed. PDB global_name changed to “PDB1.WORLD” strangly.
Just record those for future reference.