Thursday, August 26, 2010

RENAME DATABASE AND INSTACE




RENAME DATABASE AND INSTACE



Let suppose  your db name is TEST and wanna change your db to NEWTEST

C:\> set ORACLE_SID=TEST

C:\> sqlplus  sys/sys as sysdba

SQL>select name from v$database;

Name
----------
TEST

SQL>alter database backup controlfile to trace as 'c:\c.txt' reuse;

SQL> shutdown immediate;

copy and past your old controlfile to another loction and edit your INITTEST.ora in this change your  "db_name=NEWTEST"

SQL>startup nomount pfile='D:\oracle\product\10.2.0\db_1\database\inittest.ora'

(the path where you save your pfile )

now create the new control file ..........

SQL>alter database open resetlogs;

SQL>select name from v$database;

Name
----------
NEWTEST


****this will change only your db name not instance name 







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


TO CHANGE  INSTANCE  INSTANCE NAME 


SQL> show parameter db_name;

NAME                                 TYPE        VALUE
------------------------ ----------- ---------------------------
db_name                              string           newtest


SQL>show parameter instance_name;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ---------------
instance_name                        string      test 

if we are using spfile  we need to do ........

SQL> alter system reset instance_name scope= spfile sid ='*";

SQL> startup force ; 

BUT If we are using PFILE then....

In this case:
 remove instance_name parameter from PFILE

 shutdown/restart instance 

c:\> set ORACLE_SID=NEWTEST

if instance is  running in LINUX then every thing is done .
But in windows we need to crate through ORADIM

for ORADIM

create new instance -

c:\>E:\oracle\product\10.2.0\db_1\bin\oradim -new -sid NEWTEST -SRVC OracleServiceNEWTEST 
    -STARTMODE auto -SRVCSTART system -PFILE
                 e:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INITTEST.ORA
         

 "    e:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\INITTEST.ORA"  this is the path where your pfile is saved.

    This will create a new instance .

Now delete your old instance 
c:\>E:\oracle\product\10.2.0\db_1\bin\oradim -DELETE -SID TEST

Until you did not delete your old instance  you always got error so first delete your old instance and then check your db name and instance name ...




any mistake is there or u wanna give any suggestion so please write to me ............



No comments:

Post a Comment