TRANS_DATA is the Sterling B2B Integrator Database table where all transactional data is stored as blobs. This data include process data, payload, XML reports . and pointers to the file system or lob segment.
The following SQL queries will help to understand this data.
Trans_data distribution per month (5263 +) Oracle and DB2 only
NEW! In version 5263 a new column CREATION_DATE was added to trans_data.
SELECT to_char(CREATION_DATE, 'MM-YYYY'), count(*) FROM trans_data GROUP BY to_char(CREATION_DATE, 'MM-YYYY') ORDER BY 1 desc
Size of all the blobs (Oracle)
SELECT round(sum(dbms_lob.getlength(data_object))/1024/1024) sizeMB FROM trans_data
Long query to get the trans_data size by type:(Oracle)
SELECT reference_table, data_type, count(*), round(SUM (dbms_lob.getlength(DATA_OBJECT)) /1024/1024) total_MB FROM trans_data GROUP BY reference_table,data_type ORDER BY 1,2
Long query to get the trans_data size by type for wfid <=0 (Oracle)
SELECT reference_table, data_type, wf_id,count(*), round(SUM (dbms_lob.getlength(DATA_OBJECT)) /1024/1024) total_MB FROM trans_data WHERE wf_id <= 0 GROUP BY reference_table,data_type,wf_id ORDER BY 1,2,3
Trans_data distribution per month based on WC excluding <0 (!!for OLDERĀ versions prior to 5263!!)
SELECT /*old versions */ to_char(b.starttime,'YYYYMM') permonth, count(*) FROM trans_data a , (SELECT workflow_id, min(start_time) starttime FROM Workflow_context GROUP BY workflow_id) b WHERE a.wf_id=b.workflow_id GROUP BY to_char(b.starttime,'YYYYMM') ORDER BY permonth
Trans_data Orphans count
SELECT COUNT(*) FROM TRANS_DATA WHERE (WF_ID=0 or WF_ID=-1) AND REFERENCE_TABLE ='DOCUMENT' AND NOT EXISTS (SELECT BODY FROM DOCUMENT WHERE BODY=TRANS_DATA.DATA_ID OR ENC_IV=TRANS_DATA.DATA_ID OR ENC_KEY=TRANS_DATA.DATA_ID)
Trans_data Orphans size (Oracle)
SELECT wf_id,COUNT(*), round(SUM (dbms_lob.getlength(DATA_OBJECT)) /1024/1024) total_MB FROM TRANS_DATA WHERE (WF_ID=0 or WF_ID=-1) AND REFERENCE_TABLE ='DOCUMENT' AND NOT EXISTS (SELECT BODY FROM DOCUMENT WHERE BODY=TRANS_DATA.DATA_ID OR ENC_IV=TRANS_DATA.DATA_ID OR ENC_KEY=TRANS_DATA.DATA_ID) group by WF_ID
Find large blob’s used by BPs (Oracle Only)
select WF_ID , SUM (dbms_lob.getlength("DATA_OBJECT")) from TRANS_DATA GROUP BY WF_ID ORDER BY 2 DESC;
If you have some very old data in your trans_data table on Oracle please check this post on how to delete old records from TRANS_DATA.
Remember to run SQL queries returning large result-sets OUTSIDE of the B2B Integrator application SQL manager. Use tools like Oracle SQL developer.
Check more useful SQL queries:
- Useful SQL queries for Sterling B2B Integrator.
- Workflow statuses explained with SQL queries: Active, Halted, Halting BPs …
- Filegateway related SQL queries.
- Communication and adapter stats SQL.
- Slow services and steps SQL.
If you are struggling to find some information in the B2B Integrator Database, please post a comment below. You can also share your useful SQL for Integrator!
Lonendure
I need a query to get the following details on SFG Partner
Partner Name
Partner Code
E-mail ID
User Account
Editor
SFG Partners where to find the information?
1. FG_PART_GRP_MEMB
Can be used to get a list of ORGANIZATION_KEY for all SFG partners configured;
since be default all partners are part of the SFG group “All Partners’, we can use that to filter all partners without duplicates
since they can be a part of multiple SFG groups.
select ORGANIZATION_KEY from FG_PART_GRP_MEMB where PART_GRP_KEY = ‘All Partners’
2. YFS_ORGANIZATION
Using the organization key retrieved above, you can get the partner name (ORGANIZATION_NAME) as well as the OBJECT_ID
3. SCI_PROFILE
The OBJECT_ID of point 2 matches the ENTITY_ID on this table.
The OBJECT_NAME will give you the name of the partner linked to the role, producer or consumer, (i.e. abcde_producer),
If the partner is a producer and a consumer at the same time, it will be listed twice with the same entity id.
4. YFS_USER
You can retrieve the user accounts related to the SFG partner, USERNAME.
You can use the ORGANIZATION_KEY obtained on step 1 to get the user account related to that SFG partner.
5. SCI_ENTITY_EXTNS
Use the ENTITY_ID obtained in step 3 or the OBJECT_ID of step 2 to get all the rest of the SFG info for this partner.
This table contains one line per configuration option for that specific partner, like protocol, encryption options, etc…
Lonendure
Thanks, I got most of the information, but I am not able to get the email address. the EMAIL_ADDR from YFS_ORGANIZATION is not the right one which I wanted. I just need the exact email address which we enter while filling out the partner details on SFG. I found one on PETPE_TRADINGPARTNER but I don’t know there is a way to connect to that and I don’t know if that is the right email field as well. Any thoughts?
Editor
PE tables are not part of the standard B2B Integrator schema, they are created as part of the Pragma Edge framework.
Mike Monica
use the BILLING_ADDRESS_KEY in YFS_ORGANIZATION to look up the EMAILID from YFS_PERSON_INFO where YFS_ORGANIZATION.BILLING_ADDRESS_KEY=YFS_PERSON_INFO.PERSON_INFO_KEY
Swathi
I want to know on the number of files and the file names or control number been entered to Sterling Integrator during a certain time frame. Which table can we check and can you suggest the query for it
Editor
Hello
Which protocol are you using?