Thursday, August 18, 2022

DR database or Standby database build is very easy

DR database or Standby database build is very easy:


Primary:
DB: ORCL
OH: /u01/app/oracle/product/19.0.0.0/dbhome_1
Hostname: oracledb.localdomain.com

Standby:
DB: ORCLSB
OH: /u01/app/oracle/product/19.0.0.0/dbhome_1
Hostname: oraclesb.localdomain.com

High Level Steps:

1. Prechecks on primary and Standby Servers:
2. Check listener.ora and tnsnames.ora on primary and Standby Servers:
3. Verify tnsping on primary and Standby Servers:
4. Copy Primary password file to standby:
5. Create standby init/pfile and start the standby instance in nomount mode:
6. Verify password connectivity for both Primary and standby:
7. Set the standby parameters at Primary and standby redologs:
8. Take Primary database backup:
9. Build Standby database:
10. Enable log shipping:
11. Verify the Primary and Standby sync status:

1. Prechecks on primary and Standby Servers:

Primary:
ps -ef|grep smon
hostname -f

Standby:
ps -ef|grep smon
hostname -f

Primary:
. oraenv
ORCL
/u01/app/oracle/product/19.0.0.0/dbhome_1
env |grep ORA
sqlplus / as sysdba
archive log list
select FORCE_LOGGING,log_mode from v$database;


2. Check listener.ora and tnsnames.ora on primary and Standby Servers:

Primary:
cd $ORACLE_HOME/network/admin
cat listener.ora
cat tnsnames.ora
lsnrctl status LISTENER_ORCL
lsnrctl start LISTENER_ORCL

Standby:
. oraenv
ORCLSB
/u01/app/oracle/product/19.0.0.0/dbhome_1
cd $ORACLE_HOME/network/admin
cat listener.ora
cat tnsnames.ora
lsnrctl status LISTENER_ORCLSB
lsnrctl start LISTENER_ORCLSB

3. Verify tnsping on primary and Standby Servers:

Primary:
tnsping ORCL
tnsping ORCLSB

Standby:
tnsping ORCL
tnsping ORCLSB

4. Copy Primary password file to standby:

Primary:
cd $ORACLE_HOME/dbs
ls -ltr orapwORCL
scp orapwORCL oracle@standbyserver:/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/orapwORCLSB

Standby:
cd $ORACLE_HOME/dbs
ls -l orapwORCLSB

5. Create standby init/pfile and start the standby instance in nomount mode:

Standby:
cat initORCLSB.ora
db_name=ORCL
db_unique_name=ORCLSB

. oraenv
ORCLSB
/u01/app/oracle/product/19.0.0.0/dbhome_1
env |grep ORA

sqlplus / as sysdba
startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initORCLSB.ora';

6. Verify password connectivity for both Primary and standby:

Primary:
sqlplus sys/Mallik123@ORCL as sysdba
select instance_name, status from v$instance;

sqlplus sys/Mallik123@ORCLSB as sysdba
select instance_name, status from v$instance;

Standby:
sqlplus sys/Mallik123@ORCL as sysdba
select instance_name, status from v$instance;

sqlplus sys/Mallik123@ORCLSB as sysdba
select instance_name, status from v$instance;

7. Set the standby parameters at Primary and standby redologs:

Primary:
ALTER SYSTEM SET db_unique_name='ORCL' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_config='dg_config=(ORCL,ORCLSB)' SCOPE=BOTH;

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

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

ALTER SYSTEM SET fal_server='ORCLSB' SCOPE=SPFILE;
ALTER SYSTEM SET fal_client='ORCL' SCOPE=SPFILE;

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

ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile' SCOPE=SPFILE;
ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog' SCOPE=SPFILE;

show parameter db_unique_name
show parameter log_archive_config
show parameter log_archive_dest_1
show parameter log_archive_dest_2
show parameter fal
show parameter standby_file_management
show parameter db_file_name_convert
show parameter log_file_name_convert

set pages 1000
set lines 1000
col INSTANCE for a10
col member for a75
SELECT t.INSTANCE, l.THREAD#, l.GROUP#,  l.SEQUENCE#, l.bytes, l.archived, l.status, lf.MEMBER
FROM v$log l, v$logfile lf, v$thread t
WHERE t.THREAD# = l.THREAD#
AND l.GROUP# = lf.GROUP#
ORDER BY l.THREAD#, GROUP#;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo01.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo01_1.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo02.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo02_2.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 6 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo03.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo03_3.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 7 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo04.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo04_4.log') SIZE 200M;

set pages 1000
set lines 1000
col DBID for a10
select * from v$standby_log;

8. Take Primary database backup:

Primary:
rman target /
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck backup;
crosscheck archivelog all;
DELETE noprompt archivelog all COMPLETED BEFORE 'SYSDATE-7';
backup as backupset incremental level 0 database format '/u01/backup/Fullback_%T_%U'
plus archivelog format '/u01/backup/Archive_%T_%U';
backup current controlfile format '/u01/backup/Controlback_%T_%U';
release channel ch1;
release channel ch2;
}

cd /u01/backup
ls -l

scp * oracle@10.38.4.118:/u01/backup/

Standby:
cd /u01/backup
ls -l

9. Build Standby database:

Option1:
standby build using active database duplication with backup

rman target sys/Mallik123@ORCL
connect auxiliary sys/Mallik123@ORCLSB
run
{
allocate channel p1 type disk;
allocate channel p2 type disk;
allocate channel p3 type disk;
allocate channel p4 type disk;
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
allocate auxiliary channel s3 type disk;
allocate auxiliary channel s4 type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'ORCL','ORCLSB'
set db_name='ORCL'
set db_unique_name='ORCLSB'
set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
;
}

Option2:
standby build using backup based database duplication
rman auxiliary sys/Mallik123@ORCLSB
run
{
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
allocate auxiliary channel s3 type disk;
allocate auxiliary channel s4 type disk;
DUPLICATE TARGET DATABASE FOR STANDBY
SPFILE
parameter_value_convert 'ORCL','ORCLSB'
set db_name='ORCL'
set db_unique_name='ORCLSB'
set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
BACKUP LOCATION '/u01/backup/' nofilenamecheck
;
}

