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: Database name

Re: Database name

From: Howard J. Rogers <howardjr_at_www.com>
Date: Mon, 19 Mar 2001 19:51:39 +1100
Message-ID: <3ab5c8b3$1@news.iprimus.com.au>

"Dima" <dima_at_oblr.kh.energy.gov.ua> wrote in message news:3AB5A2E6.DBC89FAC_at_oblr.kh.energy.gov.ua...
> Help, please!!!
>
> How can I change a database name on Oracle 8.0.5?

Issue the 'alter database backup controlfile to trace' command. Locate the trace file thus produced (it will be in the User_dump_dest location, as per your init.ora setting). Edit it thus:

  1. strip out the rubbish at the top. You only want the lines from 'create controlfile...' onwards
  2. Add a 'connect / as sysdba' line before the 'create controlfile' line (or however else you ordinarily connect as a Privileged User
  3. Add a 'startup pfile=/blah/blah/initSID.ora' line after the connect line (ie, point the thing to wherever your init.ora is)
  4. Change the line which reads something like 'create controlfile reuse database 'BLAH' noresetlogs' to read 'create controlfile SET database 'NEWBLAH' resetlogs...'
  5. scroll down and find the line 'alter database open' and change it to read 'alter database open resetlogs'
  6. save the edited script as, say, 'createconfile.sql'

Edit your init.ora -it has a parameter there called 'db_name' -that needs to be changed to match whatever new database name you're proposing to set.

Now shutdown the original database (I hope you've got a complete backup!) At the command prompt, set your ORACLE_SID to be an appropriate match for the database you're about to rename. That is, if the SID is currently 'BLAH', change it to be 'NEWBLAH', as per the new name of the database. Now delete all copies of your existing controlfile. If you're nervous, I recommend re-naming them rather than an all-out delete.

Fire up Server Manager.
At the SRVMGR> prompt, type @createconfile.sql (you'll have to put the full path in if that script is not in the sasme directory as you run Server Manager from, of course).

Sit back and bite your nails.
If the thing comes up with 'database mounted', you're home and dry. If it comes up with vague errors about the control file, I've always found that the thing actually works anyway.

Check your handiwork: 'select * from v$controlfile', 'select * from v$instance' and 'select * from v$database' should prove that everything is in order.

And before doing any of that stuff, you might ask yourself if you *really* need to change your database name, since it involves potentially getting it into a state of non-openness, and definitiely results in a resetlogs, which renders all prior backups useless, and all prior archives (if you have them). Accordingly, having successfully renamed the thing, if you have any sense at all, you will do an immediate 'shutdown immediate', and do a complete, closed database backup.

HTH Regards
HJR Received on Mon Mar 19 2001 - 02:51:39 CST

Original text of this message

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