Changing the DBID and Database Name (DBNAME)

Oracle Database Administration
Post Reply
User avatar
jimb
Site Admin
Posts: 6146
Joined: Thu Jan 19, 2012 1:10 pm
Location: New Delhi, India
Contact:

Changing the DBID and Database Name (DBNAME)

Post by jimb »

The following steps describe how to change the DBID of a database and/or change the database name of an Oracle Database.

This guide is tested on:
Oracle RDBMS Version: 10.2.0.5.0 and 11.2.0.1.0
Operating System: Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
Old ORACLE_SID: ORCL10G
New ORACLE_SID: ORCL10G4

1. Perform full database backup. Ensure that is recoverable.

2. Restart database in mount stage.
SQL> shutdown immediate;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
SQL> startup mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1273276 bytes
Variable Size 121635396 bytes
Database Buffers 159383552 bytes
Redo Buffers 2920448 bytes
Database mounted.
3A. To change DBNEWID only, Invoke the DBNEWID utility on the command line, specifying a valid user with the SYSDBA privilege.
[oracle@oracle10g dbs]$ . oraenv
ORACLE_SID = [ORCL10G] ? ORCL10G

[oracle@oracle10g admin]$ nid TARGET=SYS/oracle@ORCL10G
[oracle@oracle11g dbs]$ nid TARGET=SYS/oracle@ORCL10G

DBNEWID: Release 10.2.0.5.0 - Production on Thu May 3 11:36:14 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to database ORCL10G (DBID=966597315)

Connected to server version 10.2.0

Control Files in database:
/u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl

Change database ID of database ORCL10G? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 966597315 to 966743407
Control File /u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl - modified
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_system_7t3z4fqg_.dbf - dbid changed
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_undotbs1_7t3z4ft2_.dbf - dbid changed
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_sysaux_7t3z4fqr_.dbf - dbid changed
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_users_7t3z4g4c_.dbf - dbid changed
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_temp_7t3z73ms_.tmp - dbid changed
Control File /u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl - dbid changed
Instance shut down

Database ID for database ORCL10G changed to 966743407.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
[oracle@oracle10g dbs]$ sqlplus '/as sysdba'
[oracle@oracle11g dbs]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Thu May 3 11:38:00 2012

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Connected to an idle instance.
SQL> startup mount;
SQL> startup mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1273276 bytes
Variable Size 121635396 bytes
Database Buffers 159383552 bytes
Redo Buffers 2920448 bytes
Database mounted.
SQL> alter database open RESETLOGS;
SQL> alter database open RESETLOGS;

Database altered.
3B. To change database name in addition to the DBID, specify the DBNAME parameter. Invoke the DBNEWID utility on the command line, specifying a valid user with the SYSDBA privilege.

Export spfile.
SQL> create pfile from spfile;
[oracle@oracle10g dbs]$ nid TARGET=SYS/oracle@ORCL10G DBNAME=ORCL10G4
[oracle@oracle11g dbs]$ nid TARGET=SYS/oracle@ORCL10G DBNAME=ORCL10G4

DBNEWID: Release 10.2.0.5.0 - Production on Thu May 3 11:42:23 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to database ORCL10G (DBID=966743407)

Connected to server version 10.2.0

Control Files in database:
/u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl

Change database ID and database name ORCL10G to ORCL10G4? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 966743407 to 906946335
Changing database name from ORCL10G to ORCL10G4
Control File /u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl - modified
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_system_7t3z4fqg_.dbf - dbid changed, wrote new name
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_undotbs1_7t3z4ft2_.dbf - dbid changed, wrote new name
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_sysaux_7t3z4fqr_.dbf - dbid changed, wrote new name
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_users_7t3z4g4c_.dbf - dbid changed, wrote new name
Datafile /u02/oradata/ORCL10G/datafile/o1_mf_temp_7t3z73ms_.tmp - dbid changed, wrote new name
Control File /u02/oradata/ORCL10G/controlfile/o1_mf_7t3z22qo_.ctl - dbid changed, wrote new name
Instance shut down

Database name changed to ORCL10G4.
Modify parameter file and generate a new password file before restarting.
Database ID for database ORCL10G4 changed to 906946335.
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.
Modify oratab.
vi /etc/oratab
Modify the below line to reflect the new database name
ORCL10G4:/u01/app/oracle/product/10.2.0/db_1:N

Modify the initialization parameter file.
mv $ORACLE_HOME/dbs/initORCL10G.ora $ORACLE_HOME/dbs/initORCL10G4.ora
vi $ORACLE_HOME/dbs/initORCL10G4.ora
Change *.db_name='ORCL10G' to *.db_name='ORCL10G4'

Recreate password file.
[oracle@oracle11g dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwORCL10G4 password=oracle entries=5

Change ORACLE_SID to the new database name.
[oracle@oracle10g dbs]$ . oraenv
ORACLE_SID = [ORCL10G] ? ORCL10G4

[oracle@oracle10g dbs]$ sqlplus '/as sysdba'
[oracle@oracle11g dbs]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.5.0 - Production on Thu May 3 11:38:00 2012

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Connected to an idle instance.
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initORCL10G4.ora
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initORCL10G4.ora
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1273276 bytes
Variable Size 92275268 bytes
Database Buffers 188743680 bytes
Redo Buffers 2920448 bytes
Recreate the new spfile.
SQL> create spfile from pfile;

Restart database in mount stage.
SQL> startup force mount;
SQL> startup force mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1273276 bytes
Variable Size 92275268 bytes
Database Buffers 188743680 bytes
Redo Buffers 2920448 bytes
Database mounted.
Open the database with RESETLOGS option.
SQL> alter database open RESETLOGS;
SQL> alter database open RESETLOGS;

Database altered.
Verify that the new database name is reflected.
SQL> select name from v$database;
SQL> select name from v$database;

NAME
---------
ORCL10G4
4. Modify listener.

5. Modify tnsnames

-- DONE --
Oracle Database Administration Forums
http://www.oracle-forums.com/
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing the DBID and Database Name (DBNAME)

Post by xaeresis »

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing the DBID and Database Name (DBNAME)

Post by xaeresis »

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Changing the DBID and Database Name (DBNAME)

Post by xaeresis »

Post Reply