Thursday, June 5, 2008

DBNEWID(nid) utility

changing only dbname(without dbid):-

1) startup your database in mount state:-
SQL> startup mount;

2) use nid utility to change database name:-
$nid target="sys as sysdba" dbname=new_db_name logfile=logfile_name.log
setname=yes
password:****** (sys password)
(or)
$nid target="sys/sys_password" dbname=new_db_name logfile=logfile_name.log
setname=yes

3) verify the logfile:-
$vi logfile_name.log

4) shutdown & copy spfile to pfile in sql prompt:-
SQL>shutdown;
SQL>create pfile from spfile;

5) go to the dbs directory & remove the password file and recreate it
(because it will become invalid):-
$rm orapwSID
$orapwd file=orapwSID password=new_password

6) in that dbs directory change the pfile with new database name:-
$vi initSID.ora
db_name=new_dbname

wq!

7) startup your database normal:-
SQL>startup;

8) verify the db_name parameter:-
SQL>show parameter db_name
_________________________________________________________________________________________________
changing database name (with dbid):-


1) startup your database in mount state:-
SQL> startup mount;

2) use nid utility to change database name:-
$nid target="sys as sysdba" dbname=new_db_name logfile=logfile_name.log
setname=no
password:****** (sys password)
(or)
$nid target="sys/sys_password" dbname=new_db_name logfile=logfile_name.log
setname=no

3) verify the logfile:-
$vi logfile_name.log

4) shutdown & copy spfile to pfile in sql prompt:-
SQL>shutdown;
SQL>create pfile from spfile;

5) go to the dbs directory & remove the password file and recreate it
(because it will become invalid):-
$rm orapwSID
$orapwd file=orapwSID password=new_password

6) in that dbs directory change the pfile with new database name:-
$vi initSID.ora
db_name=new_dbname

wq!

7) startup your database normal:-
SQL>startup;

8) verify the db_name parameter:-
SQL>show parameter db_name