18 June 2018

Duplicate database to a diferent server

Prepare OLD database

cd $ORACLE_HOME/dbs; cp orapwDBNAME orapwDBNAME.beforemigration
orapwd file=/oracle/DBNAME/12102/dbs/orapwDBNAME sysdg=yes sysbackup=yes force=y
Stop all cronjobs on OLD server

Prepare  NEW database

Prepare all directories
oh; cd dbs
orapwd file=/oracle/DBNAME/121/dbs/orapwDBNAME sysdg=yes sysbackup=yes force=y

Update oratab

vi /etc/oratab
Add line:
DBNAME:/oracle/DBNAME/121:N
. oraenv

Create a separate listener for duplicate process

We are doing this so we don't have to touch SCAN or VIP listeners and disturb existing cluster
oh; cd network/admin
lsnrctl stop listener_duplicate

vi listener.ora
Add this:
LISTENER_DUPLICATE=
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = servername)(PORT = xxxx)) )

ADR_BASE_LISTENER_DUPLICATE = /oracle/DBNAME/saptrace
CONNECT_TIMEOUT_LISTENER_DUPLICATE = 10
TRACE_LEVEL_LISTENER_DUPLICATE = OFF

SID_LIST_LISTENER_DUPLICATE =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = DBNAME)
      (ORACLE_HOME = /oracle/DBNAME/121)
      (SID_NAME = DBNAME)  ) )

lsnrctl start listener_duplicate

Set up init.ora

Ensure these parameters are changed:
*.compatible=12.1.0.2.0
*.control_files
*.db_create_file_dest
*.db_recovery_file_dest
*.db_recovery_file_dest_size
*.db_create_online_log_dest_1
*.db_create_online_log_dest_2
*.dg_broker_start=FALSE
*.db_unique_name=DBNAME
*.log_archive_dest_1
*.log_archive_dest_state_1='ENABLE'

Set up TNS connectivity between servers

Add to tnsnames.ora on NEW server:

DBNAME_OLD=
  (DESCRIPTION =
    (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = oldhost)(PORT = xxxx) ))
    (CONNECT_DATA = (SID = DBNAME) (GLOBAL_NAME = DBNAME.WORLD)))

DBNAME=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST=servername)(PORT = xxxx))
    (CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = DBNAME)(UR = A) )
  )

LISTENER_DUPLICATE =(DESCRIPTION =(PROTOCOL = TCP)(HOST = servername)(PORT = xxxx))

Check all with:
sqlplus sys@DBNAME_OLD as sysdba
sqlplus sys@DBNAME as sysdba
tnsping listener_duplicate

Startup nomount NEW database

startup nomount pfile='/oracle/DBNAME/121/dbs/initDBNAME.ora';
create spfile from pfile='/oracle/DBNAME/121/dbs/initDBNAME.ora';

Startup mount OLD database

We are doing this so we don't have to do recovery on the NEW db
STARTUP MOUNT;

Duplicate

#No need to allocate channels as we are going directly over the network
rman AUXILIARY sys@DBNAME target sys@DBNAME_OLD
RUN
{
DUPLICATE TARGET DATABASE TO DBNAME FROM ACTIVE DATABASE;
}

Check the health of the database before commencing.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?