Tuesday, February 16, 2021

 

Oracle Data Guard Physical Standby Configuration

Stage-1 How to Create a Physical Standby Database using Backup Pieces

High Level Steps

Goal : How to Create Physical Standby Database using RMAN Backup With Duplicate Command

 

1. Environment

Environment detail

Primary

Standby

Database Name

dbwrprd

dbwrprd

Db Unique name

dbwrprd

dbwrstd

Server IP

192.168.1.24

192.168.1.25

Server Name

Prod21

Prod22

 

 

 

 

 

2. Enable Flashback,Force Logging and archivelog mode on Primary

[oracle@Prod21 ~]$ export ORACLE_SID=dbwrprd

[oracle@Prod21 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri May 15 01:40:34 2020

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

Connected to an idle instance.

 

SQL> startup

ORACLE instance started.

Total System Global Area 2432696320 bytes

Fixed Size                                8623592 bytes

Variable Size                        654314008 bytes

Database Buffers             1761607680 bytes

Redo Buffers                          8151040 bytes

Database mounted.

Database opened.

 

SQL> alter database force logging;

 

SQL> alter database flashback on;

 

Shutdown immediate

Startup mount

Alter database archivelog;

Shut immediate

startup

 

SQL> col FORCE_LOGGING for a20

SQL> select name,force_logging,flashback_on,log_mode from v$database;

 

NAME     FORCE_LOGGING        FLASHBACK_ON   LOG_MODE

---------    --------------------            ------------------            ------------

DBWRPRD   YES                        YES                                    ARCHIVELOG

 

3.Configure a Standby Redo Log on Primary

 

-- Since we have 3 online redo log file groups, we need to create 4(3+1) Standby redo log file groups

-- Standy Redo logs files come into picture only when protection mode is Maximum Availability and Maximum Protection.

SQL> set lines 180

col MEMBER for a60

select b.thread#, a.group#, a.member, b.bytes FROM v$logfile a, v$log b WHERE a.group# = b.group#;SQL> SQL>

 

   THREAD#     GROUP# MEMBER                                                                                               BYTES

---------- ---------- ------------------------------------------------------------                              ----------

                 1                 3 /u01/app/oracle/oradata/dbwrprd/redo03.log                     209715200

                 1                 2 /u01/app/oracle/oradata/dbwrprd/redo02.log                             209715200

                 1                 1 /u01/app/oracle/oradata/dbwrprd/redo01.log                             209715200

 

 

ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/app/oracle/oradata/dbwrprd/redo04.log') SIZE 200M;

Database altered.

ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/app/oracle/oradata/dbwrprd/redo05.log') SIZE 200M;

Database altered.

ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/app/oracle/oradata/dbwrprd/redo06.log') SIZE 200M;

Database altered.

ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/app/oracle/oradata/dbwrprd/redo07.log') SIZE 200M;

Database altered.

 

SQL> select * from v$logfile;

 

    GROUP# STATUS  TYPE    MEMBER                                                                                                      IS_          CON_ID

---------- ------- ------- ------------------------------------------------------------ --- ----------

                 3                ONLINE  /u01/app/oracle/oradata/dbwrprd/redo03.log                                            NO              0

                 2                ONLINE  /u01/app/oracle/oradata/dbwrprd/redo02.log                                            NO              0

                 1                ONLINE  /u01/app/oracle/oradata/dbwrprd/redo01.log                                            NO              0

                 4                STANDBY /u01/app/oracle/oradata/dbwrprd/redo04.log                                         NO              0

                 5                STANDBY /u01/app/oracle/oradata/dbwrprd/redo05.log                                         NO              0

                 6                STANDBY /u01/app/oracle/oradata/dbwrprd/redo06.log                                         NO              0

                 7                STANDBY /u01/app/oracle/oradata/dbwrprd/redo07.log                                         NO              0

 

SQL> select a.group#, a.member, b.bytes FROM v$logfile a, v$standby_log b WHERE a.group# = b.group#;

 

    GROUP# MEMBER                                                                                                                     BYTES

---------- ------------------------------------------------------------ -                                               ---------

                 4 /u01/app/oracle/oradata/dbwrprd/redo04.log                                            209715200

                 5 /u01/app/oracle/oradata/dbwrprd/redo05.log                                            209715200

                 6 /u01/app/oracle/oradata/dbwrprd/redo06.log                                            209715200

                 7 /u01/app/oracle/oradata/dbwrprd/redo07.log                                            209715200

 

 

4.Configure TNS and listener for Primary and Standby (both the server)

 

[oracle@Prod21 ~]$ tnsping dbwrprd

 

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 15-MAY-2020 02:01:46

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.24)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dbwrprd)))

