Wednesday, 10 October 2018

Building a standby database from primary database using RMAN "restore from service" in oracle 12c.



-- Starting in Oracle 12.1, the RMAN "restore from service" clause can be used to simplify the instantiation of a standby database through an Oracle Net connection to the primary database.


1) Primary side, install and configure oracle 12.1 database with all pre-requisites. 
2) On standby side, install oracle 12c binaries.
3) Create pfile for standby
4) Copy password file from primary to standby server
5) Configure Listener & TNSNAMES files on both sides.
6) Connect to rman from standby and follow below steps.

[oracle@beta trace]$ rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Oct 10 15:58:49 2018

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

connected to target database: GOLD (not mounted)

RMAN> restore standby controlfile from service gold; --- # (service name to connect primary db)

Starting restore at 10-OCT-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service gold
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output file name=/u01/gold/datafiles/gold/control01.ctl
output file name=/u01/gold/flash/gold/control02.ctl
Finished restore at 10-OCT-18

RMAN> startup mount force;

Oracle instance started
database mounted

Total System Global Area    1048576000 bytes

Fixed Size                     2932336 bytes
Variable Size                696254864 bytes
Database Buffers             343932928 bytes
Redo Buffers                   5455872 bytes


RMAN> restore database from service gold section size 1G;

Starting restore at 10-OCT-18
Starting implicit crosscheck backup at 10-OCT-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=30 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=31 device type=DISK
Finished implicit crosscheck backup at 10-OCT-18
Starting implicit crosscheck copy at 10-OCT-18
using channel ORA_DISK_1
using channel ORA_DISK_2
Crosschecked 2 objects
Finished implicit crosscheck copy at 10-OCT-18
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using network backup set from service gold
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/gold/datafiles/gold/system01.dbf
channel ORA_DISK_1: restoring section 1 of 1
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: using network backup set from service gold
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00003 to /u01/gold/datafiles/gold/sysaux01.dbf
channel ORA_DISK_2: restoring section 1 of 1
channel ORA_DISK_2: restore complete, elapsed time: 00:05:03
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: using network backup set from service gold
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00004 to /u01/gold/datafiles/gold/undotbs                                                                                     01.dbf
channel ORA_DISK_2: restoring section 1 of 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:51
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: using network backup set from service gold
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00006 to /u01/gold/datafiles/gold/users01                                                                                     .dbf
channel ORA_DISK_2: restoring section 1 of 1
channel ORA_DISK_1: restore complete, elapsed time: 00:05:59
channel ORA_DISK_2: restore complete, elapsed time: 00:00:09
Finished restore at 10-OCT-18

RMAN> exit


Recovery Manager complete.
[oracle@beta trace]$


SQL> select database_role,open_mode,protection_mode from v$database;

DATABASE_ROLE    OPEN_MODE            PROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MOUNTED              MAXIMUM PERFORMANCE



No comments:

Post a Comment