renaming a dB [message #498688] |
Thu, 10 March 2011 18:32 |
reym21
Messages: 241 Registered: February 2010 Location: Philippines
|
Senior Member |
|
|
Sirs,
Good day.
I would like to try to rename a newly created dB.
Referring to the topic posted on your website(http://www.orafaq.com/wiki/Oracle_database_FAQ),
I had some clarification before executing the dbrename.sql
mentioned there:
After modifying the the init.ora and tnsnames.ora,
do I have to rename all OLD, existing directory path (for controlfiles, datafiles, etc.) with the new-- meaning I don't have to create another directory for it's 'NEW' name?
Thank you.
|
|
|
|
Re: renaming a dB [message #498693 is a reply to message #498689] |
Thu, 10 March 2011 19:18 |
reym21
Messages: 241 Registered: February 2010 Location: Philippines
|
Senior Member |
|
|
Thanks for this.
I successfully used the DBNEWID utility and changed the DBID and the DBNAME. As of now, do I need to rename the old directory (for datafiles, controlfiles, etc.) to the new name because I saw it's still the same. After restarting using the open resetlogs, I had this message:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Mar 11 09:31:13 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 293601280 bytes
Fixed Size 2236696 bytes
Variable Size 219930344 bytes
Database Buffers 67108864 bytes
Redo Buffers 4325376 bytes
ORA-01103: database name 'LAEISS' in control file is not 'ELAMS'
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01507: database not mounted
btw, the old db name was ELAMS, and the new one is LAEISS.
[Updated on: Thu, 10 March 2011 19:19] Report message to a moderator
|
|
|
Re: renaming a dB [message #498695 is a reply to message #498693] |
Thu, 10 March 2011 19:24 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
No sure what you did exactly in your end.
It always works for me with something like this. (Warning.Not real code)
export ORACLE_SID=oldSid
nid target= / dbname=newSid
export ORACLE_SID=newSid
sqlplus -s / as sysdba <<EOF
startup force mount pfile='../../newSid.ora';
exit;
EOF
sql> then open database with options.
You need to fix your newSid.ora or spfile.ora what ever you are using. Check for DB_NAME.
[Updated on: Thu, 10 March 2011 19:34] Report message to a moderator
|
|
|
|
|
|
Re: renaming a dB [message #498703 is a reply to message #498697] |
Thu, 10 March 2011 20:17 |
reym21
Messages: 241 Registered: February 2010 Location: Philippines
|
Senior Member |
|
|
Thank you again. this is what I did using the steps in the links you've given me...
$ . oraenv
ORACLE_SID = [elams] ?
$
$
$ nid TARGET=sys/??????@elams DBNAME=laeiss
DBNEWID: Release 10.2.0.4.0 - Production on Fri Mar 11 09:21:53 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to database ELAMS (DBID=1345222437)
Connected to server version 10.2.0
Control Files in database:
/u401/oradata/elams/control/control01.ctl
/u501/oradata/elams/control/control02.ctl
/u601/oradata/elams/control/control03.ctl
/u402/oradata/elams/control/control01.ctl
/u502/oradata/elams/control/control02.ctl
/u602/oradata/elams/control/control03.ctl
Change database ID and database name ELAMS to LAEISS? (Y/[N]) => y
Proceeding with operation
Changing database ID from 1345222437 to 3420701553
Changing database name from ELAMS to LAEISS
Control File /u401/oradata/elams/control/control01.ctl - modified
Control File /u501/oradata/elams/control/control02.ctl - modified
Control File /u601/oradata/elams/control/control03.ctl - modified
Control File /u402/oradata/elams/control/control01.ctl - modified
Control File /u502/oradata/elams/control/control02.ctl - modified
Control File /u602/oradata/elams/control/control03.ctl - modified
Datafile /VOL02/oradata/elams/system01.dbf - dbid changed, wrote new name
Datafile /VOL03/oradata/elams/undo/undo01.dbf - dbid changed, wrote new name
Datafile /VOL02/oradata/elams/sysaux01.dbf - dbid changed, wrote new name
Datafile /VOL02/oradata/elams/data/elams01.dbf - dbid changed, wrote new name
Datafile /VOL03/oradata/elams/data/users01.dbf - dbid changed, wrote new name
Datafile /VOL03/oradata/elams/ndex/indx01.dbf - dbid changed, wrote new name
Datafile /VOL03/oradata/elams/temp/temp01.dbf - dbid changed, wrote new name
Control File /u401/oradata/elams/control/control01.ctl - dbid changed, wrote new name
Control File /u501/oradata/elams/control/control02.ctl - dbid changed, wrote new name
Control File /u601/oradata/elams/control/control03.ctl - dbid changed, wrote new name
Control File /u402/oradata/elams/control/control01.ctl - dbid changed, wrote new name
Control File /u502/oradata/elams/control/control02.ctl - dbid changed, wrote new name
Control File /u602/oradata/elams/control/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to LAEISS.
Modify parameter file and generate a new password file before restarting.
Database ID for database LAEISS changed to 3420701553.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
$
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Mar 11 10:13:26 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 293601280 bytes
Fixed Size 2236696 bytes
Variable Size 219930344 bytes
Database Buffers 67108864 bytes
Redo Buffers 4325376 bytes
ORA-01103: database name 'LAEISS' in control file is not 'ELAMS'
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
$
I just forgot to modified what's needed, before I restarted.
But now, I edited the oratab and add a new line (for laeiss), I renamed the initelams.ora to initlaeiss.ora and changed the needed parameters, I also made a backup of tnsnames.ora and updated it with the new db name. I noticed that the old (elams) instance is still up...
$ echo $ORACLE_SID
elams
$
$ export ORACLE_SID=laeiss
ORACLE_SID=laeiss: is not an identifier
$ set ORACLE_SID=laeiss
$ . oraenv
ORACLE_SID = [elams] ? laeiss
$ sqlplus / as sysdba
sqlplus: not found
$
but when I'am at the old instance (elams):
$ . oraenv
ORACLE_SID = [laeiss] ? elams
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Mar 11 10:28:42 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 293601280 bytes
Fixed Size 2236696 bytes
Variable Size 219930344 bytes
Database Buffers 67108864 bytes
Redo Buffers 4325376 bytes
ORA-01103: database name 'LAEISS' in control file is not 'ELAMS'
SQL>
here's the oratab file:
elams:/appl1/home/oracle/10.2:Y
laeiss:/appl1/home/oracle/10.2/Y
the initlaiess.ora
# init.ora for laeiss (elams) instance - 03/11/2011
###########################################
# Archive
###########################################
log_archive_dest='/u1archive/laeiss/laeissarch'
log_archive_format='%t_%s_%r.dbf'
###########################################
# Cache and I/O
###########################################
db_block_size=8192
db_cache_size=25165824
db_file_multiblock_read_count=16
###########################################
# Cursors and Library Cache
###########################################
open_cursors=1000
###########################################
# Database Identification
###########################################
db_domain=''
db_name='laeiss'
instance_name='laeiss'
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest='/appl1/home/oracle/10.2/admin/laeiss/bdump'
core_dump_dest='/appl1/home/oracle/10.2/admin/laeiss/cdump'
user_dump_dest='/appl1/home/oracle/10.2/admin/laeiss/udump'
timed_statistics=TRUE
###########################################
# File Configuration
###########################################
control_files='/u401/oradata/laeiss/control/control01.ctl','/u501/oradata/laeiss/control/control02.ctl','/u601/oradata/l
aeiss/control/control03.ctl','/u402/oradata/laeiss/control/control01.ctl','/u502/oradata/laeiss/control/control02.ctl','
/u602/oradata/laeiss/control/control03.ctl'
...
Thanks again.
|
|
|
Re: renaming a dB [message #498746 is a reply to message #498703] |
Thu, 10 March 2011 23:31 |
reym21
Messages: 241 Registered: February 2010 Location: Philippines
|
Senior Member |
|
|
Mahesh, Blackswan
The renamed db (LAEISS) is now up and running. I recreated the control files (using the dbrename.sql script that mentioned in the 'How does one rename a database?' topic, re: http://wwww.orafaq.com/wiki/Oracle_database_FAQ) and copy the existing ELAMS (old_name) files to the LAEISS directory I've created.
Thank you very much for your help, sirs!
Regards.
|
|
|