DBNEWID

DBNEWID

D:oracleOra92bin>nid help=yes

DBNEWID: Release 9.2.0.6.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. 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

D:oracleOra92bin>

DBNEWID is a database utility that can change the internal database identifier (DBID) and the database name (DBNAME) for an operational database.

Prior to the introduction of the DBNEWID utility, you could manually create a copy of a database and give it a new database name (DBNAME) by re-creating the control file.

However, you could not give the database a new identifier (DBID). The DBID is an internal, unique identifier for a database. Because Recovery Manager (RMAN) distinguishes databases by DBID, you could not register a seed database and a manually copied database together in the same RMAN repository.

The DBNEWID utility solves this problem by allowing you to change any of the following:

Only the DBID of a database
Only the DBNAME of a database
Both the DBNAME and DBID of a database

To perform changes the database should not be open

D:oracleOra92bin>nid target=sys/sys@sridevi dbname=sridevi
DBNEWID: Release 9.2.0.6.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

Connected to database SRIDEVI (DBID=937156271)

NID-00121: Database should not be open

Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.

D:oracleOra92bin>

D:oracleOra92bin>sqlplus "sys/sys as sysdba"

SQL*Plus: Release 9.2.0.6.0 - Production on Wed Dec 22 19:38:46 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area 126951372 bytes
Fixed Size 454604 bytes
Variable Size 109051904 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

D:oracleOra92bin>nid target=sys/sys@sridevi dbname=sridevi
DBNEWID: Release 9.2.0.6.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

Connected to database SRIDEVI (DBID=937156271)

Control Files in database:
D:ORACLEORADATASRIDEVICONTROL01.CTL
D:ORACLEORADATASRIDEVICONTROL02.CTL
D:ORACLEORADATASRIDEVICONTROL03.CTL


NID-00144: New name for database SRIDEVI is the same as current name SRIDEVI

Change of database name failed during validation - database is intact.
DBNEWID - Completed with validation errors.

D:oracleOra92bin>

What Oracle Docs say??

Parameters for the DBNEWID Utility

TARGET

Specifies the username and password used to connect to the database. The user must have the SYSDBA privilege. If you are using operating system authentication, then you can connect with the slash (/). If the $ORACLE_HOME and $ORACLE_SID variables are not set correctly in the environment, then you can specify a secure (IPC or BEQ) service to connect to the target database. A target database must be specified in all invocations of the DBNEWID utility.

REVERT

Specify YES to indicate that a failed change of DBID should be reverted (default is NO). The utility signals an error if no change DBID operation is in progress on the target database. A successfully completed change of DBID cannot be reverted. REVERT=YES is only valid when a DBID change failed.

DBNAME=new_db_name
Changes the database name of the database. You can change the DBID and the DBNAME of a database at the same time. To change only the DBNAME, also specify the SETNAME parameter.

SETNAME

Specify YES to indicate that DBNEWID should change the database name of the database but should not change the DBID (default is NO). When you specify SETNAME=YES, the utility only writes to the target database control files.

LOGFILE=logfile

Specifies that DBNEWID should write its messages to the specified file. By default the utility overwrites the previous log. If you specify a log file, then DBNEWID does not prompt for confirmation.

APPEND

Specify YES to append log output to the existing log file (default is NO).

HELP

Specify YES to print a list of the DBNEWID syntax options (default is NO).

Restrictions and Usage Notes

The DBNEWID utility has the following restrictions:

The utility is available only on the UNIX and Windows NT operating systems.
The nid executable file should be owned and run by the Oracle owner because it needs direct access to the datafiles and control files. If another user runs the utility, then set the user ID to the owner of the datafiles and control files.

The DBNEWID utility must access the datafiles of the database directly through a local connection. Although DBNEWID can accept a net service name, it cannot change the DBID of a nonlocal database.

To change the DBID of a database, the database must be mounted and must have been shut down consistently prior to mounting. In the case of an Oracle Real Application Clusters database, the database must be mounted in NOPARALLEL mode.
You must open the database with the RESETLOGS option after changing the DBID. Note that you do not have to open with the RESETLOGS option after changing only the database name.

No other process should be running against the database when DBNEWID is executing. If another session shuts down and starts the database, then DBNEWID aborts.

All online datafiles should be consistent without needing recovery.

Normal offline datafiles should be accessible and writable. If this is not the case, you must drop these files before invoking the DBNEWID utility.

All read-only tablespaces must be accessible and made writable at the operating system level prior to invoking DBNEWID. If these tablespaces cannot be made writable (for example, they are on a CD-ROM), then you must unplug the tablespaces using the transportable tablespace feature and then plug them back in the database before invoking the DBNEWID utility (see the Oracle9i Database Administrator's Guide).

You can only specify REVERT when changing only the DBID.

Examples of Using DBNEWID
Changing Only the DBID

The following example connects with operating system authentication and changes only the DBID:

% nid TARGET=/

Changing the DBID and Database Name
The following example connects as user SYS and changes the DBID and also changes the database name to test2:

% nid TARGET=SYS/oracle@test1 DBNAME=test2

Changing Only the Database Name

The following example connects as user SYSTEM and changes only the database name, and also specifies a log file for the output:
% nid TARGET=SYSTEM/manager@test2 DBNAME=test3 SETNAME=YES LOGFILE=dbid.out

 

 

Related Posts: