Skip to Main Content
  • Questions
  • expdp from physical standby database

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Peter.

Asked: July 02, 2016 - 4:32 pm UTC

Last updated: August 06, 2020 - 4:20 pm UTC

Version: 11.2.0.4

Viewed 10K+ times! This question is

You Asked

Have a good day
I am trying to export using expdp from the standbay server to offload the load from the production
So I follow Oracle Doc ID : 1356592.1

but I get the follwing error


Export: Release 11.2.0.4.0 - Production on Sat Jul 2 18:21:34 2016

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
ORA-31626: job does not exist
ORA-31633: unable to create master table "BACKUP.SYS_EXPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1038
ORA-16000: database open for read-only access

could you please help me as soon as possible

Thanks
peter

and Connor said...

You have 2 options

Option 1) Use a network link, eg this from MOS note 1356592.1



In this Document
Goal
Solution
Prerequisites
Steps to execute to export from Physical Standby Database
Typical Errors when exporting from Physical Standby databases


Applies to:
Oracle Database - Enterprise Edition - Version 10.1.0.2 and later
Information in this document applies to any platform.
***Checked for relevance on 01-Feb-2016***
Goal

This document describes how to successfully execute DataPump Export to export data from a Physical Standby database.
Solution
Prerequisites

It's important to know that Data Pump Export (expdp) cannot be executed directly on the Physical Standby database. This is due to the fact that Data Pump Export needs to create and maintain a Master Table which requires that a database would be open in "READ WRITE" mode. Therefore it is necessary to connect from a "non-Standby" database (which will maintain the Master Table) to the Physical Standby database using parameter NETWORK_LINK.

The NETWORK_LINK parameter initiates an export by using a valid database link. This means that the system to which the expdp client is connected contacts the Physical Standby database referenced by the source_database_link, retrieves data from it, and writes the data to a dump file set back on the connected system.

The Physical Standby database must be opened in "READ ONLY" mode.

Steps to execute to export from Physical Standby Database

Physical Standby Database

-- Connect to Physical Standby database and check its status

SQL> select instance_name, status from v$instance;

INSTANCE_NAME STATUS
---------------- ------------
PHYSTBY MOUNTED

-- Cancel managed recovery and open database in "READ ONLY" mode.
SQL> alter database recover managed standby database cancel;
SQL> alter database open read only;


-- Verify database status

SQL> select instance_name, status from v$instance;

INSTANCE_NAME STATUS
---------------- ------------
PHYSTBY OPEN


SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

"Non Standby" Database

-- create DB Link, Oracle Directory and test it

SQL> create database link expdp_primary connect to system identified by password using ‘standby_database’;

SQL> select db_unique_name from v$database;

SQL> select db_unique_name from v$database@expdp_primary;

SQL> create directory datapump as ‘/tmp’;


-- Use NETWORK_LINK to database link above to connect to the Physical Standby database:

expdp system/password directory=datapump network_link=expdp_primary full=y dumpfile=standby_database.dmp logfile=standby_database.log



Option 2)

Open the standby in "snapshot standby" mode (it becomes read/write), then take your export, then revert it back to standard standby mode (which will automatically flash it back and resume sync with the primary).

- ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;
- run your export
- ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

(Note - that is not the complete list of steps, but its easy enough to put a script together to do this)

Hope this helps.

Rating

  (4 ratings)

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

Comments

peter, July 03, 2016 - 11:50 am UTC

I want to know will that offload the expdp from the primary node during the backup process

Note : I try 1st solution but I want to confirm that the expdp will run from primary node as I run on standby node and get the error I mentioned above
Connor McDonald
July 04, 2016 - 1:38 am UTC

that is correct - you are running 'expdp' on *any* read/write node.

Detailed steps on using Snapshot Standby

Gary, September 26, 2016 - 5:42 pm UTC

Connor

Can you please point me to any detailed instructions on how to convert a Physical Standby to a Snapshot Standby and back agian?

