Use the nid command to modify the Database name and dbid

Source: Internet
Author: User

It is inevitable that dbname and dbid need to be modified during work, such as restoring the database to the same machine. However, dbname and dbid are one of the important symbols used to identify the database, especially dbid, which is unique. Therefore, the modification should be handled with caution. This document describes how to modify dbname and dbid and provides an example.

1. Influence of dbid and dbname Modification

A. Modify dbid

It is equivalent to creating a new database. The difference is that the data already exists in the data file. This is determined by the uniqueness of dbid.

After the modification, all the previous backup and archive logs will be unavailable, because dbid will be detected during recovery. Because of the mismatch, all backups will be invalid.

After modification, you need to use open resetlogs to open the database. A new incarnation will be created and the sequence will be set to 1.

If the database is successfully modified and open, we recommend that you disable the database consistently, restart the database, and perform a complete backup.

B. Modify dbname

After modification, you do not need to use open resetlogs to open the database. (Note that dbname is not unique, and global name is unique ).

After modification, all the backups are archived logs still available.

After modification, You need to modify the db_name parameter in pfile/spfile and recreate the corresponding Oracle password file.

If you need to use the old control file to restore the database, you should use the pfile/spfile before modification and the password file to start the database and then restore it.

C. Modify the dbid and dbname simultaneously.

If the modification is made at the same time, it is a combination of the above two cases. After the modification, you need to open resetlogs and modify pfile/spifle, password file, and full backup database.

2. nid command

Robin @ SZDB: ~> Nid

DBNEWID: Release 10.2.0.3.0-Production on Thu Apr 24 16:34:28 2013

Copyright (c) 1982,200 5, Oracle. All rights reserved.

Keyword Description (Default)

----------------------------------------------------

TARGET Username/Password (NONE)

DBNAME New database name (NONE)

LOGFILE Output Log (NONE)

REVERT Revert failed change NO

SETNAME Set a new database name only NO

APPEND Append to output log NO

HELP Displays these messages NO

When executing the nid command, the program will verify all the data files in the current database and the header information of the control file. After the verification is successful, it will prompt whether to modify the information.

If the logfile output to the log file is used, no modification prompt is displayed.

Next, nid will use the new dbid (or dbname) to change the header of the control file one by one, data files (including read-only files and normal offline files.

After successful modification, the database is automatically closed and exited.

Note: For read-only files, normal offline files are not tested in this document. Second, we should ensure that the database is in the archive state, and the database can be normally archived and there are no data files to be recovered.

3. Modification steps

A. Full backup database. If it is a hot backup (rman or OS), ensure that all archived logs and online logs are available.

B. Delete dbconsole ([ID 863800.1] has this requirement. If dbconsole is used, follow this operation)

C. Start the database to be modified to the mount status (startup mount)

D. If you use the spfile file to start the database, back up the spfile file to pfile to modify db_name.

E. Release the nid command

Nid target = sys/password # This method only modifies dbid

Nid target =/dbname = new_dbname [setname = yes] # // indicates the sid connecting to the current environment and operating system authentication is used.

Nid target = sys/password dbname = new_dbname [setname = yes] # setname = yes only modifies the database name. If this parameter is omitted, both parameters are modified at the same time.

Nid target = sys/pwdd @ conn_string dbname = new_dbname [setname = yes] # use a connection string to connect to the remote host and modify

F. Modify db_name in the Oracle parameter file pfile (which was backed up from spfile earlier). skip this step if you only modify dbid.

G. Use the new parameter file pfile to start the file to the mount State (if dbname is modified and only dbid is used, use the original pfile or spfile to start the file)

H. open the database using open resetlogs (modify the non-dbid and open it directly)

I. Rebuild the Oralce password file of the current database and convert the pfile file to the spfile file.

J. Modify the listener Configuration values, including listener. ora and tnsnames. ora.

K. Modify the global dbname, if applicable. Alter database rename GLOBAL_NAME TO <newname>. <domain>;

L. recreate dbconsole $ emca-config dbcontrol db-repos recreate

M. Full backup database

  • 1
  • 2
  • 3
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.