SQL> startup mount
2- Ejecutar el DBNEWID
$ nid TARGET=sys/password@desa DBNAME=qa1
Target es la Base origen, especificamos la password de sys
Previamente tenemos que agregar en el tnsnames.ora la entrada para esa base.
DBNAME se especifica el nombre destino.
$ nid TARGET=sys/password@desa DBNAME=qa1
DBNEWID: Release 11.2.0.4.0 - Production on Mon Aug 3 07:02:14 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database DESA (DBID=742283927)
Connected to server version 11.2.0
Control Files in database:
/u02/oradata/control01.ctl
/u05/oradata/control02.ctl
Change database ID and database name DESA to QA1? (Y/[N]) => Y -SELECCIONAR "Y" PARA CONTINUAR
Proceeding with operation
Changing database ID from 742283927 to 1597134007
Changing database name from DESA to QA1
Control File /u02/oradata/control01.ctl - modified
Control File /u05/oradata/control02.ctl - modified
Datafile /u02/oradata/system01.db - dbid changed, wrote new name
Datafile /u02/oradata/sysaux01.db - dbid changed, wrote new name
Datafile /u02/oradata/undotbs01.db - dbid changed, wrote new name
Datafile /u02/oradata/users01.db - dbid changed, wrote new name
Datafile /u02/oradata/temp01.db - dbid changed, wrote new name
Control File /u02/oradata/control01.ctl - dbid changed, wrote new name
Control File /u05/oradata/control02.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to QA1.
Modify parameter file and generate a new password file before restarting.
Database ID for database QA1 changed to 1597134007.
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.
SQL> shutdown immediate
ORA-01507: database not mounted
6 - Generar un nuevo password file
$cd $ORACLE_HOME/dbs
$orapwd file=orapwdqa1 password=password entries=10
7- Renombrar el spfile ya que el DBNEWID cambio los parametros del spfile pero no cambio el nombre del spfile en el sistema operativo
$mv
spfiledesa.ora spfileqa1.ora
8 - Cambiar el ORACLE_SID
$ export ORACLE_SID=qa1
9- Si estas clonando todo el ambiente como en este caso, cambia tambien el ORACLE_SID en el .profile, .bash_profile o el que uses
10 - Cambiar en el /etc/oratab para que quede nuestra nueva base
$vi /etc/oratab
qa1:/u01/app/oracle/product/11.2.0/dbhome_1:Y
11 - Levantar el listener o reiniciarlo
$ lsnrctl start
12 - Montar la base de datos
SQL> startup mount
---------
QA1
SQL> select instance_name from v$instance;
----------------
qa1
No hay comentarios:
Publicar un comentario