Re: Changing the name of a Database

From: Steve Butler <sbut-is_at_seatimes.com>
Date: 1995/12/26
Message-ID: <Pine.SUN.3.91.951226130125.28190C-100000_at_seatimes>#1/1


On 21 Dec 1995, Mike Wilde wrote:

> I have a requirement to create a copy of a database on the same machine. The
> only way I can think of doing this at the moment is to export the current
> database, precreate the new one with a different name, and import into that.

I have always used the cp while the database is shut down to copy the physical files to their new locations (leaving the originals in their current location). I presume that you are doing cold backups and can stand the time to have the database shut down to do the following:

  1. With the database shut down, copy ALL the database files (redo, system, tabblespace datafiles, etc) EXCEPT THE CONTROL FILES to the new location.
  2. Be sure the control files are NOT in the new location.
  3. Startup the original database.
  4. Connect as internal with SQLDBA and do this command:

    ALTER DATABASE BACKUP CONTROLFILE TO TRACE; 5. Locate the trace file in your user dump area. Edit it to change

    the path (location) on all the datafiles. Also change the database     name and use the SET option on the CREATE CONTROLFILE statement.     Your script should be similar to mine which is:

STARTUP NOMOUNT
CREATE CONTROLFILE set DATABASE TST RESETLOGS noARCHIVELOG

    MAXLOGFILES 6
    MAXLOGMEMBERS 4
    MAXDATAFILES 30
    MAXINSTANCES 1
    MAXLOGHISTORY 100
LOGFILE
  GROUP 1 (
    '/u01/ORACLE/tst/redo01.log',
    '/u02/ORACLE/tst/redo01.log'
  ) SIZE 10M,
  GROUP 2 (
    '/u01/ORACLE/tst/redo02.log',
    '/u02/ORACLE/tst/redo02.log'
  ) SIZE 10M,
  GROUP 3 (
    '/u01/ORACLE/tst/redo03.log',
    '/u02/ORACLE/tst/redo03.log'
  ) SIZE 10M,
  GROUP 4 (
    '/u01/ORACLE/tst/redo04.log',
    '/u02/ORACLE/tst/redo04.log'
  ) SIZE 10M
DATAFILE
'/u01/ORACLE/tst/system01.dbf' SIZE 25M,
'/u02/ORACLE/tst/rbs01.dbf' SIZE 50M,
'/u01/ORACLE/tst/temp01.dbf' SIZE 100M,
'/u04/ORACLE/tst/tools01.dbf' SIZE 15M,
'/u01/ORACLE/tst/users01.dbf' SIZE 25M,
'/u04/ORACLE/tst/addrs01.dbf' SIZE 100M,
'/u02/ORACLE/tst/addrs_idx01.dbf' SIZE 100M,
'/u01/ORACLE/tst/accts01.dbf' SIZE 450M,
'/u03/ORACLE/tst/accts_idx01.dbf' SIZE 250M
;
ALTER DATABASE OPEN RESETLOGS; 6. Change your SID to the new value you want.

7. Be sure that the initSID.ora file is named correctly and accessable.

8. Use SQLDBA, connect as internal, run this script.

9. Shutdown and get yourself a backup.

This is also a great way to move the entire database (although you will want to do the ALTER DATABASE BACKUP CONTROLFILE TO TRACE before the initial shutdown and copy!!

--Steve

+----------------------------------------------------+
| Steve Butler          Voice:  206-464-2998         |
| The Seattle Times       Fax:  206-382-8898         |
| PO Box 70          Internet:  sbut-is_at_seatimes.com |
| Seattle, WA 98111    Packet:  KG7JE_at_N6EQZ.WA       |
+----------------------------------------------------+
All standard and non-standard disclaimers apply. All other sources are annonymous. Received on Tue Dec 26 1995 - 00:00:00 CET

Original text of this message