Re: Changing the name of a Database

From: Gary Eckhardt <dcigary_at_tcp.co.uk>
Date: 1995/12/26
Message-ID: <4bp6ia$jab_at_nimitz.fibr.net>#1/1


Mike Wilde (mwilde) wrote:
: Is there a way of changing the database name, so that I can do an os restore : then bring the database up with a different name?

Mark:

 Here's a method that I use to COPY a database to another name, but you should be able to use some of the procedure to simply rename an instance, namely the create controlfile command.

  1. Locate these files for the instance you are copying FROM.
    • Control Files To find all the control files associated with an instance, look in the CONFIG.ORA file for the instance you are copying from. Be sure you get all the control files.
      • Redo Log Files To find all the redo log files associated with an instance, issue the following command from a DBA account:

                SELECT MEMBER FROM V$LOGFILE;

		In addition, determine the size and the logfile grouping
		of all the redo log files.


- Data Files
To find all the data files associated with an instance, issue the following command from a DBA account: SELECT FILE_NAME, BYTES FROM SYS.DBA_DATA_FILES;
- Database Startup Files, etc
Locate the CONFIG.ORA, INIT.ORA for the database you are copying FROM. You will need to modify these files for file locations, database name, etc.

2) Determine the following parameters from the database you are copying

   FROM. (If you have the original create database script for the FROM    database, this information will be there)

  • maxdatafiles
  • maxlogfiles
  • maxlogmembers
  • maxinstances
  • archivelog or noarchivelog 3) Shut down the database you are copying FROM 4) Copy the files that were determined in step 1 to their new locations and record where they are. 5) Remove all the new control files that were copied over. They will be replaced by the CREATE CONTROLFILE command below. 6) Start up, but do not mount or open the new database. (Make sure your ORACLE_SID environment variable is set correctly)
		$ sqldba mode=line
		SQLDBA> STARTUP NOMOUNT;
 

7) Issue the following command to create a new control file for your

   new database. Specify the paths of the NEW database files and the    data sizes.

CREATE CONTROLFILE
   SET DATABASE <your_new_database_name_here>

   LOGFILE GROUP 1 (<logfile a group 1>,
                    <logfile b group 1>) SIZE xM,
           GROUP 2 (<logfile a group 2>,
                    <logfile b group 2>) SIZE xM,
               ..............................
               ..............................
               ..............................
           GROUP n (<logfile a group n>,
                    <logfile b group n>) SIZE xM
   RESETLOGS
   DATAFILE <datafile 1> SIZE xM,
             <datafile 2> SIZE xM,
              ................................
              ................................
              ................................
             <datafile n> SIZE xM

   MAXDATAFILES xxx
   MAXLOGFILES xxx
   MAXLOGMEMBERS xxx
   MAXINSTANCES xxx
   NOARCHIVELOG;
	The CREATE CONTROLFILE command will create new control files
	in all the locations specified in your CONFIG.ORA.

8) Open the database:

                ALTER DATABASE OPEN RESETLOGS; 9) Check the ALERT.LOG file for any errors or files you may have missed.

---------------------------+----------------------------------------------
Gary Eckhardt              |   "in this day & age...music performed by
Database Consultants, Inc. |    humans...hum!?"  --wilde silas tomkyn
dcigary_at_txdirect.net       |  
gary_eckhardt_at_realworld.com| R^3 = "Real World.  Real Smart.  Real Quick."
(210)344-6566              |         http://www.realworld.com/
Received on Tue Dec 26 1995 - 00:00:00 CET

Original text of this message