OK (210 msec)

 

[oracle@Prod21 ~]$ tnsping dbwrstd

 

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 15-MAY-2020 02:01:51

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.25)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = dbwrstd)))

 

OK (2630 msec)

[oracle@Prod21 ~]$

[oracle@Prod21 ~]$ lsnrctl status

 

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 15-MAY-2020 02:02:08

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.24)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                15-MAY-2020 00:43:34

Uptime                    0 days 1 hr. 18 min. 34 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/Prod21/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.24)(PORT=1521)))

Services Summary...

Service "dbwrprd" has 2 instance(s).

  Instance "dbwrprd", status UNKNOWN, has 1 handler(s) for this service...

  Instance "dbwrprd", status READY, has 1 handler(s) for this service...

Service "dbwrprdXDB" has 1 instance(s).

  Instance "dbwrprd", status READY, has 1 handler(s) for this service...

Service "dbwrstd" has 1 instance(s).

  Instance "dbwrstd", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

 

Login to Standby server and perform the same

 

5.Set Primary Database Initialization Parameters

ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/dbwrstd/','/u01/app/oracle/oradata/dbwrprd/' SCOPE=SPFILE;

ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/dbwrstd/','/u01/app/oracle/oradata/dbwrprd/' SCOPE=SPFILE;

 

ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=SPFILE;

ALTER SYSTEM SET log_archive_config='dg_config=(dbwrprd,dbwrstd)' SCOPE=SPFILE;

 

ALTER SYSTEM SET log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles) db_unique_name=dbwrprd' SCOPE=SPFILE;

ALTER SYSTEM SET log_archive_dest_2='service=dbwrstd async valid_for=(online_logfiles,primary_role) db_unique_name=dbwrstd' SCOPE=SPFILE;

 

ALTER SYSTEM SET fal_server='dbwrstd' SCOPE=SPFILE;

ALTER SYSTEM SET fal_client='dbwrprd' SCOPE=SPFILE;

 

ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/dbwrstd/','/u01/app/oracle/oradata/dbwrprd/' SCOPE=SPFILE;

ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/dbwrstd/','/u01/app/oracle/oradata/dbwrprd/' SCOPE=SPFILE;

 

6.Bounce the Primary Database

SQL> shut immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@Prod21 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri May 15 21:48:21 2020

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

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area 2432696320 bytes

Fixed Size                                8623592 bytes

Variable Size                        654314008 bytes

Database Buffers             1761607680 bytes

Redo Buffers                         8151040 bytes

Database mounted.

Database opened.

 

7.Backup the Primary Database

Script Location /u01/backup

mkdir –p /u01/backup

 

run

{

  ALLOCATE CHANNEL ch11 TYPE DISK MAXPIECESIZE 10G;

  BACKUP

  FORMAT '/u01/backup/%d_D_%T_%u_s%s_p%p'

  DATABASE

  CURRENT CONTROLFILE for standby

  FORMAT '/u01/backup/%d_C_%T_%u'

  SPFILE

  FORMAT '/u01/backup/%d_S_%T_%u'

  PLUS ARCHIVELOG

  FORMAT '/u01/backup/%d_A_%T_%u_s%s_p%p';

  RELEASE CHANNEL ch11;

}

 

 

[oracle@Prod21 ~]$ mkdir -p /u01/backup/

[oracle@Prod21 ~]$ export ORACLE_SID=dbwrprd

