Solution
$ export CV_ASSUME_DISTID=OEL7.6
$ export CV_ASSUME_DISTID=OEL7.6
One of our RAC database has a private thread for some reason by a DBA playing around.
SQL> select thread#, enabled from v$thread;
THREAD# ENABLED
---------- --------
1 PUBLIC
2 PUBLIC
3 PRIVATE
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.
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.
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.
SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 338 Current log sequence 340
SQL> select log_mode,name from v$database; LOG_MODE NAME NOARCHIVELOG TESTDB
$ srvctl stop database -d TESTDB
$ srvctl start database -d TESTDB -o mount
SQL> alter database archivelog; Database altered.
SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST' sid='*' scope=both;
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 339 Next log sequence to archive 341 Current log sequence 341
$ srvctl stop database -d TESTDB
$ srvctl start database -d TESTDB
ASMCMD> cd +DATAC1/TESTDB/PARAMETERFILE
ASMCMD> ls -lt
Type Redund Striped Time Sys Name
PARAMETERFILE HIGH COARSE APR 25 23:00:00 Y spfile.921.1133441623
ASMCMD> pwd
+DATAC1/TESTDB/PARAMETERFILE
ASMCMD> ls spfile.921.1133441623
spfile.921.1133441623
ASMCMD> cp spfile.921.1133441623 /tmp/testdb_spfile.921.1133441623
copying +DATAC1/TESTDB/PARAMETERFILE/spfile.921.1133441623 -> /tmp/testdb_spfile.921.1133441623
ASMCMD> ls spfile.921.1133441623
spfile.921.1133441623
ASMCMD> exit
$ls -ltr /tmp/testdb_spfile.921.1133441623
-rw-r—–. 1 grid oinstall 6656 Apr 26 10:11 /tmp/testdb_spfile.921.1133441623
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 – Production on Wed Apr 26 10:12:40 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production
Version 19.18.0.0.0
SQL> create pfile=’/tmp/initTESTDB.ora’ from spfile=’/tmp/testdb_spfile.921.1133441623′;
File created.
SQL> ! ls -ltr /tmp/initTESTDB.ora
-rw-r–r–. 1 grid oinstall 2564 Apr 26 10:13 /tmp/initTESTDB.ora
SQL> ! cat /tmp/initTESTDB.ora