Total Pageviews

Monday 19 January 2015

Changing the DBID & DBNAME of a database using nid

Follow the below steps to change only the dbid :
====================================
1. Backup the database
2. Shutdown all instances in the cluster make sure that this is a consistent shutdown done using shutdown immediate or shutdown normal command.
3. Make the parameter cluster_database=false
4. Startup mount only on one of the instances
5. Invoke the DBNEWID utility (nid) from the command line using a user with SYSDBA privilege.Do not specify a new DBNAME:

 $ORACLE_HOME/bin/nid TARGET=SYS/password@DB11G

6. Shutdown IMMEDIATE of the database (Note: This step is not required in 10g)
7. Open the database with resetlogs
8 . Make the parameter cluster_database=true and shutdown the current instance and startup all the instances
9. Take full backup of the database .

Follow the below steps to change only the DBNAME :
=========================================

1. Backup the database
2. Shutdown all instances in the cluster make sure that this is a consistent shutdown done using shutdown immediate or shutdown normal command.
3. Set the parameter CLUSTER_DATABASE=false
4. Startup mount only on one of the instances
5. Invoke the utility on the command line, specifying a valid user with the SYSDBA privilege.You must specify both the DBNAME and SETNAME parameters.
The SETNAME parameter tells the DBNEWID utility to only alter the database name.

$ORACLE_HOME/bin/nid TARGET=SYS/password@DB11G DBNAME=DB_NEW SETNAME=YES

6. Shutdown IMMEDIATE of the database
7. Set the DB_NAME initialization parameter in the initialization parameter file (PFILE) to the new database name
8. Create a new password file.
9. Open the database. When opening the database the RESETLOGS option is not needed so the database can be started using the STARTUP command.
11. Make the parameter CLUSTER_DATABASE=true and shutdown the current instance and startup all the instances.

Follow the below steps to Change Both DBID and DBNAME :
===============================================
1. Backup the database
2. Shutdown all instances in the cluster make sure that this is a consistent shutdown done using shutdown immediate or shutdown normal command.
3. Make the parameter CLUSTER_DATABASE=false
4. Startup mount only on one of the instances
5. Invoke the DBNEWID utility on the command line, specifying a valid user with the SYSDBA privilege

$ORACLE_HOME/bin/nid  TARGET=SYS/password@DB11G DBNAME=DB_NEW

6. Shutdown IMMEDIATE of the database
7. Set the DB_NAME initialization parameter in the initialization parameter file (PFILE) to the new database name
8. Create a new password file.
10. Mount and Open the database with resetlogs
11. Make the parameter CLUSTER_DATABASE=true and shutdown the current instance and startup all the instances

Some points to consider :
===================

1. The DBNEWID utility does not change the server parameter file (SPFILE). Therefore, if you use SPFILE to start your Oracle database, you must recreate the initialization parameter file from the server parameter file, remove the server parameter file, change the DB_NAME in the initialization parameter file, and then recreate the server parameter file.

2. DBNEWID utility makes the changes in the controlfile and datafile headers. This utility is not RAC aware. So it will not update the OCR when the database is renamed. Hence, the user needs to invoke SRVCTL to remove and again add the database information to OCR


Example Below is for changing just the DBID:

$ORACLE_HOME/bin/nid TARGET=SYS/password@DB11G

DBNEWID: Release 11.2.0.4.0 - Production on Mon Jan 19 03:53:54 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to database DB11G (DBID=338404813)

Connected to server version 11.2.0

Control Files in database:
    +DATA/db11g/controlfile/current.261.868735245
    +DATA/db11g/controlfile/current.260.868735247

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

Proceeding with operation
Changing database ID from 338404813 to 339029651
    Control File +DATA/db11g/controlfile/current.261.868735245 - modified
    Control File +DATA/db11g/controlfile/current.260.868735247 - modified
    Datafile +DATA/db11g/datafile/system.256.86873510 - dbid changed
    Datafile +DATA/db11g/datafile/sysaux.257.86873510 - dbid changed
    Datafile +DATA/db11g/datafile/undotbs1.258.86873510 - dbid changed
    Datafile +DATA/db11g/datafile/users.259.86873510 - dbid changed
    Datafile +DATA/db11g/tempfile/temp.268.86873527 - dbid changed
    Control File +DATA/db11g/controlfile/current.261.868735245 - dbid changed
    Control File +DATA/db11g/controlfile/current.260.868735247 - dbid changed
    Instance shut down

Database ID for database DB11G changed to 339029651.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.


Troubleshooting a DBID Change Operation
=================================

If the DBNEWID utility succeeds in its validation stage but detects an error while changing the DBID, then the utility stops and leaves the database in the middle of the change. In this case, you cannot open the database until the DBNEWID operation is either completed or reverted. DBNEWID displays messages indicating the status of the operation.

Before continuing or reverting, fix the underlying cause of the error. Sometimes the only solution is to restore the whole database from a recent backup and perform recovery to the point in time before DBNEWID was started. This underscores the importance of having a recent backup available before running DBNEWID.

If you choose to continue the DBID change operation rather than revert it, reexecute your original command. The DBNEWID utility resumes and attempts to continue the change until all datafiles and control files have the new DBID. At this point, the database is left mounted. You should shut it down and then mount it again prior to opening it with the RESETLOGS option.

If you choose to revert a DBNEWID operation, and if the reversion succeeds, then DBNEWID reverts all performed changes and leaves the database in a mounted state.

To revert a stalled DBID change operation, run the DBNEWID utility again, specifying the REVERT keyword. For example:

% nid TARGET=SYS/oracle REVERT=YES LOGFILE=$HOME/nid.log


Troubleshooting a Database Name Change Operation
=========================================

If you specify that only the database name should be changed (and not the DBID), then the validation process is the same as for a DBID change except that DBNEWID checks only the control files. It does not read the datafiles. If the validation encounters a problem, then the database is left mounted.

It is possible for validation to succeed, but for the actual database name change to fail. The possible failure scenarios depend on how many control files are in the database, as follows:

If you have one or more control files and DBNEWID fails on the first control file, then the database name is not changed in the control file. You can either try the operation again or open the database and resume normal database use.
If you have more than one control file and DBNEWID fails on the second control file or on any one thereafter, then some control files will have the old DBNAME and some will have the new DBNAME. In this case, you must either manually copy the first changed control file to all CONTROL_FILES locations, or revert by copying the unchanged control files to all CONTROL_FILES locations.

2 comments:

  1. Jadwal Cockfight SV388 2 Maret 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Judi Sabung Ayam - Sabtu, Aceh 2 Maret 2019 – Kami Selaku Agen Sabung Ayam 2018 Akan Memberikan Informasi Mengenai Jadwal Cockfight SV388 2 Maret 2019.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete
  2. Hello Everybody,
    My name is Mrs Sharon Sim. I live in Singapore and i am a happy woman today? and i told my self that any lender that rescue my family from our poor situation, i will refer any person that is looking for loan to him, he gave me happiness to me and my family, i was in need of a loan of $250,000.00 to start my life all over as i am a single mother with 3 kids I met this honest and GOD fearing man loan lender that help me with a loan of $250,000.00 SG. Dollar, he is a GOD fearing man, if you are in need of loan and you will pay back the loan please contact him tell him that is Mrs Sharon, that refer you to him. contact Dr Purva Pius, call/whats-App Contact Number +918929509036 via email:(urgentloan22@gmail.com) Thank you.

    ReplyDelete