Friday 27 May 2016

How to Rename a database


Today I'm going to show you, How To Rename The Database Name Orcl To Test , manually . .


Follow the procedure to Rename your database

In my Case,

OldName:       ORCL
NewName:     TEST


1.   Take a Bakup of your ControlFile, because we have to make changes in controlfile.

 SQL> Alter database backup controlfile to trace.  
 OR  
 SQL> Alter database backup controlfile to trace as ‘C:\CONTROLFILEBACKUP.SQL’;  


2. Shutdown  the database

 SQL> Shutdown immediate.  


3. Open the parameter file  ( pfile ) and change the parameter  “db_name=test “

4. Delete the existing controfiles.

5. startup your database in nomount mode using following command (using modified pfile)

 SQL> startup nomount pfile= C:\oracle\product\10.1.0\admin\orcl\pfile\init.ora._________ ';  


6. After Nomount stage, Its time to Create control file now.
Type the below statements, this creates controlfile at specified Location.

 SQL> CREATE CONTROLFILE SET DATABASE "test" RESETLOGS NOARCHIVELOG  
 MAXLOGFILES 50  
 MAXLOGMEMBERS 3  
 MAXDATAFILES 300  
 MAXINSTANCES 8  
 MAXLOGHISTORY 500  
 LOGFILE  
 GROUP 1 'C:\oracle\product\10.1.0\oradata\orcl\REDO01.LOG' SIZE 10M,  
 GROUP 2 'C:\oracle\product\10.1.0\oradata\orcl\REDO02.LOG' SIZE 10M,  
 GROUP 3 'C:\oracle\product\10.1.0\oradata\orcl\REDO03.LOG' SIZE 10M  
 -- STANDBY LOGFILE  
 DATAFILE  
 'C:\oracle\product\10.1.0\oradata\orcl\SYSTEM01.DBF',  
 'C:\oracle\product\10.1.0\oradata\orcl\SYSAUX01.DBF',  
 'C:\oracle\product\10.1.0\oradata\orcl\UNDOTBS01.DBF',  
 'C:\oracle\product\10.1.0\oradata\orcl\USERS01.DBF'  
 CHARACTER SET WE8MSWIN1252;  


7.  open your database using below command


 SQL > Alter database open resetlogs;  

8.  Check your database Name 


 SQL >Select name from v$database;  

No comments:

Post a Comment