How to change database Id in Oracle?

Startup Mount
[oracle@rizwan dbs]$ export ORACLE_SID=prod2
[oracle@rizwan dbs]$ sqlplus / as sysdba
SYS>startup mount
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1344652 bytes
Variable Size             104860532 bytes
Database Buffers          201326592 bytes
Redo Buffers                6328320 bytes
Database mounted.
SYS>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@rizwan dbs]$ nid target=/ dbnewid

DBNEWID: Release 11.2.0.3.0 - Production on Sun May 17 23:39:02 2015

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

Password:
Connected to database PROD2 (DBID=1531791333)

Connected to server version 11.2.0

Control Files in database:
    /u02/db/prod/control01.ctl
    /u02/db/prod/control02.ctl

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

Proceeding with operation
Changing database ID from 1531791333 to 1531843610
    Control File /u02/db/prod/control01.ctl - modified
    Control File /u02/db/prod/control02.ctl - modified
    Datafile /u02/db/prod/system01.db - dbid changed
    Datafile /u02/db/prod/sysaux01.db - dbid changed
    Datafile /u02/db/prod/undotbs01.db - dbid changed
    Datafile /u02/db/prod/users01.db - dbid changed
    Datafile /u02/db/prod/tbs1.db - dbid changed
    Datafile /u01/home/tbs0.db - dbid changed
    Datafile /u02/db/prod/tbs21.db - dbid changed
    Datafile /u02/db/prod/temp01.db - dbid changed
    Datafile /u02/db/prod/tmp1.db - dbid changed
    Control File /u02/db/prod/control01.ctl - dbid changed
    Control File /u02/db/prod/control02.ctl - dbid changed
    Instance shut down

Database ID for database PROD2 changed to 1531843610.
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@rizwan dbs]$ !sql
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun May 17 23:39:22 2015

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

Connected to an idle instance.
SQL>exit
[oracle@rizwan dbs]$ export ORACLE_SID=prod2
[oracle@rizwan dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun May 17 23:39:47 2015

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

Connected to an idle instance.

SYS>startup
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1344652 bytes
Variable Size             104860532 bytes
Database Buffers          201326592 bytes
Redo Buffers                6328320 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SYS>alter database open resetlogs;

Database altered.


SYS>

No comments:

Post a Comment