10. Enable log shipping

sqlplus / as sysdba
SELECT name,database_role FROM v$database;
show parameter fal
alter system set fal_server=ORCL scope=both;
show parameter fal

Start mrp:
Standby:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session; --- arc/mrp apply
alter database recover managed standby database using current logfile disconnect from session; --- real time apply 

alter database recover managed standby database cancel;

SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=6770;

Primary:
alter system set log_archive_dest_state_2=DEFER scope=both sid='*';
alter system set log_archive_dest_state_2=enable scope=both sid='*';

11. Verify the Primary and Standby sync status:

Primary:
archive log list;
alter system switch logfile;
SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=6370;

Standby:
sqlplus / as sysdba
SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=6370;


log:

[oracle@oracledb archivelog]$ ps -ef|grep smon
oracle   22431     1  0 23:09 ?        00:00:00 ora_smon_ORCL
oracle   24508 19837  0 23:14 pts/1    00:00:00 grep --color=auto smon
[oracle@oracledb archivelog]$
[oracle@oracledb archivelog]$ hostname
oracledb.localdomain.com
[oracle@oracledb archivelog]$

[oracle@oraclesb onlinelog]$ ps -ef|grep smon
oracle    7608  6665  0 23:16 pts/1    00:00:00 grep --color=auto smon
[oracle@oraclesb onlinelog]$
[oracle@oraclesb onlinelog]$ hostname -f
oraclesb.localdomain.com
[oracle@oraclesb onlinelog]$

[oracle@oracledb admin]$ env |grep ORA
ORACLE_SID=ORCL
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oracledb admin]$

[oracle@oracledb archivelog]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:15:00 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5970
Next log sequence to archive   5970
Current log sequence           5972
SQL>
SQL> select FORCE_LOGGING,log_mode from v$database;

FORCE_LOGGING                           LOG_MODE
--------------------------------------- ------------
YES                                     ARCHIVELOG

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[oracle@oracledb archivelog]$
[oracle@oracledb archivelog]$ cd $ORACLE_HOME/network/admin
[oracle@oracledb admin]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin
[oracle@oracledb admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

ADR_BASE_LISTENER_ORCL = /u01/app/oracle

LISTENER_ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.localdomain.com)(PORT = 1522))
  )

[oracle@oracledb admin]$ cat tnsnames.ora
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.localdomain.com)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )

ORCLSB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oraclesb.localdomain.com)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCLSB)
    )
  )
[oracle@oracledb admin]$

[oracle@oracledb admin]$ lsnrctl status LISTENER_ORCL

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:16:17

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracledb.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_ORCL
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                20-JAN-2022 09:46:47
Uptime                    205 days 13 hr. 29 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracledb/listener_orcl/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb.localdomain.com)(PORT=1522)))
Services Summary...
Service "ORCL" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
  Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracledb admin]$

[oracle@oraclesb admin]$ ps -ef|grep tns
root        35     2  0 Jul05 ?        00:00:00 [netns]
oracle    4871     1  0 Aug04 ?        00:00:12 /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/tnslsnr LISTENER_ORCLSB -inherit
oracle    7804  6665  0 23:19 pts/1    00:00:00 grep --color=auto tns
[oracle@oraclesb admin]$

[oracle@oraclesb onlinelog]$ cd $ORACLE_HOME/network/admin
[oracle@oraclesb admin]$
[oracle@oraclesb admin]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin
[oracle@oraclesb admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER_ORCLSB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclesb.localdomain.com)(PORT = 1522))
  )

ADR_BASE_LISTENER_ORCLSB = /u01/app/oracle

SID_LIST_LISTENER_ORCLSB =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCLSB)
      (ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1)
      (SID_NAME = ORCLSB)
    )
  )
[oracle@oraclesb admin]$
[oracle@oraclesb admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCLSB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oraclesb.localdomain.com)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCLSB)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.localdomain.com)(PORT = 1522))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
    )
  )

[oracle@oraclesb admin]$

[oracle@oraclesb admin]$ lsnrctl status LISTENER_ORCLSB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:19:50

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclesb.localdomain.com)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_ORCLSB
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                04-AUG-2022 09:17:05
Uptime                    9 days 14 hr. 2 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oraclesb/listener_orclsb/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclesb.localdomain.com)(PORT=1522)))
Services Summary...
Service "ORCLSB" has 1 instance(s).
  Instance "ORCLSB", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@oraclesb admin]$

[oracle@oracledb admin]$ tnsping ORCL

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:18:05

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

Used parameter files:
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.localdomain.com)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL)))
OK (0 msec)
[oracle@oracledb admin]$
[oracle@oracledb admin]$ tnsping ORCLSB

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:18:09

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

Used parameter files:
/u01/app/oracle/product/19.0.0.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oraclesb.localdomain.com)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = ORCLSB)))
OK (10 msec)
[oracle@oracledb admin]$

[oracle@oracledb admin]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:18:29 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> show parameter local

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      (ADDRESS = (PROTOCOL = TCP)(HO
                                                 ST = oracledb.localdomain.com)
                                                 (PORT = 1522))
parallel_force_local                 boolean     FALSE
SQL>


[oracle@oracledb admin]$ cd $ORACLE_HOME/dbs
[oracle@oracledb dbs]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs
[oracle@oracledb dbs]$ ls -ltr orapw*
-rw-r-----. 1 oracle oinstall 2048 Aug  2  2021 orapwORCL
[oracle@oracledb dbs]$

[oracle@oraclesb admin]$ cd $ORACLE_HOME/dbs
[oracle@oraclesb dbs]$ pwd
/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs
[oracle@oraclesb dbs]$ ls -l orapw*
-rw-r-----. 1 oracle oinstall 2048 Aug  4 10:17 orapwORCLSB
[oracle@oraclesb dbs]$

