$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 – Production
Now, I want to change only database name from DUMMYDB to DEMODB for my
standalone dev database
Follow the same steps from my last post Steps
to Rename database name and DBID
NOTE: This is tested on my Standalone Development database, for RAC please see [Doc ID 464922.1]
STEP 1 ) Shut down the database and open database in mount
SQL> select name from v$database;
NAME
---------
DUMMYDB
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
DUMMYDB OPEN
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size
2233336 bytes
Variable Size
683674632 bytes
Database Buffers
377487360 bytes
Redo Buffers
5541888 bytes
Database mounted.
SQL>
Step 2) Invoke the DBNEWID
utility (nid) specifying the new database name in DBNAME and set=YES
$ nid TARGET=/
dbname=DEMODB SETNAME=YES
DBNEWID: Release 11.2.0.2.0 - Production on Tue Sep 18 14:00:18 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database DUMMYDB (DBID=471263051)
Connected to server version 11.2.0
Control Files in database:
/opt/oracle/oradata/TESTDB/control01.ctl
/opt/oracle/app/fast_recovery_area/TESTDB/control02.ctl
Change database name of database DUMMYDB to DEMODB? (Y/[N]) => Y
Proceeding with operation
Changing database name from DUMMYDB to DEMODB
Control File
/opt/oracle/oradata/TESTDB/control01.ctl - modified
Control File
/opt/oracle/app/fast_recovery_area/TESTDB/control02.ctl - modified
Datafile
/opt/oracle/oradata/TESTDB/system01.db - wrote new name
Datafile
/opt/oracle/oradata/TESTDB/users01.db - wrote new name
Datafile
/opt/oracle/oradata/TESTDB/sysaux01.db - wrote new name
Datafile /opt/oracle/oradata/TESTDB/undotbs01.db
- wrote new name
Control File
/opt/oracle/oradata/TESTDB/control01.ctl - wrote new name
Control File
/opt/oracle/app/fast_recovery_area/TESTDB/control02.ctl - wrote new name
Instance shut down
Database name changed to DEMODB.
Modify parameter file and generate a new password file before
restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
Step 3) Make changes to pfile
and password file and opened the database with resetlogs option
$ cd $ORACLE_HOME/dbs
Edit pfile ----> initDEMODB.ora
Vi initDEMODB.ora
Change ‘dbname’
NOTE: database need not
to be open with RESTLOGS option
$ export ORACLE_SID=DEMODB
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 18 14:03:10 2012
Copyright (c) 1982, 2010, Oracle.
All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size
2233336 bytes
Variable Size
616565768 bytes
Database Buffers
444596224 bytes
Redo Buffers
5541888 bytes
Database mounted.
Database opened.
SQL> select name from v$database;
NAME
---------
DEMODB
Now, your database name has been changed :-)
See: How to Change the DBID, DBNAME Using NID Utility in version 10gR2 onwards (Doc ID 863800.1)
0 comments:
Post a Comment