How to Rename a Database in Oracle A Step by Step Guide

YouTube video

Renaming a database in Oracle may seem like a daunting task, but with the help of the NID utility, it can be a relatively simple process. In this guide, we will walk you through the steps of renaming a database in Oracle using the NID utility, from shutting down the database to modifying the necessary files. By following these steps, you’ll be able to easily rename your Oracle database without any hassle.

Step 1: Shutting Down the Database

Before we begin the renaming process, we need to shut down the database. This can be done by running the following command:
shutdown immediate;

Step 2: Starting the Database in Mount Stage

Once the database is shut down, we can start it in mount stage by running the following command:
startup mount;

Step 3: Running the NID Command

Now that the database is in mount stage, we can proceed with running the NID command to rename the database. The command syntax is as follows:
nid target=cisuser/password dbname=newdatabasename;
In this command, replace “cisuser” with your current database user, “password” with the password for that user, and “newdatabasename” with the desired name for your database.

Step 4: Modifying the Parameter File

After running the NID command, you will be prompted to confirm the database name change. Once confirmed, the database name will be changed. However, before restarting the database, we need to modify the parameter file (pfile) or server parameter file (spfile) to reflect the new database name. If you have a pfile, open it and edit the “db_name” parameter to the new database name. If you only have an spfile, you can modify the parameter directly in the spfile using the following SQL command:
alter system set db_name='newdatabasename' scope=spfile;

Step 5: Creating a New Password File

In addition to modifying the parameter file, we also need to generate a new password file for the database. This can be done by running the following command:
orapwd file=<newpasswordfile> password=<password> entries=<numberofentries>;
Replace “” with the desired name for the new password file, “” with the desired password for the database, and “” with the number of entries you wish to allow in the password file.

Step 6: Updating TNS Entries

In some cases, after running the NID command, you may encounter errors related to TNS entries. These errors can be resolved by updating the TNS entries in the host file. You can do this by editing the host file and changing the IP address associated with the database name.

Step 7: Starting the Listener

If the listener is not already running, start it using the following command:
lsnrctl start;

Step 8: Opening the Renamed Database

Once the necessary modifications have been made, you can now open the renamed database. Run the following command to open the database with the reset log option:
alter database open resetlogs;

Congratulations! You have successfully renamed your Oracle database using the NID utility. You can now verify the new database name by running the following SQL query:
select name, open_mode from v$database;

In conclusion, renaming a database in Oracle may require several steps, but with the help of the NID utility and following this step-by-step guide, you can easily rename your database without any hassle. It’s important to note that renaming a database should be done cautiously and proper backups should be in place before proceeding. We hope you found this guide informative and helpful. If you have any questions or comments, feel free to leave them below. Happy database renaming!