[oracle@oraclesb dbs]$ cat initORCLSB.ora
db_name=ORCL
db_unique_name=ORCLSB
[oracle@oraclesb dbs]$

[oracle@oraclesb dbs]$ . oraenv
ORACLE_SID = [ORCLSB] ?
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@oraclesb dbs]$ env |grep ORA
ORACLE_SID=ORCLSB
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1
[oracle@oraclesb dbs]$

[oracle@oraclesb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:23:54 2022
Version 19.11.0.0.0

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

Connected to an idle instance.

SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/initORCLSB.ora';
ORACLE instance started.

Total System Global Area  322960856 bytes
Fixed Size                  8895960 bytes
Variable Size             239075328 bytes
Database Buffers           67108864 bytes
Redo Buffers                7880704 bytes
SQL>

[oracle@oraclesb dbs]$ tnsping ORCL

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:24:50

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

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb.localdomain.com)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (0 msec)
[oracle@oraclesb dbs]$ tnsping ORCLSB

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 13-AUG-2022 23:24:53

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

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraclesb.localdomain.com)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLSB)))
OK (0 msec)
[oracle@oraclesb dbs]$

[oracle@oracledb dbs]$ sqlplus sys/Mallik123@ORCL as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:22:50 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCL             OPEN

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[oracle@oracledb dbs]$ sqlplus sys/Mallik123@ORCLSB as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:23:14 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCLSB           STARTED

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[oracle@oracledb dbs]$

[oracle@oraclesb dbs]$ sqlplus sys/Mallik123@ORCL as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:25:51 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCL             OPEN

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[oracle@oraclesb dbs]$ sqlplus sys/Mallik123@ORCLSB as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:26:05 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
ORCLSB           STARTED

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[oracle@oraclesb dbs]$

[oracle@oracledb dbs]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Aug 13 23:24:32 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      ORCL
SQL> show parameter log_archive_config

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      dg_config=(ORCL,ORCLSB)
SQL> show parameter log_archive_dest_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      location=use_db_recovery_file_
                                                 dest
log_archive_dest_10                  string
log_archive_dest_11                  string
log_archive_dest_12                  string
log_archive_dest_13                  string
log_archive_dest_14                  string
log_archive_dest_15                  string
log_archive_dest_16                  string
log_archive_dest_17                  string
log_archive_dest_18                  string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_19                  string
SQL> show parameter log_archive_dest_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string      service=ORCLSB async valid_for
                                                 =(online_logfiles,primary_role
                                                 ) db_unique_name=ORCLSB
log_archive_dest_20                  string
log_archive_dest_21                  string
log_archive_dest_22                  string
log_archive_dest_23                  string
log_archive_dest_24                  string
log_archive_dest_25                  string
log_archive_dest_26                  string
log_archive_dest_27                  string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_28                  string
log_archive_dest_29                  string
SQL> show parameter fal

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string      ORCL
fal_server                           string      ORCLSB
SQL> show parameter standby_file_management

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      AUTO
SQL> show parameter db_file_name_convert

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string      /u01/app/oracle/oradata/ORCL/d
                                                 atafile, /u01/app/oracle/orada
                                                 ta/ORCLSB/datafile
pdb_file_name_convert                string
SQL> show parameter log_file_name_convert

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_file_name_convert                string      /u01/app/oracle/oradata/ORCL/o
                                                 nlinelog, /u01/app/oracle/orad
                                                 ata/ORCLSB/onlinelog, /u01/app
                                                 /oracle/fast_recovery_area/ORC
                                                 L/onlinelog, /u01/app/oracle/f
                                                 ast_recovery_area/ORCLSB/onlin
                                                 elog
SQL>

ALTER SYSTEM SET db_unique_name='ORCL' SCOPE=SPFILE;
ALTER SYSTEM SET log_archive_config='dg_config=(ORCL,ORCLSB)' SCOPE=BOTH;

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

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

ALTER SYSTEM SET fal_server='ORCLSB' SCOPE=SPFILE;
ALTER SYSTEM SET fal_client='ORCL' SCOPE=SPFILE;

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

ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile' SCOPE=SPFILE;
ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog' SCOPE=SPFILE;

SQL> set pages 1000
set lines 1000
col INSTANCE for a10
SQL> SQL> SQL> col member for a75
SQL> SELECT t.INSTANCE, l.THREAD#, l.GROUP#,  l.SEQUENCE#, l.bytes, l.archived, l.status, lf.MEMBER
  2  FROM v$log l, v$logfile lf, v$thread t
  3  WHERE t.THREAD# = l.THREAD#
  4  AND l.GROUP# = lf.GROUP#
  5  ORDER BY l.THREAD#, GROUP#;

INSTANCE      THREAD#     GROUP#  SEQUENCE#      BYTES ARC STATUS           MEMBER
---------- ---------- ---------- ---------- ---------- --- ---------------- ---------------------------------------------------------------------------
ORCL                1          1       5971  209715200 NO  INACTIVE         /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_1_k90p82vd_.log
ORCL                1          1       5971  209715200 NO  INACTIVE         /u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_1_k90p8306_.log
ORCL                1          2       5972  209715200 NO  CURRENT          /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_2_k90p84vy_.log
ORCL                1          2       5972  209715200 NO  CURRENT          /u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_2_k90p850w_.log
ORCL                1          3       5970  209715200 NO  INACTIVE         /u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_3_k90p8704_.log
ORCL                1          3       5970  209715200 NO  INACTIVE         /u01/app/oracle/fast_recovery_area/ORCL/onlinelog/o1_mf_3_k90p8749_.log

6 rows selected.

SQL>

SQL> set pages 1000
set lines 1000
col DBID for a10
select * from v$standby_log;SQL> SQL> SQL>

    GROUP# DBID          THREAD#  SEQUENCE#      BYTES  BLOCKSIZE       USED ARC STATUS     FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME LAST_CHANGE# LAST_TIME     CON_ID