[oracle@Prod21 ~]$ rman target /

 

Recovery Manager: Release 12.2.0.1.0 - Production on Fri May 15 20:06:20 2020

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

connected to target database: DBWRPRD (DBID=612730647)

 

RMAN> run         

{

  ALLOCATE CHANNEL ch11 TYPE DISK MAXPIECESIZE 10G;

  BACKUP

  FORMAT '/u01/backup/%d_D_%T_%u_s%s_p%p'

  DATABASE

  CURRENT CONTROLFILE for standby

  FORMAT '/u01/backup/%d_C_%T_%u'

  SPFILE

  FORMAT '/u01/backup/%d_S_%T_%u'

  PLUS ARCHIVELOG

  FORMAT '/u01/backup/%d_A_%T_%u_s%s_p%p';

  RELEASE CHANNEL ch11;

}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14>

 

using target database control file instead of recovery catalog

allocated channel: ch11

channel ch11: SID=53 device type=DISK

 

 

Starting backup at 15-MAY-20

current log archived

channel ch11: starting archived log backup set

channel ch11: specifying archived log(s) in backup set

input archived log thread=1 sequence=1 RECID=1 STAMP=1040434867

input archived log thread=1 sequence=2 RECID=2 STAMP=1040501250

channel ch11: starting piece 1 at 15-MAY-20

channel ch11: finished piece 1 at 15-MAY-20

piece handle=/u01/backup/DBWRPRD_A_20200515_03v09ig4_s3_p1 tag=TAG20200515T200731 comment=NONE

channel ch11: backup set complete, elapsed time: 00:01:36

Finished backup at 15-MAY-20

 

Starting backup at 15-MAY-20

channel ch11: starting full datafile backup set

channel ch11: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/dbwrprd/system01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/dbwrprd/sysaux01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/dbwrprd/undotbs01.dbf

input datafile file number=00007 name=/u01/app/oracle/oradata/dbwrprd/users01.dbf

channel ch11: starting piece 1 at 15-MAY-20

channel ch11: finished piece 1 at 15-MAY-20

piece handle=/u01/backup/DBWRPRD_D_20200515_04v09ij7_s4_p1 tag=TAG20200515T200910 comment=NONE

channel ch11: backup set complete, elapsed time: 00:02:27

channel ch11: starting full datafile backup set

channel ch11: specifying datafile(s) in backup set

including standby control file in backup set

channel ch11: starting piece 1 at 15-MAY-20

channel ch11: finished piece 1 at 15-MAY-20

piece handle=/u01/backup/DBWRPRD_C_20200515_05v09inq tag=TAG20200515T200910 comment=NONE

channel ch11: backup set complete, elapsed time: 00:00:01

channel ch11: starting full datafile backup set

channel ch11: specifying datafile(s) in backup set

including current SPFILE in backup set

channel ch11: starting piece 1 at 15-MAY-20

channel ch11: finished piece 1 at 15-MAY-20

piece handle=/u01/backup/DBWRPRD_S_20200515_06v09inu tag=TAG20200515T200910 comment=NONE

channel ch11: backup set complete, elapsed time: 00:00:01

Finished backup at 15-MAY-20

 

Starting backup at 15-MAY-20

current log archived

channel ch11: starting archived log backup set

channel ch11: specifying archived log(s) in backup set

input archived log thread=1 sequence=3 RECID=3 STAMP=1040501503

channel ch11: starting piece 1 at 15-MAY-20

channel ch11: finished piece 1 at 15-MAY-20

piece handle=/u01/backup/DBWRPRD_A_20200515_07v09io0_s7_p1 tag=TAG20200515T201144 comment=NONE

channel ch11: backup set complete, elapsed time: 00:00:01

Finished backup at 15-MAY-20

 

Starting Control File and SPFILE Autobackup at 15-MAY-20

piece handle=/u01/app/oracle/fast_recovery_area/dbwrprd/DBWRPRD/autobackup/2020_05_15/o1_mf_s_1040501505_hcxbk9bn_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 15-MAY-20

