Changing the database name
DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Changing the database name

  1. #1
    Join Date
    Oct 2003
    Posts
    38

    Changing the database name

    Can anyone give me some information on what are steps involved in 1)creating database on same server with different Dbname 2)Creating database on different server with same database name but differnt paths.
    I have the backup of the database on tape. what should my control file script look like for different scenarios and what are the commands to be given after running control file script.
    Can I use 1) " CREATE CONTROLFILE REUSE set DATABASE "newdbname" RESETLOGS"
    Changing the file system to the different directory
    /u02/oradata/newdbname/sys1.dbf

    2) Alter database open resetlogs;

    Is it not needed to give restore database before giving alter database open resetlogs command ???
    Are the above steps can be used for both above mentioned scenarios ( Instead if newdbname it will be olddbname for seconds scenario).

    Thanks

  2. #2
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    So you want to "clone" a db?

    I always follow this procedure:
    1. shutdown source-db;
    2. copy all datafiles;
    3. copy the init[SID].ora to init[NEWSID].ora;

    4.Use ORADIM to create a new service
    ORADIM -NEW -SID [newsid] -PFILE [path+init[NEWSID].ora]

    5. Make new password pfile
    ORAPWD file=[path+file] PASSWORD=x ENTRIES=n

    6. Alter the listener.ora (add the newdb) and reload the listener.ora
    LSNRCTL RELOAD
    7. alter TNSNAMES.ORA (add the newdb)

    8. TNSPING the new db
    TNSPING [newdb] This should work.

    9. startup SVRMGRL (8i)
    10. CONNECT INTERNAL@[newsid]
    11. STARTUP NOMOUNT PFILE=[path+init[NEWSID].ora
    12. ALTER DATABASE RENAME GLOBAL_NAME TO [newsid] | [newsid+domain]
    13. CREATE CONTROLFILE REUSE SET DATABASE [newsid] DATAFILE [datafile1],[datafile2],etc.
    14. ALTER DATABASE OPEN RESETLOGS
    15. Check redo logs files
    16. Bounce the intelligent Agent when using OEM

    Okay, I'm not restoring from tape, but you get the picture now, don't you?

    HTH,

    Erik
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  3. #3
    Join Date
    Oct 2003
    Posts
    38
    Thanks for the help Eirk.
    But if i restore from tape do i need to Use RECOVER DATABASE Command.
    Before opening the database.

  4. #4
    Join Date
    Sep 2003
    Location
    over the hill and through the woods
    Posts
    995
    Clone DB UNIX style and taking consideration that you already have an Oracle home and user id over on the target server

    1.alter database backup controlfile to trace;
    2. shutdown database.
    3. copy /FTP all datafiles,redo logs,init.ora (don't forget to rename the init.ora to the new database name as well as in the actual init.ora) to new server.
    4. edit the control file that was put to trace.don't forget ftp it over.
    ex.. CREATE CONTROLFILE SET DATABASE "Prince JR" RESETLOGS ARCHIVELOG
    edit: logfiles
    edit: datafiles;
    you do not need to issue the recover database command
    alter database open resetlogs;
    5. make sure you have you're enviornment variables set to the new home and sid within your .profile /env file (or whatever you use).

    6. on target server login with the user id and issue the following.
    sqlplus /nolog
    connect / as sysdba
    @ /your/backed/up/controlfile/princ.jr

    7. Vollah! you have a cloned database.


    hmmm don't think I missed anything
    Oracle it's not just a database it's a lifestyle!
    --------------
    BTW....You need to get a girlfriend who's last name isn't .jpg

  5. #5
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    323
    Not necessarily COLD BACKUP, HOT BACKUP will also do.
    Nagesh

  6. #6
    Join Date
    Sep 2003
    Location
    over the hill and through the woods
    Posts
    995
    TRUE! thanks.
    Oracle it's not just a database it's a lifestyle!
    --------------
    BTW....You need to get a girlfriend who's last name isn't .jpg

  7. #7
    Join Date
    Oct 2003
    Posts
    38
    HI,
    I am confused in here. DO i NEED to give "Create controlfile set database " Or "Create controlfile reuse set database" or "Create control file resuse database".
    I am just eager to know how does it work in 3 different statements..
    thanks

  8. #8
    Join Date
    Jun 2001
    Location
    California
    Posts
    124
    Specify REUSE to indicate that existing control files identified by the initialization parameter CONTROL_FILES can be reused, thus ignoring and overwriting any information they may currently contain. If you omit this clause and any of these control files already exists, Oracle returns an error.

    Use SET DATABASE to change the name of the database. The name of a database can be as long as eight bytes.


    HTH

  9. #9
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    By the way: svrmgrl or sqlplus will warn you if Oracle needs to recover.
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  10. #10
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938
    How about checking out the NID utility. That is the easiest way to change the DB name.

    nid TARGET=SYS/password DBNAME=new_name
    Oracle Certified Master
    Oracle Certified Professional 6i,8i,9i,10g,11g,12c
    email: ocp_9i@yahoo.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width