---------- ---------- ---------- ---------- ---------- ---------- ---------- --- ---------- ------------- --------- ------------ --------- ------------ --------- ----------
         4 UNASSIGNED          1          0  209715200        512          0 YES UNASSIGNED                                                                                0
         5 UNASSIGNED          1          0  209715200        512          0 YES UNASSIGNED                                                                                0
         6 UNASSIGNED          1          0  209715200        512          0 YES UNASSIGNED                                                                                0
         7 UNASSIGNED          1          0  209715200        512          0 YES UNASSIGNED                                                                                0
SQL>

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo01.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo01_1.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo02.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo02_2.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 6 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo03.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo03_3.log') SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 7 ('/u01/app/oracle/oradata/ORCL/onlinelog/standby_redo04.log','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog/standby_redo04_4.log') SIZE 200M;

Backup:
rman target /
run {
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
crosscheck backup;
crosscheck archivelog all;
DELETE noprompt archivelog all COMPLETED BEFORE 'SYSDATE-7';
backup as backupset incremental level 0 database format '/u01/backup/Fullback_%T_%U'
plus archivelog format '/u01/backup/Archive_%T_%U';
backup current controlfile format '/u01/backup/Controlback_%T_%U';
release channel ch1;
release channel ch2;
}

[oracle@oracledb backup]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sat Aug 13 23:51:14 2022
Version 19.11.0.0.0

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

connected to target database: ORCL (DBID=1607315920)

RMAN> run {
2> allocate channel ch1 device type disk;
3> allocate channel ch2 device type disk;
4> crosscheck backup;
crosscheck archivelog all;
5> 6> DELETE noprompt archivelog all COMPLETED BEFORE 'SYSDATE-7';
backup as backupset incremental level 0 database format '/u01/backup/Fullback_%T_%U'
7> plus archivelog format '/u01/backup/Archive_%T_%U';
backup current controlfile format '/u01/backup/Controlback_%T_%U';
8> 9> release channel ch1;
10> 11> release channel ch2;
}12>

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=269 device type=DISK

allocated channel: ch2
channel ch2: SID=393 device type=DISK

crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/tmp/ForStandby_gd14d0jl_10765_1_1 RECID=10038 STAMP=1111917174
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/tmp/ForStandby_ge14d0jp_10766_1_1 RECID=10039 STAMP=1111917178
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2022_08_05/o1_mf_s_1111917388_kgs6zo2y_.bkp RECID=10040 STAMP=1111917389
Crosschecked 2 objects

crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2022_08_13/o1_mf_s_1112658521_khhtr1n5_.bkp RECID=10071 STAMP=1112658521
Crosschecked 2 objects


validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5970_khhtgr0x_.arc RECID=1864 STAMP=1112658224
validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5971_khhtdynh_.arc RECID=1863 STAMP=1112658166
validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5972_khhtgr2w_.arc RECID=1865 STAMP=1112658224
validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5973_khhtljgg_.arc RECID=1866 STAMP=1112658344
validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5974_khhtqf1t_.arc RECID=1867 STAMP=1112658501
Crosschecked 3 objects

validation succeeded for archived log
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2022_08_13/o1_mf_1_5975_khhtqz0c_.arc RECID=1868 STAMP=1112658519
Crosschecked 3 objects




Starting backup at 13-AUG-22
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5970 RECID=1864 STAMP=1112658224
input archived log thread=1 sequence=5971 RECID=1863 STAMP=1112658166
input archived log thread=1 sequence=5972 RECID=1865 STAMP=1112658224
input archived log thread=1 sequence=5973 RECID=1866 STAMP=1112658344
channel ch1: starting piece 1 at 13-AUG-22
channel ch2: starting archived log backup set
channel ch2: specifying archived log(s) in backup set
input archived log thread=1 sequence=5974 RECID=1867 STAMP=1112658501
input archived log thread=1 sequence=5975 RECID=1868 STAMP=1112658519
input archived log thread=1 sequence=5976 RECID=1869 STAMP=1112658688
channel ch2: starting piece 1 at 13-AUG-22
channel ch1: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Archive_20220813_hm153ko0_10806_1_1 tag=TAG20220813T235128 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
channel ch2: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Archive_20220813_hn153ko0_10807_1_1 tag=TAG20220813T235128 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:01
Finished backup at 13-AUG-22

Starting backup at 13-AUG-22
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_k3jps1mq_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf
channel ch1: starting piece 1 at 13-AUG-22
channel ch2: starting incremental level 0 datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_k3jprllp_.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_k3jpsqnf_.dbf
channel ch2: starting piece 1 at 13-AUG-22
channel ch1: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Fullback_20220813_ho153ko1_10808_1_1 tag=TAG20220813T235129 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:15
channel ch1: starting incremental level 0 datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/app/oracle/oradata/ORCL/datafile/test_16k_ts01.dbf
channel ch1: starting piece 1 at 13-AUG-22
channel ch2: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Fullback_20220813_hp153ko1_10809_1_1 tag=TAG20220813T235129 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:15
channel ch1: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Fullback_20220813_hq153kog_10810_1_1 tag=TAG20220813T235129 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-AUG-22

Starting backup at 13-AUG-22
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5977 RECID=1870 STAMP=1112658706
channel ch1: starting piece 1 at 13-AUG-22
channel ch1: finished piece 1 at 13-AUG-22
piece handle=/u01/backup/Archive_20220813_hr153koi_10811_1_1 tag=TAG20220813T235146 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-AUG-22

Starting backup at 13-AUG-22
channel ch1: starting datafile copy
copying current control file
output file name=/u01/backup/Controlback_20220813_cf_D-ORCL_id-1607315920_hs153koj tag=TAG20220813T235147 RECID=970 STAMP=1112658707
channel ch1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 13-AUG-22

Starting Control File and SPFILE Autobackup at 13-AUG-22
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/autobackup/2022_08_13/o1_mf_s_1112658708_khhtxwly_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 13-AUG-22

