Wednesday, May 29, 2024

Backup based RMAN Duplicate database || Migrate and Clone database to another server using RMAN Duplicate | Cloning Oracle database


 


Oracle database (ENTOPDBA)

YouTube: https://www.youtube.com/@entopdba501

Backup based RMAN Duplicate database.

 

Ø  Duplicate a database from its backups without connecting to source database.

Ø  This technique is advantageous where network connections from the auxiliary host to the source database are restricted or prone to intermittent disruptions.

Ø  In duplication without a TARGET connection, the source database is unaffected by the duplication.

Ø  RMAN duplication, we will connect rman to the auxiliary instance and run duplicate command.

Ø  In this Demo we are doing RMAN Cloning on same server.

Ø  Please plan Hardware requirement such as Storage,CPU,RAM before perform duplicate.

2. Environment

 

Hostname                                  : test

Source DB Name                  : OEM       it’s a production database we want to clone it into test database

Duplicate DB Name                 : TEST

Version                                           : 11.2.0.4

Filesystem                                  : Normal

Non-RAC                                       : Single Instance

Oracle Home                             : /u01/app/oracle/product/11.2.0/dbhome_1

3. Backup Source Database

 

Take full backup/ full backup script  (PROD database)


4. Create PFILE from source db and Edit OEM to TEST

SQL> create pfile='/home/oracle/initTEST.ora' from spfile;

[oracle@test tmp]$ cat initTEST.ora


 

5. Create required Directories

[oracle@test ~]$ mkdir -p /u01/app/oracle/admin/TEST/adump
[oracle@test ~]$ mkdir -p /u01/oracle/oradata/TEST
[oracle@test ~]$ mkdir -p /u01/oracle/TEST/fast_recovery_area
[oracle@test ~]$ mkdir -p /u01/oracle/archive/TEST

6. Copy Password for Clone Database

[oracle@test ~]$ cd /u01/app/oracle/product/11.2.0.4/dbs/

[oracle@test dbs]$ ls -ltr orapwOEM

-rw-r-----. 1 oracle dba 1536 Nov  7 11:40 orapwOEM

[oracle@test dbs]$

[oracle@test dbs]$ cp orapwOEM orapwTEST

[oracle@test dbs]$

[oracle@test dbs]$ ls -ltr orapwOEM*

-rw-r-----. 1 oracle dba 1536 Nov  7 11:40 orapwOEM

-rw-r-----. 1 oracle dba 1536 Nov  9 07:58 orapwTEST

7. Add oratab entry

 

[oracle@test ~]$ echo "TEST:/u01/app/oracle/product/11.2.0.4:N" >> /etc/oratab

[oracle@test ~]$ cat /etc/oratab | grep -i TEST

TEST:/u01/app/oracle/product/11.2.0.4:N  <-----

[oracle@test~]$

 

8. Startup Nomount TEST

[oracle@rac1 ~]$ . oraenv

ORACLE_SID = [TEST] ? TESTARC

The Oracle base remains unchanged with value /u01/app/oracle

[oracle@test ~]$

 

[oracle@rac1 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Fri Nov 9 08:11:25 2018

 

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

 

Connected to an idle instance.

 

SQL> startup nomount pfile='/tmp/initTEST.ora';

SQL> create spfile from pfile='/home/oracle/initTEST.ora';

SQL> shut immediate;

ORA-01507: database not mounted

 

 

ORACLE instance shut down.

SQL>

SQL> startup nomount;

ORACLE instance started.

9. Run RMAN Duplicate

vi restore_duplicate.sh 


execute the script to restore database

oracle# ./restore_duplicate.sh

10. Verify DB ID for Clone DB (TEST)

SQL> select name,open_mode,dbid from v$database;

 

11. Add TNS entry

TESTARC =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = test.itsinc.com)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = TEST)

    )

  )

 

12. Verify connectivity

Sqlplus / as sysdba
SQL> select open_mode from v$database;

 

 

 

No comments:

Post a Comment

Please do not enter any spam link in the comments

Logical Standby in Oracle Data Guard Overview

  In Oracle Data Guard , a Logical Standby Database is a standby database that: Receives redo data from the Primary database Convert...