[Oracle] Change Database Name
- Red Hat Linux 7
- Oracle RAC Database 12.2
- DATABASE_UNIQUE_NAME: db_unique_name of database
- NEW_DATABASE_NAME: new db_name to assign to the database
in this tutorial we are going to see a quick way to change the db_name parameter of our database. The db_unique_name remains untouched. We suppose that there is a RAC configuration, but the same process applies to single-instance databases, except for the cluster commands to stop/start them.
First of all, take a backup copy of the server parameter file, if it used, in case of problems:
create pfile='/tmp/pfile_bck.ora' from spfile;
Then, disable the cluster:
alter system set cluster_database=false scope=spfile;
And stop the database:
srvctl stop database -d DATABASE_UNIQUE_NAME
Then, connect to one instance, bring it up in mount state and from os launch the Oracle utility to change the db_name:
startup mount nid TARGET=SYS DBNAME=NEW_DATABASE_NAME SETNAME=YES
Next, just change the db_name also in the server parameter file and revert back the cluster parameter:
alter system set db_name=NEW_DATABASE_NAME scope=spfile; alter system set cluster_database=true scope=spfile;
Lastly, just shutdown the instance and bring up the database with cluster command:
shut immediate srvctl start database -d DATABASE_UNIQUE_NAME
Optionally, Oracle suggests to recreate the password file with the passwd utility.
That’s all, see you in the next tutorial.