[ 2015-03-10 ]

Cambiando el database ID con el utilitario NID

NID (New Database ID) es una utilitario introducido con Oracle 9.2. Este ejecutable permite cambiar el DBNAME, el DBID o ambos
(DBNAME y DBID) en el mismo comando.

Al clonar una base de datos, el ID de base de datos sigue siendo igual que la base de datos de origen, si necesita cambiar el DBID por uno diferente puede seguir los pasos indicados en el siguiente ejemplo. 
Esto es bastante útil en el caso de trabajar con RMAN.
Siguiendo los siguientes pasos, podemos cambiar el ID de una base de datos en versiones 10g y 11g:

Pasos:

1. Identificar el DBID actual de la base de datos:

SQL> select dbid from v$database;

      DBID
----------
1782667589


2. Bajar la base de datos en modo normal

SQL> shutdown immediate

Database closed.
Database dismounted.
ORACLE instance shut down.

3. Levantar la base en modo mount

SQL> startup mount

ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1334380 bytes
Variable Size             234881940 bytes
Database Buffers          293601280 bytes
Redo Buffers                5844992 bytes

Database mounted.

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

4. En una terminal ejecutar el comando "nid"

[oracle@server01]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/bin/nid

[oracle@server01]$ nid target=/

DBNEWID: Release 11.2.0.1.0 – Production on Fri Feb 25 16:32:17 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Connected to database ORCL (DBID=1782667589)

Connected to server version 11.2.0

Control Files in database:
/u01/app/oracle/oradata/orcl/control01.ctl
/u01/app/oracle/oradata/orcl/control02.ctl

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

Proceeding with operation

Changing database ID from 1782667589 to 2399434267
Control File /u01/app/oracle/oradata/orcl/control01.ctl – modified
Control File /u01/app/oracle/oradata/orcl/control02.ctl – modified
Datafile /u01/app/oracle/oradata/orcl/system01.db – dbid changed
Datafile /u01/app/oracle/oradata/orcl/sysaux01.db – dbid changed
Datafile /u01/app/oracle/oradata/orcl/undotbs01.db – dbid changed
Datafile /u01/app/oracle/oradata/orcl/user01.db – dbid changed
Control File /u01/app/oracle/oradata/orcl/control01.ctl – dbid changed
Control File /u01/app/oracle/oradata/orcl/control02.ctl – dbid changed
Instance shut down

Database ID for database ORCL changed to 2399434267.
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.

5. Pasar la base a modo mount

[oracle@server01]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 25 16:33:14 2015

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1334380 bytes
Variable Size             234881940 bytes
Database Buffers          293601280 bytes
Redo Buffers                5844992 bytes
Database mounted.

6. Abrir la base de datos con resetlog option

SQL> alter database open resetlogs ;
Database altered.

7. Verificar el nuevo DBID

SQL> select dbid from v$database;

      DBID
----------
2399434267      


No hay comentarios:

Publicar un comentario