released channel: ch11

 

RMAN>

 

8.Check backup location

[oracle@Prod21 ~]$ cd /u01/backup/

[oracle@Prod21 backup]$ ll

total 1407660

-rw-r-----. 1 oracle oinstall  322836992 May 15 20:08 DBWRPRD_A_20200515_03v09ig4_s3_p1

-rw-r-----. 1 oracle oinstall      89600 May 15 20:11 DBWRPRD_A_20200515_07v09io0_s7_p1

-rw-r-----. 1 oracle oinstall   10665984 May 15 20:11 DBWRPRD_C_20200515_05v09inq

-rw-r-----. 1 oracle oinstall 1107730432 May 15 20:11 DBWRPRD_D_20200515_04v09ij7_s4_p1

-rw-r-----. 1 oracle oinstall     114688 May 15 20:11 DBWRPRD_S_20200515_06v09inu

 

9.Create pfile for standby database and edit the parameters

[oracle@Prod21 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri May 15 20:14:11 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> CREATE PFILE='/u01/backup/initdbwrstd.ora' from spfile;

 

Login into /u01/location and edit the parameters

 

In the PFILE making the entries relevant for the standby database. Change the following parameters.

 

*.audit_file_dest='/u01/app/oracle/admin/dbwrstd/adump'

*.audit_trail='db'

*.compatible='12.2.0'

*.control_files='/u01/app/oracle/oradata/dbwrstd/control01.ctl','/u01/app/oracle/fast_recovery_area/dbwrstd/control02.ctl'

*.db_block_size=8192

*.db_file_name_convert='/u01/app/oracle/oradata/dbwrprd/','/u01/app/oracle/oradata/dbwrstd/'

*.db_name='dbwrprd'

*.db_unique_name='dbwrstd'   -> we need to add

*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/dbwrstd'

*.db_recovery_file_dest_size=8016m

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=dbwrstdXDB)'

*.fal_client='dbwrstd'

*.fal_server='dbwrprd'

*.local_listener='LISTENER_DBWRPRD'

*.log_archive_config='dg_config=(dbwrprd,dbwrstd)'

*.log_archive_dest_1='location=use_db_recovery_file_dest valid_for=(all_logfiles,all_roles)    db_unique_name=dbwrstd'

*.log_archive_dest_2='service=dbwrprd async valid_for=(online_logfiles,primary_role) db_unique_name=dbwrprd'

*.log_archive_format='%t_%s_%r.dbf'

*.log_file_name_convert='/u01/app/oracle/oradata/dbwrprd/','/u01/app/oracle/oradata/dbwrstd/'

*.nls_language='AMERICAN'

*.nls_territory='AMERICA'

*.open_cursors=300

*.pga_aggregate_target=771m

*.processes=300

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=2312m

*.standby_file_management='AUTO'

*.undo_tablespace='UNDOTBS1'

 

Standby Server Setup (Manual)

 

1.Create the necessary directories on the standby server.

 

mkdir -p /u01/app/oracle/oradata/dbwrstd

mkdir -p /u01/app/oracle/fast_recovery_area/dbwrstd

mkdir -p /u01/app/oracle/admin/dbwrstd/adump

mkdir -p /u01/backup/

 

 

2.Copy the files from the primary to the standby server.( Login in to primary server and start copy)

 

[oracle@Prod21 ~]$ cd /u01/backup/

[oracle@Prod21 backup]$ ll

total 1407660

-rw-r-----. 1 oracle oinstall  322836992 May 15 20:08 DBWRPRD_A_20200515_03v09ig4_s3_p1

-rw-r-----. 1 oracle oinstall      89600 May 15 20:11 DBWRPRD_A_20200515_07v09io0_s7_p1

-rw-r-----. 1 oracle oinstall   10665984 May 15 20:11 DBWRPRD_C_20200515_05v09inq

-rw-r-----. 1 oracle oinstall 1107730432 May 15 20:11 DBWRPRD_D_20200515_04v09ij7_s4_p1

