Change the DB_UNIQUE_NAME for a RAC Database
When a database is originally created with the Global Database Name <database>
, its db_name
and db_unique_name
are the same. The CRS (Cluster Ready Services) database resource is named as ora.<database>.db
. Changing the db_unique_name
involves a complete database restart and requires careful coordination of steps.
Step 1: Remove the Database, Instance, and Service Resources from CRS
$ srvctl stop database -d <database>
$ srvctl remove database -d <database>
Step 2: Start the Database and Change the DB_UNIQUE_NAME
Start the database:
SQL> STARTUP;
Change the db_unique_name
and, if required, update the db_domain
:
SQL> ALTER SYSTEM SET db_unique_name=<database>_test SCOPE=SPFILE SID='*';
SQL> ALTER SYSTEM SET db_domain=<domain> SCOPE=SPFILE SID='*';
Rename the Global Database Name:
SQL> ALTER DATABASE RENAME GLOBAL_NAME TO <database>_test.<domain>;
Step 3: Add the Database Resource to the Cluster
Add the database resource:
$ srvctl add database -d _test -n -o
Add the instances:
$ srvctl add instance -d <database>_test -i <instance1> -n <node1>
$ srvctl add instance -d <database>_test -i <instance2> -n <node2>
Step 4: Create Dependencies Between Database and ASM
Ensure the database starts only after the ASM instance is running.
$ srvctl modify database -d <db_unique_name> -a "<diskgroup_list>"
Step 5: Add Database Services
Create database services with both instances as preferred.
$ srvctl add service -d <database>_test -s <service> -r "<instance1>,<instance2>"
Ensure you have adequate downtime for the process as it involves restarting the database.
Validate all changes thoroughly to ensure smooth functioning of the RAC environment after the change.
No Comments