When you check the database of PI/PO system, you can see different table names and you may be wondering what message related data they keep and how to control the size of these tables. Here I will simpley introduce these tables and the related background jobs for you.
- BC_MSG
BC_MSG (XI_AF_MSG for PI 7.0x and lower) is the master table for persistence of messages on the Java side, one record per each persistent asynchronous message. To analyze the overall number of messages based on their status, you could use the following SQL statement:
SELECT COUNT(*), STATUS FROM <Java Schema name>.BC_MSG GROUP BY STATUS;
The default persist time for messages in the Adapter Framework is 1 day from 7.1 onwards (30 days for older releases). This means that messages will be kept in the database for 1 day until the deletion job removes them.The retention period can be configured as the following two properties (value is in milliseconds) in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Adapter: XI".
"xiadapter.outbound.persistDuration.default" and "xiadapter.inbound.persistDuration.default"
- BC_MSG_AUDIT
The entries in table BC_MSG_AUDIT (XI_AF_MSG_AUDIT for 7.0x and lower) are the audit log entries visible in the RWB/PIMON. In 7.1 and higher, per default the audit log is only written to database for error messages and the messaging system does not persist the audit logs of successully processed asynchronous messages.
The persistence of audit logs for successfully processed asynchronous messages may be required for business reasons or performance analysis. To persist the audit logs for all asynchronous messages to the database, you can change the value of property "messaging.auditLog.memoryCache" from the default 'true' to 'false' in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Service : Messaging System".
The persistence of the audit log entries is directly related to the persistence of messages in BC_MSG table. Therefore, reducing the number of messages in BC_MSG will also reduce the number of messages in the BC_MSG_AUDIT table.
- BC_MSG_VERSION
The entries in table BC_MSG_VERSION are the message versions created when message is edited with Message Editor or in case staging was configured. Versions created via staging -- these are created only for asynchronous messages and are stored in BC_MSG_VERSION and BC_MSG tables.By default, this version is created after Receiver and Interface determination step (stage MS).
In case the original message is split (e.g. to several receivers or interfaces at Receiver or Interface determination step or with multi-mapping during Mapping step), the system will implicitly store one version for each of the split child messages right after this step (stage MS or AM).
You can define additional steps at which the system will create staging versions per scenario (for example, in the "Advanced setting" tab of the Integrated Configuration Object in the Integration Directory) or globally, using the property "xiadapter.stage.conf" in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Adapter: XI service". For more information how to configure persistence of additional staging version, you can find here:
Saving Message Versions in the AAE (Local Message Processing)
- BC_MSG_LOG and BC_MSG_LOG_STAT
The entries in table BC_MSG_LOG and BC_MSG_LOG_STAT are created in case message logging was configured. These can be created for both asynchronous and synchronous messages. These versions are used only for monitoring purposes – you cannot restart an asynchronous message form one of
these versions.
By default the system will create such only for erroneous synchronous messages. The persistence of audit logs for successfully processed synchronous messages may be required for business reasons or performance analysis. To persist the audit logs for all synchronous messages to the database, you can change the value of property "messaging.auditLog.memoryCache" from the default 'true' to 'false' in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Service : Messaging System". Please be aware that audit logs for successful asynchronous messages will also be persisted.
You can configure steps with logging per scenario (for example, in the "Advanced setting" tab of the Integrated Configuration Object in the Integration Directory) or globally, using the property "xiadapter.logger.conf" in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Adapter: XI service". For more information how to configure Message Logging at Specific Processing Steps, you can find here:
Configuring Message Logging (Within AAE Pipeline)
Synchronous messages are only logged in BC_MSG_LOG without a corresponding entry in BC_MSG table. Therefore, these entries have their own retention period specified by property "messaging.log.retainTime" in NWA -> Configuration -> Infrastructure -> Java System Properties -> Services -> "XPI Service: Messaging System". The default retention period for logged messages is 7 days.
You can check PERSIST_UNTIL field of BC_MSG_LOG_STAT table to see when a message becomes eligible for archiving/deletion.
- Background jobs on Adapter Engine
In case no archiving job is configured in the system, the Delete job is responsible to delete message data from BC_MSG, BC_MSG_VERSION, BC_MSG_LOG, BC_MSG_LOG_STAT, BC_MSG_AUDIT tables related to messages in final state with expired retention period (Persist Until time).
In case there is an active archive job, then these messages are skipped by delete jobs and the archive job should take care for archiving and deletion of messages which is done in two phases - first all eligible messages are archived and after that all archived messages are deleted.
For more information, you can find here: Background Job Types
******
Related Notes:
SAP Note 790226 - Messages in AdapterEngine/PCK database do not get archived
SAP Note 872388 - Troubleshooting Archiving and Deletion in PI
SAP Note 1314974 - Successful asynchronous messages - audit log persistence
SAP Note 1760915 - FAQ: Staging and Logging in PI 7.3 and higher
SAP Note 1872758 - How XI/PI messages are persisted in Adapter Engine
SAP Note 1982452 - Audit Logs for successful synchronous messages with log versions to be persisted/archived if audit log memory cache is disabled