Custom Search . . .

Sunday, May 13, 2007

Change DB Name

First of all you can mount point your database, using windows ORACLE_SID and Linux or UNIX ORAENV command.

SQL> SELECT NAME FROM V$DATABASE;

NAME
---------
TAJ


SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 281018368 bytes
Fixed Size 1248528 bytes
Variable Size 109052656 bytes
Database Buffers 163577856 bytes
Redo Buffers 7139328 bytes
Database mounted.
SQL>

NID: it’s a naming utility; you can able to change your database name and database id.

C:\>nid help=y

DBNEWID: Release 10.2.0.1.0 - Production on Mon May 14 10:48:33 2007

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

Keyword Description (Default)

----------------------------------------------------

TARGET Username/Password (NONE)

DBNAME New database name (NONE)

LOGFILE Output Log (NONE)

REVERT Revert failed change NO

SETNAME Set a new database name only NO

APPEND Append to output log NO

HELP Displays these messages NO

Here, I have change my database name using NID utility.

My previous database name “TAJ” my target (new) database name is “BABU


C:\>NID TARGET=SYS/BABU@LAMP DBNAME=BABU SETNAME=Y

DBNEWID: Release 10.2.0.1.0 - Production on Mon May 14 10:37:36 2007

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

Connected to database TAJ (DBID=1565772587)

Connected to server version 10.2.0

Control Files in database:
F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL01.CTL
F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL02.CTL
F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL03.CTL

Change database name of database TAJ to BABU? (Y/[N]) => Y

Proceeding with operation
Changing database name from TAJ to BABU
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL01.CTL - modified
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL02.CTL - modified
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL03.CTL - modified
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\SYSTEM01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\UNDOTBS01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\SYSAUX01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\USERS01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\EXAMPLE01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\RMAN01.DBF - wrote new name
Datafile F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\TEMP01.DBF - wrote new name
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL01.CTL - wrote new name
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL02.CTL - wrote new name
Control File F:\ORACLE\PRODUCT\10.2.0\ORADATA\LAMP\CONTROL03.CTL - wrote new name
Instance shut down

Database name changed to BABU.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.

C:\>SET ORACLE_SID=LAMP

C:\>SQLPLUS /NOLOG

SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 14 10:39:40 2007

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

SQL> CONNECT SYS AS SYSDBA
Enter password:
Connected to an idle instance.

Note : Please edit your database name in init.ora file.

SQL> CREATE PFILE FROM SPFILE;

File created.

Note: Once create pfile, Please check your DB_NAME in init.ora file. If not set database name manually edit your database name.


SQL> CREATE PFILE FROM SPFILE;

File created.

SQL> CREATE SPFILE FROM PFILE;

File created.

SQL> HOST
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

Once create your pfile and spfile, immediately need to create password file.


C:\>orapwd file=F:\oracle\product\10.2.0\db_1\database\pwdbabu.ora entries=5 password=oracle force=y

C:\>exit

SQL> startup
ORACLE instance started.

Total System Global Area 281018368 bytes
Fixed Size 1248528 bytes
Variable Size 109052656 bytes
Database Buffers 163577856 bytes
Redo Buffers 7139328 bytes
Database mounted.
Database opened.


SQL> SELECT NAME FROM V$DATABASE;

NAME
---------
BABU

SQL> SELECT INSTANCE_NAME FROM V$INSTANCE;

INSTANCE_NAME

----------------


lamp

Thanks & Regards

Babu B



No comments: