Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
We have to change dbname in the parameter file, in case you are using spfile, create pfile so
that you will be able to change dbname after invoking nid
SQL> SHOW PARAMETER PFILE;
SQL> CREATE PFILE = '/tmp/pfile' FROM SPFILE;
STEP 3:
Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using
a user with SYSDBA privilege:
$ which nid
$ nid target=SYS/PASSWORD dbname=new_name setname=YES logfile=new_name.log
$ nid target=SYS/PASSWORD dbname=TZDR setname=YES logfile=TZDR.log
Assuming the validation is successful the utility prompts for confirmation before performing the
actions.
Change database ID and database name TZDB to TZDR? (Y/[N]) => Y
If operation is failed, to revert changes, run the DBNEWID utility again, specifying the REVERT
keyword.
$ nid TARGET=SYS/PASSWORD REVERT=YES LOGFILE=revert.log
STEP 4:
NOTE:
Invoke the DBNEWID utility (nid) from the command line using a user with SYSDBA privilege,
do not specify DBNAME:
$ which nid
$ nid TARGET=SYS/password
$ nid TARGET=dbname
Assuming the validation is successful the utility prompts for confirmation before performing the
actions. Typical output may look something like:
Change database ID and database name TZDB to TZUAT? (Y/[N]) => Y
If operation is failed, to revert changes, run the DBNEWID utility again, specifying the REVERT
keyword.
$ nid TARGET=SYS/PASSWORD REVERT=YES LOGFILE=backout.log
If operation is successful, mount the database and open with resetlogs.
STEP 6: Open the database with RESETLOGS:
SQL> STARTUP MOUNT
SQL> ALTER DATABASE OPEN RESETLOGS;
STEP 7:
Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using
a user with SYSDBA privilege:
$ nid TARGET=SYS/PASSWORD DBNAME=new_name LOGFILE=change_dbname.log
This utility wont change the database name in pfile, so change the database name (DB_NAME) in
pfile manually and create password file (if necessary).
STEP 4:
$ vi /tmp/ctrl.sql'
After a quick modify on the first line of controlfile script into the /tmp/ctrl.sql file,
We can create new controlfiles with new database name on the TZDR database.
In addition, we need to add SET command before DATABASE when changing DB_NAME.
For examle;
This is the first line of script:
CREATE CONTROLFILE REUSE DATABASE TZDB NORESETLOGS FORCE LOGGING ARCHIVELOG
After, running this new ctrl.sql file with nomount state, new controlfiles are created for TZDR
database and TZDR database is automatically changed to mount state. Then, you have to open
TZDR database with resetlogs option in order to recreate redolog files for new database.
SQL> STARTUP MOUNT
$ cd /u01/app/oracle/oradata/TZDB/
$ rm *.clt
$ cd /u01/app/oracle/fast_recovery_area/TZDB
$ rm *.clt
---Execute created control file
SQL> @/tmp/ctl.sql
SQL> ALTER DATABASE OPEN RESETLOGS;
SQL> SELECT NAME, DBID, INSTANCE_NAME FROM V$DATABASE;