-rw-r-----. 1 oracle oinstall     114688 May 15 20:11 DBWRPRD_S_20200515_06v09inu

-rw-r--r--. 1 oracle oinstall       1728 May 15 20:14 initdbwrstd.ora

 

# Standby controlfile ,Archivelogs and backups

 

[oracle@Prod21 backup]$ scp *DBWR* oracle@192.168.1.25:/u01/backup

oracle@192.168.1.25's password:

DBWRPRD_A_20200515_03v09ig4_s3_p1                                                                         100%  308MB   3.5MB/s   01:29   

DBWRPRD_A_20200515_07v09io0_s7_p1                                                                         100%   88KB  87.5KB/s   00:00   

DBWRPRD_C_20200515_05v09inq                                                                               100%   10MB   5.1MB/s   00:02   

DBWRPRD_D_20200515_04v09ij7_s4_p1                                                                         100% 1056MB   6.2MB/s   02:50   

DBWRPRD_S_20200515_06v09inu                                                                               100%  112KB 112.0KB/s   00:00   

 

$ # Parameter file.

 

cd /u01/backup

[oracle@Prod21 backup]$ scp initdbwrstd.ora oracle@192.168.1.25:$ORACLE_HOME/dbs

oracle@192.168.1.25's password:

initdbwrstd.ora                                                                                           100% 1728     1.7KB/s   00:00  

 

 

$ # Passwordfile.

 

cd $ORACLE_HOME/dbs

[oracle@Prod21 dbs]$ scp orapwdbwrprd oracle@192.168.1.25:$ORACLE_HOME/dbs

oracle@192.168.1.25's password:

orapwdbwrprd                                                                                              100% 3584     3.5KB/s   00:00   

 

3.Start standby database in nomount

 

[oracle@Prod22 ~]$export ORACLE_SID=dbwrstd

