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: renaming a database

Re: renaming a database

From: Howard J. Rogers <howardjr_at_www.com>
Date: Wed, 10 Jan 2001 08:14:07 +1100
Message-ID: <3a5b7f1a@news.iprimus.com.au>

Your reply is close, in that the key is to change the first line of the 'create controlfile' script, so that it reads 'set' instead of 'reuse'.

Where I think you skipped over a rather nasty detail is in suggesting that you can retain the 'noresetlogs' part of that line: re-creating controlfiles requires a resetlogs, so that bit has to change as well.

Further down in the 'backup to trace' script, there's usually a line that reads 'alter database open' -that will fail, unless you change it to read 'alter database open resetlogs' (and no, I have no idea why you have to specify resetlogs in two different places!).

Some other nasties: any datafiles which are offline when you try this will be unrecoverable. Bring them all online first. And if you are in archivelog mode, by resetting your logs, you've just rendered all prior backups and all prior archives totally useless (except in exceptional, horrible and tricky circumstances)... it's therefore time to blow all those away, having first shut the newly-named database down, and performed a complete closed database backup.

Regards
HJR "Valery Yourinsky" <vsu_at_bill.mts.ru> wrote in message news:3A5B2FCB.C023A286_at_bill.mts.ru...
> Choung Chao wrote:
> > Can someone tell me how I can rename a database? Is there a way to do
 it
> > through the GUI?
>
> Hi Choung,
>
> To rename database you must recreate controlfiles.
>
> Through the GUI (DBAstudio) you can only BACKUP CONTROLFILE TO TRACE;
> Then find created trace file in your USER_DUMP_DESTINATION catalog.
> It will be sometning like this:
>
> --
> # The following commands will create a new control file and use it
> # to open the database.
> # Data used by the recovery manager will be lost. Additional logs may
> # be required for media recovery of offline data files. Use this
> # only if the current version of all online logs are available.
> #
> STARTUP NOMOUNT
> #
> CREATE CONTROLFILE REUSE DATABASE "GUAMOKO" NORESETLOGS NOARCHIVELOG
> MAXLOGFILES 32
> MAXLOGMEMBERS 2
> MAXDATAFILES 254
> MAXINSTANCES 1
> MAXLOGHISTORY 2722
> LOGFILE
> GROUP 1 'D:\ORACLE\ORADATA\GUAMOKO\REDO01.ORA' SIZE 4M,
> GROUP 2 'D:\ORACLE\ORADATA\GUAMOKO\REDO02.ORA' SIZE 4M,
> GROUP 3 'D:\ORACLE\ORADATA\GUAMOKO\REDO03.ORA' SIZE 4M
> DATAFILE
> 'D:\ORACLE\ORADATA\GUAMOKO\SYSTEM_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\RBS_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\USERS_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\TOOLS_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\INDX01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\DR01.DBF',
> 'C:\ORACLE\ORADATA\GUAMOKO\VSU_DATA_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\VSU_INDX_01.ORA',
> 'D:\ORACLE\ORADATA\GUAMOKO\OEM_REPOSITORY.ORA'
> CHARACTER SET CL8MSWIN1251
> ;
> # Recovery is required if any of the datafiles are restored backups,
> # or if the last shutdown was not normal or immediate.
> #
> RECOVER DATABASE
> #
> # Database can now be opened normally.
> #
> ALTER DATABASE OPEN;
> #
> # Commands to add tempfiles to temporary tablespaces.
> # Online tempfiles have complete space information.
> # Other tempfiles may require adjustment.
> #
> ALTER TABLESPACE TEMP ADD TEMPFILE
> 'D:\ORACLE\ORADATA\GUAMOKO\TEMP_01.ORA' REUSE;
> #
> # End of tempfile additions.
> #
> --
> Change database name in
> CREATE CONTROLFILE REUSE DATABASE "GUAMOKO" NORESETLOGS NOARCHIVELOG
> ^^^^^^^
> shutdown your database and execute script via svrmgrl or SQL*plus
>
> DON'T FORGET BACKUP YOUR DATABASE BEFORE SCRIPT EXECUTION!
>
> See also.
> Oracle8i Administrator’s Guide
> "5. Managing Control Files"
> Creating Control Files
> New Control Files
>
> Valery Yourinsky
> --
> Oracle8 Certified DBA
Received on Tue Jan 09 2001 - 15:14:07 CST

Original text of this message

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