B2B Partner Metrics

Part V Part V Scripts and Utilities This part describes how to do various tasks using scripts and utilities that are provided in Oracle B2B. This part contains the following chapters: ■ Chapter 19, B2B Command-Line Tools ■ Chapter 20, Using the Oracle B2B Web Services ■ Chapter 21, Scripts for Archiving and Restoring Data ■ Chapter 22, Utilities for Enqueuing and Dequeuing ■ Chapter 23, Monitoring Instance Message Data With Oracle BAM ■ Chapter 24, Programmatically Accessing Instance Message Data 19 B2B Command-Line Tools 19-1 19 B2B Command-Line Tools B2B command-line tools are available for a number of tasks. This chapter contains the following topics: ■ Section 19.1, Prerequisites for Running the Command-line Tools ■ Section 19.2, Archiving Data ■ Section 19.3, Purging Data ■ Section 19.4, Importing Data ■ Section 19.5, Exporting Data ■ Section 19.6, Batching Operations ■ Section 19.7, Deploying Agreements ■ Section 19.8, Validating B2B Metadata ■ Section 19.9, Using the ebXML CPPCPA Utilities ■ Section 19.10, Verifying Agreement Availability ■ Section 19.11, Creating Oracle B2B Metadata Based on selfservice.xsd ■ Section 19.12, Resubmitting a Message ■ Section 19.13, Scheduling Trading Partner Downtime ■ Section 19.14, Managing the Keystore ■ Section 19.15, Errors During Import

19.1 Prerequisites for Running the Command-line Tools

Do the following before using the command-line tools: 1. Set the ORACLE_HOME, ANT_HOME, and JAVA_HOME environment variables. ORACLE_HOME is set to your Oracle Fusion Middleware installation directory. For example: set ORACLE_HOME=C:\oracle\wls_home set ANT_HOME=ORACLE_HOME\modules\org.apache.ant_1.7.1 set JAVA_HOME=ORACLE_HOME\jdk160_18 2. Create jndi.properties. cd ORACLE_HOME\bin ant -f ant-b2b-util.xml b2bcreate-prop 19-2 Oracle Fusion Middleware Users Guide for Oracle B2B 3. Edit the jndi.properties file to include the weblogic password.

19.2 Archiving Data

Oracle B2B uses Oracle Data Pump as the archiving mechanism for Oracle B2B runtime instance data in Oracle database. Oracle B2B enables archiving functionality only when the Oracle B2B repository is Oracle database. You can configure start date, end date, and message state to archive andor purge the runtime data. In order to improve the performance and synchronize archive and purge activity, a new column JOB_ID is added in each runtime table - B2B_BUSINESS_MESSAGE, B2B_EXT_BUSINESS_MESSAGE, B2B_APP_MESSAGE, B2B_WIRE_MESSAGE and B2B_DATA_STORAGE. Oracle B2B will mark the target runtime data by start date, end date, and message state with a unique JOB_ID. If you select to archive the runtime data, Oracle B2B will invoke Data Pump PLSQL API with JOB_ID to export the runtime data. Oracle B2B will purge the runtime messages by JOB_ID if you also want to purge them. After the runtime data is archivedexported, Oracle B2B can also use Oracle Data Pump to import the runtime data into an Oracle B2b repository. Before archiving data, you must set up the permissions and the archival directory. To do initial setup: 1. On the machine running the database, create a directory in which to dump the archive file. For example: mkdir tmparchive 2. Grant permissions to this directory so that the database process can write to it. chmod 777 tmparchive 3. Log in to the database as sysdba. sqlplus as sysdba Notes: 1. Command-line tools are for administrator use only. No security or permission checks are performed to prevent the logged-in user from purging, importing, or exporting data. 2. After running any command-line tool, you should re-log into the B2B Console. The B2B Console caches some metadata and any command-line action which may have updated the metadata could lead to invalid cached data. Therefore, it is advisable to always re-login into the B2B Console after using command-line operations. 3. All of the command-line tools can be run without any JNDI credentials. To restrict the command-line tools from anonymous use, provide the following information in the jndi.properties file: java.naming.security.principal=weblogic java.naming.security.credentials=weblogic_password Note: The b2b_archive utility only supports Oracle database. No other databases are supported. B2B Command-Line Tools 19-3 4. Set up the B2B_EXPORT_DIR. SQL create or replace DIRECTORY B2B_EXPORT_DIR as tmparchive 5. If your SOA schema user is b2b_soainfra, the user needs to be granted 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 data: 1. Log in as the soainfra schema user. sqlplus b2b_soainfrapassword 2. Execute the archive procedure. For example: SQL exec B2B_ARCHIVE_INSTANCE_MSGS20100623 12:23:23,20100624 12:46:24,MSG_COMPLETE,null,null,null,null,null,null,myDump.dmp The signature of the procedure is exec B2B_ARCHIVE_INSTANCE_MSGSp_startDate,p_endDate,p_msgState,p_tpName, p_direction,p_msgType,p_tpaName,p_idType,p_idVal,filename; Note: Make sure that the initial setup steps detailed above are performed before attempting to archive. Table 19–1 Options for B2B_ARCHIVE_INSTANCE_MGS utility Options Type Description startDate varchar2 Starting date for archival endDate varchar2 Ending date for archival msgState varchar2 State of the business message tpName varchar2 Trading Partner name direction varchar2 Message direction msgType varchar2 Message type tpaName varchar2 Trading Partner Agreement name idType varchar2 ID type idVal varchar2 ID value filename varchar2 Name of the archive file to be created by the database. File names MUST be unique. Verify that a file with this name does not exist in that directory. 19-4 Oracle Fusion Middleware Users Guide for Oracle B2B

19.3 Purging Data

The following utility purges both design-time and run-time data and resets the environment to the installation time. ant -f ant-b2b-util.xml b2bpurge Table 19–2 lists the options for this utility. Note: Before purging run-time data, the configuration setup described in Section 19.2, Archiving Data is required. If those steps are not done, then the archive will fail with a misleading error. No security or permission checks are performed to prevent the logged-in user from purging data. The b2bpurge utility only supports Oracle database. No other databases are supported. Table 19–2 Options for b2bpurge utility Option Description Domain Required mode Specifies purging design-time or run-time data. see Note below DT RT No 1 1 The option -Dmode=RT is a mandatory argument for b2bpurge to delete only runtime records. This option must be set for every runtime record purge, otherwise purges all of the metadata and runtime data. Example: ant -f ant-b2b-util.xml b2bpurge -Dmode=RT msgState Deletes messages with the specified message state. Used for run-time data. MSG_COMPLETE MSG_ERROR MSG_WAIT_TRANSMIT MSG_WAIT_FA MSG_WAIT_BATCH No. If msgstate is present, then start and end must be used. purgecontrolnumber Deletes control numbers. Used for run-time data. true false default No fromdate Deletes all messages, which created on or after this date. Date format dd-mm-yyyy hh:mm AMPM No todate Deletes all messages, which created on or before this date. Date format dd-mm-yyyy hh:mm AMPM No tp Based on trading partner. No direction Direction of the message No msgtype Type of the message No agreement Name of the agreement No idtype No idvalue No archive Should archive Default value is true archivename File name of archived file No B2B Command-Line Tools 19-5 Example 19–1 Removes Design-Time Data ant -f ant-b2b-util.xml b2bpurge -Dmode=DT Example 19–2 Purges Run-Time Data ant -f ant-b2b-util.xml b2bpurge -Dmode=RT Example 19–3 Purges Run-Time Data, Including Control Numbers ant -f ant-b2b-util.xml b2bpurge -Dmode=RT -Dpurgecontrolnumber=true Example 19–4 Purges Messages with the Specified State Between the Specified Dates ant -f ant-b2b-util.xml b2bpurge -Dmode=RT -Dfromdate=01022009 12:00 AM -Dtodate=10022009 12:00 AM -Dmsgstate=MSG_COMPLETE

19.4 Importing Data

The b2bimport utility imports the B2B metadata ZIP file to the repository. Basic validation is performed, but it is not a complete validation as with deployment validation. No data is overwritten unless you use the overwrite option. The following usage imports data from tmpexport.zip to a location on the same server without overwriting. ant -f ant-b2b-util.xml b2bimport -Dlocalfile=true -Dexportfile=tmpexport.zip Table 19–3 lists the options for this utility. Note: When only -Dmode=RT -Dtp=trading_partner_name options are used, this option deletes all records matching Trading Partner name with SenderName or in Receiver Name. Note: When using archivename the value must be a unique file name. An existing file name used with archivename throws an exception. Note: No security or permission checks are performed to prevent the logged-in user from importing data. Table 19–3 Options for b2bimport utility Option Description Domain Required exportfile Location of the export ZIP file - Yes overwrite Overwrites the existing business elements. For example, an existing delivery channel with the same trading partner name as a delivery channel in the import file is replaced if this option is set to true. true false default No 19-6 Oracle Fusion Middleware Users Guide for Oracle B2B

19.5 Exporting Data

The b2bexport utility exports metadata from the Oracle B2B repository. If no options are specified then the entire repository is exported. The following usage exports the entire repository without policy details to tmpexport.zip if no other options are specified. ant -f ant-b2b-util.xml b2bexport Table 19–4 lists the options for this utility. Example 19–5 Export entire repository with policy details to tmpexport.zip ant -f ant-b2b-util.xml b2bexport -Dexportfile=tmpexport.zip -Dpolicies=true localfile If the export file location exists on the server, then set this option to true to improve performance. The export file must be on the server on which B2B is running. true false default No Note: No security or permission checks are performed to prevent the logged-in user from exporting data. Table 19–4 Options for b2bexport utility Option Description Domain Required tpanames One or more agreement names to be exported. If one agreement is exported, then the ZIP file contains the folder soab2b. If multiple agreements are exported, then the ZIP file contains an individual ZIP file for each of the agreements. Agreement names must be separated by a comma No tpname The trading partner name to be exported Name of the trading partner No exportfile Location of the ZIP file where the exported data is stored tmpexport.zip default No active Exports agreements that have been deployed and are in active state. true false default No policies Set to true to export the entire repository with user and role details, which is needed for the policy store. A warning is displayed to remind you to export the policy store also. See Section 7.2, What Is Copied When You Import or Export from the ImportExport Tab, for more information. true false default No localfile Set to true for improved performance if the export file is on the same computer as Oracle B2B. true false default No Table 19–3 Cont. Options for b2bimport utility Option Description Domain Required