released channel: ch1

released channel: ch2

RMAN> exit


Recovery Manager complete.
[oracle@oracledb backup]$ pwd
/u01/backup
[oracle@oracledb backup]$ ll
total 2281296
-rw-r-----. 1 oracle oinstall   48598528 Aug 13 23:51 Archive_20220813_hm153ko0_10806_1_1
-rw-r-----. 1 oracle oinstall   20655104 Aug 13 23:51 Archive_20220813_hn153ko0_10807_1_1
-rw-r-----. 1 oracle oinstall      13824 Aug 13 23:51 Archive_20220813_hr153koi_10811_1_1
-rw-r-----. 1 oracle oinstall   26034176 Aug 13 23:51 Controlback_20220813_cf_D-ORCL_id-1607315920_hs153koj
-rw-r-----. 1 oracle oinstall 1298079744 Aug 13 23:51 Fullback_20220813_ho153ko1_10808_1_1
-rw-r-----. 1 oracle oinstall  942481408 Aug 13 23:51 Fullback_20220813_hp153ko1_10809_1_1
-rw-r-----. 1 oracle oinstall     180224 Aug 13 23:51 Fullback_20220813_hq153kog_10810_1_1
[oracle@oracledb backup]$

[oracle@oracledb backup]$ scp * oracle@10.38.4.118:/u01/backup/
oracle@10.38.4.118's password:
Archive_20220813_hm153ko0_10806_1_1                                                                                                                    100%   46MB  87.2MB/s   00:00
Archive_20220813_hn153ko0_10807_1_1                                                                                                                    100%   20MB  92.6MB/s   00:00
Archive_20220813_hr153koi_10811_1_1                                                                                                                    100%   14KB   2.5MB/s   00:00
Controlback_20220813_cf_D-ORCL_id-1607315920_hs153koj                                                                                                  100%   25MB  92.3MB/s   00:00
Fullback_20220813_ho153ko1_10808_1_1                                                                                                                   100% 1238MB 123.8MB/s   00:10
Fullback_20220813_hp153ko1_10809_1_1                                                                                                                   100%  899MB 112.3MB/s   00:08
Fullback_20220813_hq153kog_10810_1_1                                                                                                                   100%  176KB  46.6MB/s   00:00
[oracle@oracledb backup]$

[oracle@oraclesb backup]$ ll
total 2281296
-rw-r-----. 1 oracle oinstall   48598528 Aug 13 23:55 Archive_20220813_hm153ko0_10806_1_1
-rw-r-----. 1 oracle oinstall   20655104 Aug 13 23:55 Archive_20220813_hn153ko0_10807_1_1
-rw-r-----. 1 oracle oinstall      13824 Aug 13 23:55 Archive_20220813_hr153koi_10811_1_1
-rw-r-----. 1 oracle oinstall   26034176 Aug 13 23:55 Controlback_20220813_cf_D-ORCL_id-1607315920_hs153koj
-rw-r-----. 1 oracle oinstall 1298079744 Aug 13 23:55 Fullback_20220813_ho153ko1_10808_1_1
-rw-r-----. 1 oracle oinstall  942481408 Aug 13 23:56 Fullback_20220813_hp153ko1_10809_1_1
-rw-r-----. 1 oracle oinstall     180224 Aug 13 23:56 Fullback_20220813_hq153kog_10810_1_1
[oracle@oraclesb backup]$

Option1:
rman target sys/Mallik123@ORCL
connect auxiliary sys/Mallik123@ORCLSB

run
{
allocate channel p1 type disk;
allocate channel p2 type disk;
allocate channel p3 type disk;
allocate channel p4 type disk;
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
allocate auxiliary channel s3 type disk;
allocate auxiliary channel s4 type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'ORCL','ORCLSB'
set db_name='ORCL'
set db_unique_name='ORCLSB'
set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
;
}

[oracle@oraclesb ~]$ rman target sys/Mallik123@ORCL

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Aug 14 00:37:29 2022
Version 19.11.0.0.0

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

connected to target database: ORCL (DBID=1607315920)

RMAN> connect auxiliary sys/Mallik123@ORCLSB

connected to auxiliary database: ORCL (not mounted)

RMAN> run
{
allocate channel p1 type disk;
2> 3> allocate channel p2 type disk;
allocate channel p3 type disk;
4> 5> allocate channel p4 type disk;
6> 7> allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
8> allocate auxiliary channel s3 type disk;
9> allocate auxiliary channel s4 type disk;
10> 11> duplicate target database for standby from active database
12> spfile
parameter_value_convert 'ORCL','ORCLSB'
13> 14> set db_name='ORCL'
15> set db_unique_name='ORCLSB'
16> set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
17> 18> ;
}19>

using target database control file instead of recovery catalog
allocated channel: p1
channel p1: SID=23 device type=DISK

allocated channel: p2
channel p2: SID=390 device type=DISK

allocated channel: p3
channel p3: SID=276 device type=DISK

allocated channel: p4
channel p4: SID=395 device type=DISK

allocated channel: s1
channel s1: SID=10 device type=DISK

allocated channel: s2
channel s2: SID=150 device type=DISK

allocated channel: s3
channel s3: SID=294 device type=DISK

allocated channel: s4
channel s4: SID=434 device type=DISK

Starting Duplicate Db at 14-AUG-22

contents of Memory Script:
{
   backup as copy reuse
   passwordfile auxiliary format  '/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/orapwORCLSB'   ;
   restore clone from service  'ORCL' spfile to
 '/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora';
   sql clone "alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora''";
}
executing Memory Script

Starting backup at 14-AUG-22
Finished backup at 14-AUG-22

Starting restore at 14-AUG-22

channel s1: starting datafile backup set restore
channel s1: using network backup set from service ORCL
channel s1: restoring SPFILE
output file name=/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora
channel s1: restore complete, elapsed time: 00:00:01
Finished restore at 14-AUG-22

sql statement: alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora''

