Friday, 14 January 2022

Changing database name and/or database id using NID

 Changing database name and/or database id using NID

 

Oracle NID utility

NID is utility to change the database name and/or database id.

Steps:

1) Backup the database
2) shutdown the database
3) startup mount, the database

4) Here you use the NID utility, through command execute the following

 nid target=sys/<password>@<old_database> dbname=<new_database_name>

For example 
For change local database philips to samsung do the following

set oracle_sid=philips
nid target=sys/oracle123$ dbname=samsung

After these modification will be made to control file and datafile

NOTE: If you use setname=y at end of command then it will change the db name only DBID will remain the same.

Now shut the database
SQL>shut immediate

Now we need to change the db_name in the pfile or spfile
modify the pfile and start the database, if using spfile mount the database
and issue


SQL>alter system set db_name=samsung scope=spfile;
SQL>shut immediate

If required modify the service id (in windows)
then open the database with resetlogs

SQL>alter database open resetlogs;


====@@@====

Note:If it is in windows

delete existing services,and recreate service with new name.

oradim -delete -sid  DB_NAME

If it is in unix   change the name in crontab.

change the name of pfile and   file location if your standard format need to be updated.
1)In Pfile Edit dbname,and control file location

2)Copy the control files into new location from old location.

-->startup mount pfile='<name>'

-->shutdown immediate;

-->move all datafile and redo log files into new location;

-->startup mount pfile='<name>'

-->change all datafile location in DB level.

alter database rename file '<old file name location>' to '<new file location>';

-->alter database open;

-->create spfile from pfile='<>'

-->start database with spfile.


Change service name in TNS entry as well.

No comments:

Post a Comment

Changing database name and/or database id using NID

  Changing database name and/or database id using NID   Oracle NID utility NID is utility to change the database name and/or database id. St...