I have two (2) databases (11.2.0.4 EE), I can perform the above perfectly on one of them but not the other and am trying to see what differences there are in the DB setup between the two.

It has something to do with the Flashback setup as I always get the error message about the 'Flashback logs not available' or something like that on the one that doesn't work.

I follow the same steps on both so I'm assuming there's something different in the DB params or something.

Any help is greatly appreciated!!!
Chris Saxon
September 27, 2016 - 1:34 am UTC

The restore point / flashback is all handled for you. So it should just be case of:

snapshot
========
shutdown immediate;
startup mount;
alter database convert to snapshot standby;
shutdown immediate;
startup;

back to physical
================
shutdown immediate
startup mount exclusive
alter database convert to physical standby;
shutdown immediate
startup mount exclusive
alter database recover managed standby database using archived logfile delay 60 disconnect;


expdp on Physical standby - Measuring Performance impact

Dave, August 28, 2019 - 6:00 pm UTC

Hi Connor/Team - you mentioned that expdp on physical standby can be performed with reference to MOS note 1356592.1

I tested it on my production database-Primary (A) issuing expdp and pointing to physical standby (B) with network_link .

ours is an OLTP environment and we want to offload the expdp to our dataguard databases to reduce the load on our Primary databases.

1) where is the memory,cpu,I/o resource consumption caused ?
will it be on the Primary or in standby ?
2) how can i check if the primary or dataguard resources (I/O,cpu,memory) are being hit ? Are there any helpfull queries to run on both Primary & Dataguard and validate the output ?

Thank you in advance !

Connor McDonald
September 03, 2019 - 5:26 am UTC

You'll be able to see "worker" sessions running for the export, which do the vast bulk of the work (ie, reading the database data).

But the easiest way to ensure that production node is not involved, is to not use it, ie, use any other server as a the originating node and connect to the standby from that.

How To Use DataPump Export (EXPDP) To Export From Physical Standby Database (Doc ID 1356592.1)

Antonysamy, August 06, 2020 - 11:24 am UTC

I have tried this method on multitenant database.
I have created the DB link on non-standby PDB and DB link works.
SQL>create database link expdp_primary connect to mig_ora identified by XXXX using '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = exacc1-scan.us2.ocm.s7036075.oraclecloudatcustomer.com)(PORT = 1521)) (CONNECT_DATA = (UR=A) (SERVER = DEDICATED) (SERVICE_NAME = HRPSPP_DR.us2.ocm.s7036075.oraclecloudatcustomer.com) (FAILOVER_MODE = (TYPE = select) (METHOD = basic))))';

SQL> select db_unique_name from v$database;

DB_UNIQUE_NAME
------------------------------
XEPS1Q

SQL> select db_unique_name from v$database@expdp_primary;

DB_UNIQUE_NAME
------------------------------
XEPS1R

SQL>
SQL> create directory exp_user_dir as '/oraexport/HRP4Q';

SQL> grant connect,dba to EXP_USER;

expdp EXP_USER/XXX@hrpspq_rw directory=exp_user_dir network_link=expdp_primary full=y dumpfile=standby_database.dmp logfile=standby_database.log
i am getting the below error.

please help me to fix this issue.

ORA-39006: internal error
ORA-39065: unexpected master process exception in DISPATCH
ORA-04054: database link EXPDP_PRIMARY does not exist
ORA-06512: at "SYS.KUPM$MCP", line 2305

ORA-39097: Data Pump job encountered unexpected error -4054

Regards,
Antony A

Chris Saxon
August 06, 2020 - 4:20 pm UTC

Uh-oh

ORA-39006: internal error => contact support

That said, look closely at this:

ORA-04054: database link EXPDP_PRIMARY does not exist

Verify that you can use the database link when connected as EXP_USER

More to Explore

VLDB

If you are new to partitioning, check out Connor McDonald's introduction series here.

VLDB

Documentation set on VLDB and Partitioning.