contents of Memory Script:
{
   sql clone "alter system set  audit_file_dest =
 ''/u01/app/oracle/admin/ORCLSB/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=ORCLSBXDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_client =
 ''ORCLSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''ORCLSBSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCLSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/u01/app/oracle/oradata/ORCL/datafile'', ''/u01/app/oracle/oradata/ORCLSB/datafile'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/u01/app/oracle/oradata/ORCL/onlinelog'', ''/u01/app/oracle/oradata/ORCLSB/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCL/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/ORCLSB/adump'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment= '''' scope=spfile

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=ORCLSBXDB)'' comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''ORCLSB'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''ORCLSBSB'' comment= '''' scope=spfile

sql statement: alter system set  db_name =  ''ORCL'' comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''ORCLSB'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/u01/app/oracle/oradata/ORCL/datafile'', ''/u01/app/oracle/oradata/ORCLSB/datafile'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/u01/app/oracle/oradata/ORCL/onlinelog'', ''/u01/app/oracle/oradata/ORCLSB/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCL/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3707763112 bytes

Fixed Size                     8903080 bytes
Variable Size                704643072 bytes
Database Buffers            2986344448 bytes
Redo Buffers                   7872512 bytes
allocated channel: s1
channel s1: SID=261 device type=DISK
allocated channel: s2
channel s2: SID=379 device type=DISK
allocated channel: s3
channel s3: SID=10 device type=DISK
allocated channel: s4
channel s4: SID=137 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  control_files =
  ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   restore clone from service  'ORCL' standby controlfile;
}
executing Memory Script

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment= ''Set by RMAN'' scope=spfile

Starting restore at 14-AUG-22

channel s1: starting datafile backup set restore
channel s1: using network backup set from service ORCL
channel s1: restoring control file
channel s1: restore complete, elapsed time: 00:00:02
output file name=/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl
output file name=/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl
Finished restore at 14-AUG-22

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/ORCLSB/datafile/o1_mf_temp_k9ng3t4v_.tmp";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_k3jprllp_.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_k3jps1mq_.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf";
   set newname for datafile  7 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_k3jpsqnf_.dbf";
   restore
   from  nonsparse   from service
 'ORCL'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_temp_k9ng3t4v_.tmp in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 14-AUG-22

channel s1: starting datafile backup set restore
channel s1: using network backup set from service ORCL
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00001 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_k3jprllp_.dbf
channel s2: starting datafile backup set restore
channel s2: using network backup set from service ORCL
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00003 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_k3jps1mq_.dbf
channel s3: starting datafile backup set restore
channel s3: using network backup set from service ORCL
channel s3: specifying datafile(s) to restore from backup set
channel s3: restoring datafile 00004 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf
channel s4: starting datafile backup set restore
channel s4: using network backup set from service ORCL
channel s4: specifying datafile(s) to restore from backup set
channel s4: restoring datafile 00005 to /u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf
channel s4: restore complete, elapsed time: 00:00:01
channel s4: starting datafile backup set restore
channel s4: using network backup set from service ORCL
channel s4: specifying datafile(s) to restore from backup set
channel s4: restoring datafile 00007 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_k3jpsqnf_.dbf
channel s4: restore complete, elapsed time: 00:00:03
channel s3: restore complete, elapsed time: 00:00:09
channel s1: restore complete, elapsed time: 00:00:17
channel s2: restore complete, elapsed time: 00:00:17
Finished restore at 14-AUG-22

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=971 STAMP=1112661539 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_khhxoty2_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=972 STAMP=1112661539 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_khhxov0r_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=973 STAMP=1112661539 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_khhxov2o_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=974 STAMP=1112661539 file name=/u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=975 STAMP=1112661539 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_khhxow6n_.dbf
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Finished Duplicate Db at 14-AUG-22
released channel: p1
released channel: p2
released channel: p3
released channel: p4
released channel: s1
released channel: s2
released channel: s3
released channel: s4

RMAN> exit


Recovery Manager complete.
[oracle@oraclesb ~]$


Option2:
rman auxiliary sys/Mallik123@ORCLSB

run
{
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
allocate auxiliary channel s3 type disk;
allocate auxiliary channel s4 type disk;
DUPLICATE TARGET DATABASE FOR STANDBY
SPFILE
parameter_value_convert 'ORCL','ORCLSB'
set db_name='ORCL'
set db_unique_name='ORCLSB'
set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
BACKUP LOCATION '/u01/backup/' nofilenamecheck
;
}

[oracle@oraclesb backup]$ rman auxiliary sys/Mallik123@ORCLSB

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Aug 14 00:27:07 2022
Version 19.11.0.0.0

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

connected to auxiliary database: ORCL (not mounted)

RMAN> run
{
allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
2> 3> allocate auxiliary channel s3 type disk;
4> 5> allocate auxiliary channel s4 type disk;
6> 7> DUPLICATE TARGET DATABASE FOR STANDBY
SPFILE
parameter_value_convert 'ORCL','ORCLSB'
8> 9> 10> set db_name='ORCL'
set db_unique_name='ORCLSB'
11> 12> set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
13> 14> BACKUP LOCATION '/u01/backup/' nofilenamecheck
;
15> 16> }

allocated channel: s1
channel s1: SID=10 device type=DISK

allocated channel: s2
channel s2: SID=150 device type=DISK

allocated channel: s3
channel s3: SID=293 device type=DISK

allocated channel: s4
channel s4: SID=435 device type=DISK

Starting Duplicate Db at 14-AUG-22
released channel: s1
released channel: s2
released channel: s3
released channel: s4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 08/14/2022 00:27:16
RMAN-05501: aborting duplication of target database
RMAN-05569: SPFILE backup not found in /u01/backup/

RMAN>


