Thursday, November 11, 2010

Change Database DBID With DBNEWID Utility

To change the DBID for your database you need to use DBNEWID Utility

Steps:

1: Check the DBID and name of the database

SQL> select name,dbid from v$database;

NAME DBID
--------- ----------
TEST 2031038817

2: Shutdown the instance and then Startup in mount mode

SQL> shutdown immediate

SQL> startup mount

3: Run DBNEWID Utility to change the DBID

D:\>nid TARGET=SYS/syspassword@TEST

DBNEWID: Release 10.2.0.3
(c) Copyright 2002 Oracle Corporation. All rights reserved.
Connected to database TEST (DBID= 2031038817)

Control Files in database:
D:\oracle\product\10.2.0\oradata\test\CONTROL01.CTL
D:\oracle\product\10.2.0\oradata\test\CONTROL02.CTL
D:\oracle\product\10.2.0\oradata\test\CONTROL03.CTL

Change database id of database TEST? (Y/[N]) => y
Proceeding with operation

Control file D:\oracle\product\10.2.0\oradata\test\CONTROL01.CTL - dbid changed
Control file D:\oracle\product\10.2.0\oradata\test\CONTROL02.CTL - dbid changed
Control file D:\oracle\product\10.2.0\oradata\test\CONTROL03.CTL - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\EXAMPLE01.DBF - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\REDO01.LOG - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\REDO02.LOG - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\REDO03.LOG - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\SYSAUX01.DBF - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\SYSTEM01.DBF - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\TEMP01.DBF - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\UNDOTBS01.DBF - dbid changed
Datafile D:\oracle\product\10.2.0\oradata\test\USERS01.DBF - dbid changed
Instance shutdown

New DBID for database TEST is 2032942459.
All previous backups and archived redo logs for this database are unusable
Proceed to shutdown database and open with RESETLOGS option.
DBNEWID completed successfully.



4: Startup mount the database

SQL> startup mount

5: open database with resetlogs option

SQL> alter database open resetlogs;

6: Now check the DBID and name of the database after the change

SQL> select name,dbid from v$database;

NAME DBID
--------- ----------
TEST 2032942459

No comments: