Is Trading Partner Agreement Setup Parameters

21 Scripts for Archiving and Restoring Data 21-1 21 Scripts for Archiving and Restoring Data This chapter describes how to archive and restore B2B business messages using SQL scripts. This chapter contains the following topics: ■ Section 21.1, Introduction to Archiving and Restoring B2B Business Messages ■ Section 21.2, Archiving B2B Business Messages ■ Section 21.3, Restoring B2B Business Messages See Chapter 7, Importing and Exporting Data, for information on importing and exporting design-time data.

21.1 Introduction to Archiving and Restoring B2B Business Messages

Oracle B2B uses Oracle Data Pump, an Oracle Database 11g feature that enables fast bulk data and metadata movement, to archive B2B run-time instance data in Oracle databases. 1 You can specify criteria for archiving and optionally purging business messages based on start date, end date, and message state. The targeted business messages are marked with JOB_ID, a column in the B2B run-time tables that is used to synchronize archive and purge activity. B2B invokes the Data Pump PLSQL API using JOB_ID. Hence, when you archive business messages, all the associated tables are also archived. Archived business messages can also be restored by using the Data Pump to import the run-time data into Oracle B2B Oracle Metadata Service repository and accessing it through B2B reports.

21.2 Archiving B2B Business Messages

To archive business messages, set up the archive directory and permissions and then run the archive procedure. The procedure provides an option to purge the archived rows. To set up the archive directory and permissions: 1. On the computer running the database, create a directory for the archive file. For example, mkdir tmparchive 1 For non-Oracle databases, external database archiving tools can be used to export and import run-time data. 21-2 Oracle Fusion Middleware Users Guide for Oracle B2B 2. Give permissions to this directory so that the database process can write to it. For example, chmod 777 tmparchive 3. Log in to the database as sysdba. sqlplus as sysdba 4. Set up B2B_EXPORT_DIR. SQL create or replace B2B_EXPORT_DIR as tmparchive 5. Grant the SOA schema user for example, b2b_soainfra permission for the export. SQL grant read, write on directory B2B_EXPORT_DIR to b2b_soainfra; SQL grant exp_full_database to b2b_soainfra; To archive, with an option to purge: Set up the archive directory and permissions before using the following PLSQL API. 1. Log in as the SOA schema user. sqlplus b2b_soainfrapassword 2. Execute the archive procedure, for example, SQL exec b2b_archive_procedure21-JAN-2008,28-JAN-2008,MSG_COMPLETE,JAN.dmp,N ; The signature of the procedure is b2b_archive_procedurefromDate, toDate, messageState, fileName, should_purge; Table 21–1 lists the parameters for the b2b_archive_procedure API. Table 21–1 b2b_archive_procedure Parameters Parameter Example Description fromDate 21-JAN-2008 Starting date for archival, DD-MON-YYYY toDate 28-JAN-2008 Ending date for archival, DD-MON-YYYY messageState MSG_COMPLE TE State of the business message. The MSG_COMPLETE state is typically archived. Other possible states are MSG_INVALID, MSG_CONTINUE_PROCESS, MSG_COLLAB_WAIT, MSG_PROCESS_ACK, MSG_SEND_ACK, MSG_WAIT_ACK, MSG_ERROR, MSG_WAIT_TRANSMIT, MSG_SEND_EXP, MSG_PROCESS_EXP, MSG_ABORTED, MSG_TRANSMITFAILED, MSG_WAIT_FA, MSG_SEND_FA, MSG_WAIT_BATCH fileName JAN.dmp Name of the archive file to be created by the database. Ensure that a file with this name does not exist in the archive directory. should_purge N Y removes the archived rows. The default is N.