[oracle@oracledb backup]$ scp /u01/app/oracle/fast_recovery_area/ORCL/autobackup/2022_08_13/o1_mf_s_1112658708_khhtxwly_.bkp oracle@10.38.4.118:/u01/backup/
oracle@10.38.4.118's password:
o1_mf_s_1112658708_khhtxwly_.bkp                                                                                                                       100%   25MB  90.3MB/s   00:00
You have new mail in /var/spool/mail/oracle
[oracle@oracledb backup]$

[oracle@oraclesb backup]$ ls -ltr
total 2306832
-rw-r-----. 1 oracle oinstall   48598528 Aug 13 23:55 Archive_20220813_hm153ko0_10806_1_1
-rw-r-----. 1 oracle oinstall   20655104 Aug 13 23:55 Archive_20220813_hn153ko0_10807_1_1
-rw-r-----. 1 oracle oinstall      13824 Aug 13 23:55 Archive_20220813_hr153koi_10811_1_1
-rw-r-----. 1 oracle oinstall   26034176 Aug 13 23:55 Controlback_20220813_cf_D-ORCL_id-1607315920_hs153koj
-rw-r-----. 1 oracle oinstall 1298079744 Aug 13 23:55 Fullback_20220813_ho153ko1_10808_1_1
-rw-r-----. 1 oracle oinstall  942481408 Aug 13 23:56 Fullback_20220813_hp153ko1_10809_1_1
-rw-r-----. 1 oracle oinstall     180224 Aug 13 23:56 Fullback_20220813_hq153kog_10810_1_1
-rw-r-----. 1 oracle oinstall   26148864 Aug 14 00:28 o1_mf_s_1112658708_khhtxwly_.bkp
[oracle@oraclesb backup]$

[oracle@oraclesb backup]$ rman auxiliary sys/Mallik123@ORCLSB

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Aug 14 00:30:08 2022
Version 19.11.0.0.0

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

connected to auxiliary database: ORCL (not mounted)

RMAN> run
{
2> 3> allocate auxiliary channel s1 type disk;
allocate auxiliary channel s2 type disk;
4> allocate auxiliary channel s3 type disk;
5> 6> allocate auxiliary channel s4 type disk;
DUPLICATE TARGET DATABASE FOR STANDBY
7> SPFILE
8> parameter_value_convert 'ORCL','ORCLSB'
9> 10> set db_name='ORCL'
11> set db_unique_name='ORCLSB'
set db_file_name_convert '/u01/app/oracle/oradata/ORCL/datafile','/u01/app/oracle/oradata/ORCLSB/datafile'
12> 13> set log_file_name_convert='/u01/app/oracle/oradata/ORCL/onlinelog','/u01/app/oracle/oradata/ORCLSB/onlinelog','/u01/app/oracle/fast_recovery_area/ORCL/onlinelog','/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'
14> BACKUP LOCATION '/u01/backup/' nofilenamecheck
15> ;
16> }

allocated channel: s1
channel s1: SID=433 device type=DISK

allocated channel: s2
channel s2: SID=10 device type=DISK

allocated channel: s3
channel s3: SID=149 device type=DISK

allocated channel: s4
channel s4: SID=292 device type=DISK

Starting Duplicate Db at 14-AUG-22
searching for database ID
found backup of database ID 1607315920

contents of Memory Script:
{
   restore clone spfile to  '/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora' from
 '/u01/backup/o1_mf_s_1112658708_khhtxwly_.bkp';
   sql clone "alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora''";
}
executing Memory Script

Starting restore at 14-AUG-22

channel s2: skipped, AUTOBACKUP already found
channel s3: skipped, AUTOBACKUP already found
channel s4: skipped, AUTOBACKUP already found
channel s1: restoring spfile from AUTOBACKUP /u01/backup/o1_mf_s_1112658708_khhtxwly_.bkp
channel s1: SPFILE restore from AUTOBACKUP complete
Finished restore at 14-AUG-22

sql statement: alter system set spfile= ''/u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/spfileORCLSB.ora''

