Skip to Main Content
  • Questions
  • Creating Physical standby database using duplicate Database command on Physical Standby machine

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, parul.

Asked: June 13, 2021 - 11:58 pm UTC

Last updated: June 30, 2021 - 2:10 am UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

while Creating a Physical standby database using duplicate Database command on the Physical Standby machine, getting the following error:

Creating the Standby Database
1. Start up the standby instance
# in srv2:
su - oracle
export ORACLE_SID=ORADB_S2
# now start up the instance
sqlplus '/ as sysdba'
STARTUP NOMOUNT
exit
2. Create the standby database online from the primary database. we run the command on standby:

su - oracle
export ORACLE_SID=ORADB_S2

RMAN> CONNECT TARGET sys/oracle@ORADB;

connected to target database (not started)

RMAN> CONNECT AUXILIARY sys/oracle@ORADB_S2;

connected to auxiliary database: ORADB (not mounted)

run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate auxiliary channel stby1 type disk;
DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE
SPFILE
set 'db_unique_name'='ORADB_S2'
set control_files='+DATA/ORADB_S2/control.ctl'
set db_create_file_dest='+DATA'
set db_create_online_log_dest_1='+FRA'
set db_create_online_log_dest_2='+DATA'
set db_recovery_file_dest='+FRA'
set DB_RECOVERY_FILE_DEST_SIZE='10G'
set audit_file_dest='/u01/app/oracle/admin/ORADB_S2/adump'
set core_dump_dest='/u01/app/oracle/admin/ORADB_S2/cdump'
nofilenamecheck;
}

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 06/09/2021 13:46:25
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3640
Additional information: -97553473


Thanks

and Connor said...


RMAN> CONNECT TARGET sys/oracle@ORADB;
connected to target database (not started)


means your production (source) database is not currently running.

If you plan to duplicate from an *active* database, then that database needs to be up.

Also, one more thing to check, which is a common gotcha. Make sure you can do:

RMAN> CONNECT TARGET sys/oracle@ORADB;
RMAN> CONNECT AUXILIARY sys/oracle@ORADB_S2;

successfully from *both* primary and the standby, because we have two-way communication going on between the nodes during the duplication

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

depending on the information, well answered.

parul thakur, June 25, 2021 - 10:27 am UTC

I make sure that the primary database is up and running while running a duplicate command on the standby server. so that was not the issue.

srv1(primary side:

Let me clarify a few more facts that could help you:

The name of database in pfile is oradb(small letters) but in listener.ora (GLOBAL_DBNAME=ORADB)
and (SID_NAME=ORADB) is in capital letters. I am not sure if this could be the reason of physical stand by server is not able to connect or reach to Primary database.

I modified the the database name to small letters in listener.ors.
below is the detail: but note that status was UNKNOWN in both the cases, that could be the issue.

[oracle@srv1 ~]$ lsnrctl stop
[oracle@srv1 ~]$ vi /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv1.localdomain)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=oradb)
(SID_NAME=oradb)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1)
)
)

[oracle@srv1 ~]$ lsntctl start

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 23-JUN-2021 09:32:28

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> start
Starting /u01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/db_1/network/admin/listene r.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/srv1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=srv1.localdomain)(PORT=152 2)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=srv1.localdomain)(PORT=152 2)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 23-JUN-2021 09:32:31
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/srv1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=srv1.localdomain)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "oradb" has 1 instance(s).
Instance "oradb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Also find attached the tnsnames.ora and grid listener copy.

[root@srv1 admin]# cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORADB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv1.localdomain)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB)
)
)

ORADB_S2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv2.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORADB_S2)(UR=A)
)
)


Grid Listener:

[root@srv1 admin]# cat listener.ora
# listener.ora Network Configuration File: /u01/app/12.1.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv1.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET # line added by Agent


srv2(standby):

[oracle@srv2 db_1]$ export ORACLE_SID=ORADB_S2
[oracle@srv2 db_1]$ rman

Recovery Manager: Release 12.1.0.2.0 - Production on Wed Jun 23 08:32:56 2021

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

RMAN> CONNECT TARGET sys/oracle@ORADB;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-12541: TNS:no listener

RMAN> exit

Here I checked the Listener status of primary DB listener which was down so modified and started.

here are attached listener.ora for database and grid instances.

[oracle@srv2 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv2.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=ORADB_S2)
(SID_NAME=ORADB_S2)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1)
)
)

# listener.ora Network Configuration File: /u01/app/12.1.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = srv2.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=SUBNET # line added by Agent

SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=ORADB_S2)
(SID_NAME=ORADB_S2)
(ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1)
)
)



[oracle@srv2 db_1]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 23-JUN-2021 08:35:44

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=srv2.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 23-JUN-2021 06:32:39
Uptime 0 days 2 hr. 3 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/srv2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=srv2.localdomain)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "ORADB" has 1 instance(s).
Instance "ORADB_S2", status BLOCKED, has 1 handler(s) for this service...
Service "ORADB_S2" has 1 instance(s).
Instance "ORADB_S2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

