Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Copying a Database

Re: Copying a Database

From: Michael Sevy <michael_at_datatools.com>
Date: 1997/02/28
Message-ID: <33171591.35D7@datatools.com>#1/1

KWIATKOWSKI LARRY wrote:
>
> I want to rename a database and instance from EDUC to DEVL. Is this the
> correct procedure:
>
> 1. start the database in mount mode
> 2. rename the datafiles "/id01/EDUC/control01" "/id01/DEVL/control01"
> (rename all datafiles to the new DEVl name)
> 3. stop the instance.
> 4. change oratab from EDUC to DEVL.
> 4. copy the ofa compliant directories EDUC to DEVL.
> 5. edit the init.ora files to reflect the new controlfilenames.
> 6. start the new instance.
>
> any input will be appreciated

Larry,

I have only one suggestion, and that is the NEW instance still has the 'OLD' database name imbedded in each datafile`s header. I've attached a procedure for doing this.

Although I've done this several times, I'd welcome any suggestions or comments from the newsgroup at large on this procedure.

Regards,
Michael Sevy

To change the dbname in a database's datafile headers, you need to rebuild your database's control files with the new database name. The basic command syntax is as follows:  

        CREATE CONTROLFILE REUSE SET DATABASE "NEW" RESETLOGS <log mode>
                <optional parameters>
        LOGFILE
                <list each redo log group and its members>
        DATAFILE
                <list each datafile and size>
        ;
 

With databases that have a large number of redo logs and datafiles, it might be easier (and less error prone) to let Oracle create a "CREATE CONTROLFILE ..." script file and edit the file. Steps for doing this are outlined in the following paragraphs.  

From within Server Manager, issue the following command:  

        alter database backup controlfile to trace;  

This will generate a trace file in the 'user_dump_dest' directory. The trace file is named according to instance, ora_ and process ID. For example:  

        NEW_ora_4563.trc  

If you have other files in this directory, view the long listing (ls -l) to determine the most recent trace file created. Edit the file to elimiate comments and to change incorrect key words. The following example shows the CREATE CONTROLFILE command as generated by Oracle and the edited version. All comments have been removed. Only the necessary commands remain. This is from a database that was running in ARCHIVELOG mode.  

CREATE CONTROLFILE REUSE DATABASE "OLD" NORESETLOGS ARCHIVELOG     MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 8
    MAXLOGHISTORY 800
LOGFILE

  GROUP 1 '/oracle/oradata/NEW/redo01.log'  SIZE 100K,
  GROUP 2 '/oracle/oradata/NEW/redo02.log'  SIZE 100K,
  GROUP 3 '/oracle/oradata/NEW/redo03.log'  SIZE 100K
DATAFILE
  '/oracle/oradata/NEW/system01.dbf' SIZE 5M,
  '/oracle/oradata/NEW/rbs01.dbf' SIZE 2M,
  '/oracle/oradata/NEW/temp01.dbf' SIZE 50K,
  '/oracle/oradata/NEW/users01.dbf' SIZE 550K,
  '/oracle/oradata/NEW/tools01.dbf' SIZE 250K
;  

CREATE CONTROLFILE REUSE SET DATABASE "NEW" RESETLOGS ARCHIVELOG     MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 8
    MAXLOGHISTORY 800
LOGFILE

  GROUP 1 '/oracle/oradata/NEW/redo01.log'  SIZE 100K,
  GROUP 2 '/oracle/oradata/NEW/redo02.log'  SIZE 100K,
  GROUP 3 '/oracle/oradata/NEW/redo03.log'  SIZE 100K
DATAFILE
  '/oracle/oradata/NEW/system01.dbf' SIZE 5M,
  '/oracle/oradata/NEW/rbs01.dbf' SIZE 2M,
  '/oracle/oradata/NEW/temp01.dbf' SIZE 50K,
  '/oracle/oradata/NEW/users01.dbf' SIZE 550K,
  '/oracle/oradata/NEW/tools01.dbf' SIZE 250K
;    

Once you have edited/create a script file, shutdown your database. Restart the instance, but do not mount the instance (i.e. STARTUP NOMOUNT). Run your script from within Server Manager to create the new control file(s). Now open your newly renamed database with reset logs:  

        alter database open resetlogs; Received on Fri Feb 28 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US