contents of Memory Script:
{
   sql clone "alter system set  audit_file_dest =
 ''/u01/app/oracle/admin/ORCLSB/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=ORCLSBXDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_client =
 ''ORCLSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''ORCLSBSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''ORCLSB'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/u01/app/oracle/oradata/ORCL/datafile'', ''/u01/app/oracle/oradata/ORCLSB/datafile'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/u01/app/oracle/oradata/ORCL/onlinelog'', ''/u01/app/oracle/oradata/ORCLSB/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCL/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/ORCLSB/adump'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment= '''' scope=spfile

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=ORCLSBXDB)'' comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''ORCLSB'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''ORCLSBSB'' comment= '''' scope=spfile

sql statement: alter system set  db_name =  ''ORCL'' comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''ORCLSB'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/u01/app/oracle/oradata/ORCL/datafile'', ''/u01/app/oracle/oradata/ORCLSB/datafile'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/u01/app/oracle/oradata/ORCL/onlinelog'', ''/u01/app/oracle/oradata/ORCLSB/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCL/onlinelog'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/onlinelog'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    3707763112 bytes

Fixed Size                     8903080 bytes
Variable Size                704643072 bytes
Database Buffers            2986344448 bytes
Redo Buffers                   7872512 bytes
allocated channel: s1
channel s1: SID=262 device type=DISK
allocated channel: s2
channel s2: SID=379 device type=DISK
allocated channel: s3
channel s3: SID=11 device type=DISK
allocated channel: s4
channel s4: SID=136 device type=DISK

contents of Memory Script:
{
   sql clone "alter system set  control_files =
  ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment=
 ''Set by RMAN'' scope=spfile";
   restore clone standby controlfile from  '/u01/backup/o1_mf_s_1112658708_khhtxwly_.bkp';
}
executing Memory Script

sql statement: alter system set  control_files =   ''/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl'', ''/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl'' comment= ''Set by RMAN'' scope=spfile

Starting restore at 14-AUG-22

channel s2: skipped, AUTOBACKUP already found
channel s3: skipped, AUTOBACKUP already found
channel s4: skipped, AUTOBACKUP already found
channel s1: restoring control file
channel s1: restore complete, elapsed time: 00:00:08
output file name=/u01/app/oracle/oradata/ORCLSB/controlfile/o1_mf_jjhgcrh6_.ctl
output file name=/u01/app/oracle/fast_recovery_area/ORCLSB/controlfile/o1_mf_jjhgcrjw_.ctl
Finished restore at 14-AUG-22

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database
RMAN-05158: WARNING: auxiliary (datafile) file name /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_k3jprllp_.dbf conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (datafile) file name /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_k3jps1mq_.dbf conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (datafile) file name /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (datafile) file name /u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (datafile) file name /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_k3jpsqnf_.dbf conflicts with a file used by the target database
RMAN-05158: WARNING: auxiliary (tempfile) file name /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_temp_k9ng3t4v_.tmp conflicts with a file used by the target database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_temp_k9ng3t4v_.tmp";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_k3jprllp_.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_k3jps1mq_.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf";
   set newname for datafile  7 to
 "/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_k3jpsqnf_.dbf";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_temp_k9ng3t4v_.tmp in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 14-AUG-22

channel s1: starting datafile backup set restore
channel s1: specifying datafile(s) to restore from backup set
channel s1: restoring datafile 00001 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_k3jprllp_.dbf
channel s1: restoring datafile 00007 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_k3jpsqnf_.dbf
channel s1: reading from backup piece /u01/backup/Fullback_20220813_hp153ko1_10809_1_1
channel s2: starting datafile backup set restore
channel s2: specifying datafile(s) to restore from backup set
channel s2: restoring datafile 00003 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_k3jps1mq_.dbf
channel s2: restoring datafile 00004 to /u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_k3jpsjp6_.dbf
channel s2: reading from backup piece /u01/backup/Fullback_20220813_ho153ko1_10808_1_1
channel s3: starting datafile backup set restore
channel s3: specifying datafile(s) to restore from backup set
channel s3: restoring datafile 00005 to /u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf
channel s3: reading from backup piece /u01/backup/Fullback_20220813_hq153kog_10810_1_1
channel s3: piece handle=/u01/backup/Fullback_20220813_hq153kog_10810_1_1 tag=TAG20220813T235129
channel s3: restored backup piece 1
channel s3: restore complete, elapsed time: 00:00:01
channel s1: piece handle=/u01/backup/Fullback_20220813_hp153ko1_10809_1_1 tag=TAG20220813T235129
channel s1: restored backup piece 1
channel s1: restore complete, elapsed time: 00:00:07
channel s2: piece handle=/u01/backup/Fullback_20220813_ho153ko1_10808_1_1 tag=TAG20220813T235129
channel s2: restored backup piece 1
channel s2: restore complete, elapsed time: 00:00:15
Finished restore at 14-AUG-22

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=2 STAMP=1112661082 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_system_khhx7mcm_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=1112661082 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_sysaux_khhx7md2_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=1112661082 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_undotbs1_khhx7mdm_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=1112661082 file name=/u01/app/oracle/oradata/ORCLSB/datafile/test_16k_ts01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=1112661082 file name=/u01/app/oracle/oradata/ORCLSB/datafile/o1_mf_users_khhx7mcq_.dbf
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Oracle error from auxiliary database: ORA-01275: Operation RENAME is not allowed if standby file management is automatic.

RMAN-05535: warning: All redo log files were not defined properly.
Finished Duplicate Db at 14-AUG-22
released channel: s1
released channel: s2
released channel: s3
released channel: s4

RMAN> exit


Recovery Manager complete.
[oracle@oraclesb backup]$ 


[oracle@oraclesb ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 14 00:40:12 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> SELECT name,database_role FROM v$database;

NAME      DATABASE_ROLE
--------- ----------------
ORCL      PHYSICAL STANDBY

SQL> show parameter fal

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string      ORCLSB
fal_server                           string      ORCLSBSB
SQL> alter system set fal_server=ORCL scope=both;

System altered.

SQL> show parameter fal

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string      ORCLSB
fal_server                           string      ORCL
SQL>


Standby:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session; --- arc/mrp apply
alter database recover managed standby database using current logfile disconnect from session; --- real time apply 

alter database recover managed standby database cancel;

SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=6770;

Primary:
alter system set log_archive_dest_state_2=DEFER scope=both sid='*';
alter system set log_archive_dest_state_2=enable scope=both sid='*';


[oracle@oracledb backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 14 00:39:37 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> alter system set log_archive_dest_state_2=enable scope=both sid='*';

System altered.

SQL>


[oracle@oraclesb ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 14 00:40:12 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL>
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE disconnect from session;

Database altered.

SQL>

[oracle@oracledb backup]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 14 00:39:37 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL>
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5979
Next log sequence to archive   5981
Current log sequence           5981
SQL>

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=5979;

 SEQUENCE# FIRST_TIM NEXT_TIME APPLIED
---------- --------- --------- ---------
      5979 14-AUG-22 14-AUG-22 NO
      5980 14-AUG-22 14-AUG-22 NO
      5980 14-AUG-22 14-AUG-22 YES
      5981 14-AUG-22 14-AUG-22 NO
      5981 14-AUG-22 14-AUG-22 YES
      5982 14-AUG-22 14-AUG-22 NO
      5982 14-AUG-22 14-AUG-22 YES
      5983 14-AUG-22 14-AUG-22 NO
      5983 14-AUG-22 14-AUG-22 YES

9 rows selected.

SQL>

[oracle@oraclesb ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Aug 14 00:40:12 2022
Version 19.11.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> 
SQL> SELECT sequence#, first_time, next_time, applied FROM v$archived_log where sequence#>=5979;

 SEQUENCE# FIRST_TIM NEXT_TIME APPLIED
---------- --------- --------- ---------
      5980 14-AUG-22 14-AUG-22 YES
      5981 14-AUG-22 14-AUG-22 YES
      5982 14-AUG-22 14-AUG-22 YES
      5983 14-AUG-22 14-AUG-22 YES

SQL>

Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...