Changing Only the Database Name

The following steps describe how to change the database name without changing the DBID.

  1. Ensure that you have a recoverable whole database backup.
  2. Ensure that the target database is mounted but not open, and that it was shut down consistently before mounting. For example:
  3. Start the utility on the command line, specifying a valid user with the SYSDBA privilege (you will be prompted for a password). You must specify both the DBNAME and SETNAME parameters. This example changes the name to test_db:

    DBNEWID performs validations in the headers of the control files (not the data files) before attempting I/O to the files. If validation is successful, then DBNEWID prompts for confirmation, changes the database name in the control files, shuts down the database and exits. The following is an example of what the output for this would look like:

    Control Files in database:
    The following datafiles are offline clean:
        /oracle/TEST_DB/data/tbs_61.dbf (23)
        /oracle/TEST_DB/data/tbs_62.dbf (24)
        /oracle/TEST_DB/data/temp3.dbf (3)
    These files must be writable by this utility.
    The following datafiles are read-only:
        /oracle/TEST_DB/data/tbs_51.dbf (15)
        /oracle/TEST_DB/data/tbs_52.dbf (16)
        /oracle/TEST_DB/data/tbs_53.dbf (22)
    These files must be writable by this utility.
    Changing database name from PROD to TEST_DB
        Control File /oracle/TEST_DB/data/cf1.dbf - modified
        Control File /oracle/TEST_DB/data/cf2.dbf - modified
        Datafile /oracle/TEST_DB/data/tbs_01.dbf - wrote new name
        Datafile /oracle/TEST_DB/data/tbs_ax1.dbf - wrote new name
        Datafile /oracle/TEST_DB/data/tbs_02.dbf - wrote new name
        Datafile /oracle/TEST_DB/data/tbs_11.dbf - wrote new name
        Datafile /oracle/TEST_DB/data/tbs_12.dbf - wrote new name
        Datafile /oracle/TEST_DB/data/temp1.dbf - wrote new name
        Control File /oracle/TEST_DB/data/cf1.dbf - wrote new name
        Control File /oracle/TEST_DB/data/cf2.dbf - wrote new name
        Instance shut down
    Database name changed to TEST_DB.
    Modify parameter file and generate a new password file before restarting.
    Successfully changed database name.
    DBNEWID - Completed successfully.

    If validation is not successful, then DBNEWID terminates and leaves the target database intact. You can open the database, fix the error, and then either resume the DBNEWID operation or continue using the database without changing the database name. (For an example of what the output looks like for an unsuccessful validation, see Step 3 in "Changing the DBID and Database Name".)

  4. Set the DB_NAME initialization parameter in the initialization parameter file (PFILE) to the new database name.


    The DBNEWID utility does not change the server parameter file (SPFILE). Therefore, if you use SPFILE to start your Oracle database, then you must re-create the initialization parameter file from the server parameter file, remove the server parameter file, change the DB_NAME in the initialization parameter file, and then re-create the server parameter file.

  5. Create a new password file.
  6. Start up the database and resume normal use. For example:

    Because you have changed only the database name, and not the database ID, it is not necessary to use the RESETLOGS option when you open the database. This means that all previous backups are still usable.