2016-11-23

Changing the SID of an Oracle Database keeping the DBID unchanged

When I once needed to change a DB SID, I didn't notice that it is possible to perform this, without changing the DBID. As consequence of my mishap, I had to perform an "DATABASE OPEN RESETLOGS" with all its consequences.

So, If you are only changing the DB SID  (leaving the DBID unchanged)  you should use the parameter SETNAME=YES.
For example:
OS> nid TARGET=SYS/<pwd>@<DB_Alias> DBNAME=NewDbSID SETNAME=YES

If you forget to use it, like me in the following example, the DBID will also be changed:
OS> nid TARGET=SYS/<pwd>@<DB_Alias> DBNAME=NewDbSID
. . .
Connected to database OldDbSID (DBID=1075560178)
. . .
Change database ID and database name OldBbSID to NewDbSID? (Y/[N]) => y

Proceeding with operation
Changing database ID from 1075560178 to 1518037673
Changing database name from OldBbSID to NewDbSID
    Control File ... - modified
    Control File ... - modified
...
    Datafile ... - dbid changed, wrote new name
    Datafile ... - dbid changed, wrote new name
...
    Control File ... - dbid changed, wrote new name
    Control File ... - dbid changed, wrote new name
    Instance shut down

Database name changed to NewDbSID.
Modify parameter file and generate a new password file before restarting.
Database ID for database NewDbSID changed to 1518037673.
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 name and ID.
DBNEWID - Completed succesfully.

... you will need to perform an "OPEN RESETLOGS".
STARTUP MOUNT
ALTER DATABASE OPEN RESETLOGS;

If you are using the RMAN catalog, you will then need to register this DB in the RMAN catalog again. In short:
OS> rman target / catalog /@<RmanCatalogAlias>

RMAN> register database;

Perhaps you also want to remove the DB entry with the old DBID from the catalog.

The previous backups and archived logs of the database become unusable.
You should also perform a full backup of the DB as soon as possible.

Tags: SID, DBID, nid
June 27, 2016 at 05:13PM