DBNEWID is a database utility that can change the internal database identifier (DBID) and the database name (DBNAME) for an operational database.
The DBID is an internal, unique identifier for a database. Because Recovery Manager (RMAN) distinguishes databases by DBID
Now I want to change the DBID and DB Name of my database.
Please note: If you want to change only the DBID then don't give the parameter dbname in nid command --> it will only change the dbid for you.
SQL> select dbid, name from v$database;
DBID NAME
---------- ---------
4110800738 ORCL10
I will change my Name of the database to --> PROD
Please follow the below steps to change the name and dbid of the database...
1. Identify the DBID and name of the database
SQL> select dbid, name from v$database;
DBID NAME
---------- ---------
4110800738 ORCL10
2. Shutdown the database in normal mode
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
3. Start the database to mount phase
Please Note: We can issue the command (nid ) during the mount phase of the database.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1375792 bytes
Variable Size 671089104 bytes
Database Buffers 394264576 bytes
Redo Buffers 4603904 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 -
Production With the Partitioning, OLAP, Data Mining and Real Application Testing options.
4. In the Terminal Window, execute the nid command
oracle@dekhatai009 ~
$ which nid
/cygdrive/c/app/dr/product/11.2.0/dbhome_6/bin/nid
You can use either one of the below commands
oracle@dekhatai009 ~
$ nid target=/
or
oracle@dekhatai009 ~
$ nid target=sys/manager dbname=PROD <<changing name from ORCL10 to PROD>>
DBNEWID: Release 11.2.0.1.0 - Production on Tue Feb 2 15:21:05 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database ORCL10 (DBID=4110800738)
Connected to server version 11.2.0
Control Files in database:
C:\APP\IBM\ORADATA\ORCL10\CONTROL01.CTL
C:\APP\IBM\FLASH_RECOVERY_AREA\ORCL10\CONTROL02.CTL
Change database ID and database name ORCL10 to PROD? (Y/[N]) => Y <<click Y>>
Proceeding with operation
Changing database ID from 4110800738 to 314608993
Changing database name from ORCL10 to PROD
Control File C:\APP\DR\ORADATA\ORCL10\CONTROL01.CTL - modified
Control File C:\APP\DR\FLASH_RECOVERY_AREA\ORCL10\CONTROL02.CTL - modified
Datafile C:\APP\DR\ORADATA\ORCL10\SYSTEM01.DB - dbid changed, wrote new name
Datafile C:\APP\DR\ORADATA\ORCL10\SYSAUX01.DB - dbid changed, wrote new name
Datafile C:\APP\DR\ORADATA\ORCL10\UNDOTBS01.DB - dbid changed, wrote new name
Datafile C:\APP\DR\ORADATA\ORCL10\USERS01.DB - dbid changed, wrote new name
Datafile C:\APP\DR\ORADATA\ORCL10\EXAMPLE01.DB - dbid changed, wrote new name
Datafile C:\APP\DR\ORADATA\ORCL10\TEMP01.DB - dbid changed, wrote new name
Control File C:\APP\DR\ORADATA\ORCL10\CONTROL01.CTL - dbid changed, wrote new name
Control File C:\APP\DR\FLASH_RECOVERY_AREA\ORCL10\CONTROL02.CTL - dbid changed, wrote new name
Instance shut down
Database name changed to PROD.
Modify parameter file and generate a new password file before restarting.
Database ID for database PROD changed to 314608993.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
after that startup database in nomount mode an change db_name parameter after that you can start database with resetlogs option;
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1375792 bytes
Variable Size 671089104 bytes
Database Buffers 394264576 bytes
Redo Buffers 4603904 bytes
---- Database name should be change in parameter file as well----
SQL> alter system set db_name=PROD scope=spfile;
System altered.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1071333376 bytes
Fixed Size 1375792 bytes
Variable Size 671089104 bytes
Database Buffers 394264576 bytes
Redo Buffers 4603904 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
Now check the DBID and database name
SQL> select dbid, name from v$database;
DBID NAME
---------- ---------
314608993 PROD
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
Success !!
Please refer
https://dbacatalog.wordpress.com/2013/11/14/how-to-change-dbname-and-dbid-in-oracle-database/
https://naveenkumarsr.wordpress.com/2011/03/25/change-oracle-dbid/
No comments:
Post a Comment