[oracle@Prod22 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri May 15 20:58:12 2020

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

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area 2432696320 bytes

Fixed Size                                8623592 bytes

Variable Size                        654314008 bytes

Database Buffers             1761607680 bytes

Redo Buffers                         8151040 bytes

SQL>exit

 

4. Start building a standby database using rman backup based method

Script to restore

run {

allocate channel disk1 device type disk;

allocate auxiliary channel disk2 device type disk;

duplicate target database for standby nofilenamecheck;

release channel disk1;

release channel disk2;

}

 

 

[oracle@Prod22 admin]$export ORACLE_SID=dbwrstd

[oracle@Prod22 admin]$ rman target sys/oracle@dbwrprd auxiliary sys/oracle@dbwrstd

Recovery Manager: Release 12.2.0.1.0 - Production on Fri May 15 21:03:13 2020

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

connected to target database: DBWRPRD (DBID=612730647)

connected to auxiliary database: DBWRPRD (not mounted)

 

RMAN> run {

allocate channel disk1 device type disk;

allocate auxiliary channel disk2 device type disk;

duplicate target database for standby nofilenamecheck;

release channel disk1;

release channel disk2;

}2> 3> 4> 5> 6> 7>

using target database control file instead of recovery catalog

allocated channel: disk1

channel disk1: SID=84 device type=DISK

 

allocated channel: disk2

channel disk2: SID=36 device type=DISK

Starting Duplicate Db at 15-MAY-20

contents of Memory Script:

{

   restore clone standby controlfile;

}

executing Memory Script

Starting restore at 15-MAY-20

channel disk2: starting datafile backup set restore

channel disk2: restoring control file

channel disk2: reading from backup piece /u01/app/oracle/fast_recovery_area/dbwrprd/DBWRPRD/autobackup/2020_05_15/o1_mf_s_1040501505_hcxbk9bn_.bkp

channel disk2: ORA-19870: error while restoring backup piece /u01/app/oracle/fast_recovery_area/dbwrprd/DBWRPRD/autobackup/2020_05_15/o1_mf_s_1040501505_hcxbk9bn_.bkp

ORA-19505: failed to identify file "/u01/app/oracle/fast_recovery_area/dbwrprd/DBWRPRD/autobackup/2020_05_15/o1_mf_s_1040501505_hcxbk9bn_.bkp"

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 7

failover to previous backup

channel disk2: starting datafile backup set restore

channel disk2: restoring control file

channel disk2: reading from backup piece /u01/backup/DBWRPRD_C_20200515_05v09inq

channel disk2: piece handle=/u01/backup/DBWRPRD_C_20200515_05v09inq tag=TAG20200515T200910

channel disk2: restored backup piece 1

channel disk2: restore complete, elapsed time: 00:02:26

output file name=/u01/app/oracle/oradata/dbwrstd/control01.ctl

output file name=/u01/app/oracle/fast_recovery_area/dbwrstd/control02.ctl

Finished restore at 15-MAY-20

contents of Memory Script:

{

   sql clone 'alter database mount standby database';

}

executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:

{

   set newname for tempfile  1 to

 "/u01/app/oracle/oradata/dbwrstd/temp01.dbf";

   switch clone tempfile all;

   set newname for datafile  1 to

 "/u01/app/oracle/oradata/dbwrstd/system01.dbf";

   set newname for datafile  3 to

 "/u01/app/oracle/oradata/dbwrstd/sysaux01.dbf";

   set newname for datafile  4 to

 "/u01/app/oracle/oradata/dbwrstd/undotbs01.dbf";

   set newname for datafile  7 to

 "/u01/app/oracle/oradata/dbwrstd/users01.dbf";

   restore

   clone database

   ;

}

executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/dbwrstd/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 15-MAY-20

channel disk2: starting datafile backup set restore

channel disk2: specifying datafile(s) to restore from backup set

channel disk2: restoring datafile 00001 to /u01/app/oracle/oradata/dbwrstd/system01.dbf

channel disk2: restoring datafile 00003 to /u01/app/oracle/oradata/dbwrstd/sysaux01.dbf

channel disk2: restoring datafile 00004 to /u01/app/oracle/oradata/dbwrstd/undotbs01.dbf

channel disk2: restoring datafile 00007 to /u01/app/oracle/oradata/dbwrstd/users01.dbf

channel disk2: reading from backup piece /u01/backup/DBWRPRD_D_20200515_04v09ij7_s4_p1

channel disk2: piece handle=/u01/backup/DBWRPRD_D_20200515_04v09ij7_s4_p1 tag=TAG20200515T200910

channel disk2: restored backup piece 1

channel disk2: restore complete, elapsed time: 00:06:06

Finished restore at 15-MAY-20

contents of Memory Script:

{

   switch clone datafile all;

}

executing Memory Script

datafile 1 switched to datafile copy

input datafile copy RECID=1 STAMP=1040505408 file name=/u01/app/oracle/oradata/dbwrstd/system01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=2 STAMP=1040505408 file name=/u01/app/oracle/oradata/dbwrstd/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=3 STAMP=1040505408 file name=/u01/app/oracle/oradata/dbwrstd/undotbs01.dbf

datafile 7 switched to datafile copy

input datafile copy RECID=4 STAMP=1040505408 file name=/u01/app/oracle/oradata/dbwrstd/users01.dbf

Finished Duplicate Db at 15-MAY-20

released channel: disk1

released channel: disk2

RMAN>

 

 

 

5. Start Apply MRP Process

Start the apply process on standby server.

 

# Background redo apply. Control is returned to the session once the apply process is started.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

 

#If you need to cancel the apply process, issue the following command.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

 

6. check the standby sync status

 

[oracle@Prod22 trace]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri May 15 22:41:54 2020

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

Connected to:

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

 

SQL> SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"

FROM

(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,

(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL

WHERE

ARCH.THREAD# = APPL.THREAD#

ORDER BY 1;

 

    Thread Last Sequence Received Last Sequence Applied Difference

---------- ---------------------- --------------------- ----------

                 1                                             8                                    8        0

No comments:

Table import and export.

Create Data Pump Directory. The first step in Oracle Data Pump is to create an OS level directory which will be used by Oracle for perform...