It shows blocked and unknown which could be the problem!!!

when I tried connecting to primary from standby got below new issue.

RMAN> CONNECT TARGET sys/oracle@oradb

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-01017: invalid username/password; logon denied

RMAN> CONNECT TARGET 'sys/oracle@oradb as sysdba'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
ORA-01017: invalid username/password; logon denied


From srv1 I changed the sys password to oracle although it was the same earlier.
And tried to connect from srv2 but the result is same:

Please help me in understanding this issue!!!

[oracle@srv1 dbs]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 25 05:53:18 2021

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

Enter user-name: system
Enter password:
Last Successful login time: Fri Jun 25 2021 05:42:06 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> alter user sys identified by oracle;

User altered.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
[oracle@srv1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Jun 25 05:54:38 2021

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

*1. From srv1 when running netca and checking Oracle Net Service Name Configuration
for service name ORADB with system user with password oracle...it succeed.

*2.But when doing the same for ORADB_S2 (from srv1 netca), it show below error although
I created the password file with password oracle and copied the same to Standby server
and the Database is in umount mode on standby side:

Connecting...ORA-01033: Oracle initialization or shutdown in progress.

This test did not succeed.

Some information you provided may be incorrect.
Click back to review the information provided
for net service name, or change login to change username.

I verified the same from srv2(standby machine) but the result is same as above (*1 and *2).

Does it mean that database must be up and running during this test?

Please let me know if need any other information from my end.

thanks




Connor McDonald
June 30, 2021 - 2:10 am UTC

Here's a top to bottom template I used for a 12c customer recently. Hope this helps

primserver/sbyserver - the database servers
MYPRIM/MYSBY - the databases (primary and standby)


1) OS preliminaries

on sbyserver
=============
mkdir /u01/oradata/MYSBY
mkdir /u01/oraflash/MYSBY
mkdir /u01/oraarch/MYSBY
mkdir -p /u01/app/oracle/admin/MYSBY/adump

add MYSBY to listener.ora as explicit SID, and issue "lsnrctl reload"

- add these for the one-off duplication

add DUP_MYSBY to tnsnames.ora with ORACLE_SID= not SERVICE=
add DUP_MYPRIM to tnsnames.ora with ORACLE_SID= not SERVICE=

on primserver 
=============

add MYSBY to tnsnames.ora (this is what the archive shipper will use)

- add these for the one-off duplication

add DUP_MYSBY to tnsnames.ora with ORACLE_SID= not SERVICE=
add DUP_MYPRIM to tnsnames.ora with ORACLE_SID= not SERVICE=

verification
============

copy password file primserver from to sbyserver, and rename accordingly

- on each server

tnsping DUP_MYSBY, DUP_MYPRIM to confirm connectivity

- on each server

connect target sys/xxxxxxxxxx@dup_myprim
connect auxiliary sys/xxxxxxxxxx@dup_mysby

2) Database

On MYPRIM
=========

sqlplus

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/MYSBY.ctl';
CREATE PFILE='/tmp/initMYSBY.ora' FROM SPFILE;

Set the following parameters to transfer archive logs to the dataguard node: (all done with: alter system scope=both sid='*')

log_archive_config = 'DG_CONFIG=(MYPRIM,MYSBY)'

log_archive_dest_1 =  
  'LOCATION=/u01/oraarch/MYPRIM 
   REOPEN=60
   VALID_FOR=(ALL_LOGFILES,ALL_ROLES) 
   DB_UNIQUE_NAME=MYPRIM'


log_archive_dest_2 = 
   'SERVICE=MYSBY ASYNC
    VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
    DB_UNIQUE_NAME=MYSBY'

log_archive_dest_state_1 = ENABLE
log_archive_dest_state_2 = ENABLE

LOG_ARCHIVE_MAX_PROCESSES = 8

On MYSBY
=========
Transfer the init.ora created above to primserver, and edit.  This is based on the standard DataGuard documentation (Data Guard Concepts and Administration)

sqlplus

startup nomount
create spfile from system;
alter system set fal_server='MYPRIM';
alter system set fal_client='MYSBY';

Now use RMAN to duplicate the database from MYPRIM:

rman
connect target sys/xxxxxxxxxx@dup_myprim
connect auxiliary sys/xxxxxxxxxx@dup_mysby

run {
  allocate channel prmy1 type disk;
  allocate channel prmy2 type disk;
  allocate auxiliary channel stby1 type disk;
  allocate auxiliary channel stby2 type disk;
  duplicate target database for standby from active database;
}


(where dup_myprim is a tnsnames.ora entries to one of the database instances)

Once duplication is finished, add standby redo logs

sqlplus

ALTER DATABASE ADD STANDBY LOGFILE ('/u01/oradata/MYSBY/sby_redo01.dbf') SIZE 500M; 
etc etc

alter system register;

Continuous recovery
===================

sqlplus

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;




More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database