change oracle database name using nid

First of all start your database in mount state . Here I am changing the database name from orcl to orcl4. Then perform below steps :-

[oracle@host01 dbs]$ sqlplus sys/sys as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 7 12:09:36 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
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

[oracle@host01 dbs]$ nid target=sys/sys DBNAME=orcl4

DBNEWID: Release 11.2.0.1.0 - Production on Fri Mar 7 12:14:08 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to database ORCL (DBID=1305795399)

Connected to server version 11.2.0

Control Files in database:
    /u01/app/oracle/oradata/orcl/control01.ctl
    /u01/app/oracle/flash_recovery_area/orcl/control02.ctl

Change database ID and database name ORCL to ORCL4? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1305795399 to 766881041
Changing database name from ORCL to ORCL4
    Control File /u01/app/oracle/oradata/orcl/control01.ctl - modified
    Control File /u01/app/oracle/flash_recovery_area/orcl/control02.ctl - modified
    Datafile /u01/app/oracle/oradata/orcl/system01.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/sysaux01.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/undotbs01.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/users01.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/example01.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/tracetbs.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/tracetbs3.db - dbid changed, wrote new name
    Datafile /u01/app/oracle/oradata/orcl/temp01.db - dbid changed, wrote new name
    Control File /u01/app/oracle/oradata/orcl/control01.ctl - dbid changed, wrote new name
    Control File /u01/app/oracle/flash_recovery_area/orcl/control02.ctl - dbid changed, wrote new name
    Instance shut down

Database name changed to ORCL4.
Modify parameter file and generate a new password file before restarting.
Database ID for database ORCL4 changed to 766881041.
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.

[oracle@host01 dbs]$ ls -slhrt
total 36K
4.0K -rw-r--r-- 1 oracle oinstall 2.8K May 15  2009 init.ora
4.0K drwx------ 2 oracle oinstall 4.0K Mar 15  2012 peshm_DBUA0_0
4.0K -rw-rw---- 1 oracle oinstall 1.6K Mar 15  2012 hc_DBUA0.dat
4.0K drwx------ 2 oracle oinstall 4.0K Mar 15  2012 peshm_orcl_0
4.0K -rw-rw---- 1 oracle oinstall 1.6K Mar 15  2012 hc_orcl.dat
4.0K -rw-r----- 1 oracle oinstall   24 Mar 15  2012 lkORCL
4.0K -rw-r----- 1 oracle oinstall 2.0K Mar  2 17:17 orapworcl
4.0K -rw-r----- 1 oracle oinstall 2.5K Mar  7 12:05 spfileorcl.ora
4.0K -rw-r----- 1 oracle oinstall  947 Mar  7 12:06 initorcl.ora
[oracle@host01 dbs]$ rm -f orapworcl
[oracle@host01 dbs]$ cp initorcl.ora initorcl4.ora
[oracle@host01 dbs]$ rm -f spfileorcl.ora
[oracle@host01 dbs]$ vi initorcl4.ora ( Here change the dbname in pfile)
[oracle@host01 dbs]$ orapwd file=orapworcl4 entries=4 password=sys(create new password file)
[oracle@host01 dbs]$ sqlplus sys/sys as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 7 12:16:28 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount pfile=initorcl4.ora
ORACLE instance started.

Total System Global Area 1062965248 bytes
Fixed Size                  1341252 bytes
Variable Size             683673788 bytes
Database Buffers          373293056 bytes
Redo Buffers                4657152 bytes
Database mounted.
SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

Alternatively , You can change the database name using alter database backup controlfile to trace command .For this step ,I will post again . 

Comments

Popular posts from this blog

Installing DBMS_JAVA package in Oracle and calling UTL_DBWS web services through Oracle database

Starting background process GTX4 and GLOBAL_TXN_PROCESSES

upgrade database oracle 10g to oracle 11g