INFORMATICA METADATA TABLES

INFORMATICA METADATA

I am sure every PowerCenter developer either has an intention or necessity to know about the Informatica metadata tables and where information is stored etc. For the starters, all the objects that we create in Informatica PowerCenter - let them be sources, targets, mappings, workflows, sessions, expressions, be it anything related to PowerCenter, will get stored in a set of database tables (call them as metadata tables or OPB tables or repository tables).

* I want to know all the sessions in my folder that are calling some shell script/command in the Post-Session command task.
* I want to know how many mappings have transformations that contain "STOCK_CODE" defined as a port.
* I want to know all unused ports in my repository of 100 folders.

In repositories where you have many number of sessions or workflows or mappings, it gets difficult to achieve this with the help of Informatica PowerCenter client tools. After all, whole of this data is stored in some form in the metadata tables. So if you know the data model of these repository tables, you will be in a better position to answer these questions.

Before we proceed further, let me clearly urge for something very important. Data in the repository/metadata/OPB tables is very sensitive and that the modifications like insert or updates are to be made using the PowerCenter tools ONLY. DO NOT DIRECTLY USE UPDATE OR INSERT COMMANDS AGAINST THESE TABLES.

Please also note that there is no official documentation from Informatica Corporation on how these tables act. It is purely based on my assumption, research and experience that I am providing these details. I will not be responsible to any of the damages caused if you use any statement other than the SELECT, knowing the details from this blog article. This is my disclaimer. Let us move on to the contents now.

There around a couple of hundred OPB tables in 7.x version of PowerCenter, but in 8.x, this number crosses 400. In this regard, I am going to talk about few important tables in this articles. As such, this is not a small topic to cover in one article. I shall write few more to cover other important tables like OPB_TDS, OPB_SESSLOG etc.

We shall start with OPB_SUBJECT now.

OPB_SUBJECT - PowerCenter folders table

This table stores the name of each PowerCenter repository folder.

Usage: Join any of the repository tables that have SUBJECT_ID as column with that of SUBJ_ID in this table to know the folder name.

OPB_MAPPING - Mappings table

This table stores the name and ID of each mapping and its corresponding folder.

Usage: Join any of the repository tables that have MAPPING_ID as column with that of MAPPING_ID in this table to know the mapping name.

OPB_TASK - Tasks table like sessions, workflow etc

This table stores the name and ID of each task like session, workflow and its corresponding folder.

Usage: Join any of the repository tables that have TASK_ID as column with that of TASK_ID/SESSION_ID in this table to know the task name. Observe that the session and also workflow are stored as tasks in the repository. TASK_TYPE for session is 68 and that of the workflow is 71.

OPB_SESSION - Session & Mapping linkage table

This table stores the linkage between the session and the corresponding mapping. As informed in the earlier paragraph, you can use the SESSION_ID in this table to join with TASK_ID of OPB_TASK table.

OPB_TASK_ATTR - Task attributes tables

This is the table that stores the attribute values (like Session log name etc) for tasks.

Usage: Use the ATTR_ID of this table to that of the ATTR_ID of OPB_ATTR table to find what each attribute in this table means. You can know more about OPB_ATTR table in the next paragraphs.

OPB_WIDGET - Transformations table

This table stores the names and IDs of all the transformations with their folder details.

Usage: Use WIDGET_ID from this table to that of the WIDGET_ID of any of the tables to know the transformation name and the folder details. Use this table in conjunction with OPB_WIDGET_ATTR or OPB_WIDGET_EXPR to know more about each transformation etc.

OPB_WIDGET_FIELD - Transformation ports table

This table stores the names and IDs of all the transformation fields for each of the transformations.

Usage: Take the FIELD_ID from this table and match it against the FIELD_ID of any of the tables like OPB_WIDGET_DEP and you can get the corresponding information.

OPB_WIDGET_ATTR - Transformation properties table

This table stores all the properties details about each of the transformations.

Usage: Use the ATTR_ID of this table to that of the ATTR_ID of OPB_ATTR table to find what each attribute in this transformation means.

OPB_EXPRESSION - Expressions table

This table stores the details of the expressions used anywhere in PowerCenter.

Usage: Use this table in conjunction with OPB_WIDGET/OPB_WIDGET_INST and OPB_WIDGET_EXPR to get the expressions in the Expression transformation for a particular, mapping or a set.

OPB_ATTR - Attributes

This table has a list of attributes and their default values if any. You can get the ATTR_ID from this table and look it up against any of the tables where you can get the attribute value. You should also make a note of the ATTR_TYPE, OBJECT_TYPE_ID before you pick up the ATTR_ID. You can find the same ATTR_ID in the table, but with different ATTR_TYPE or OBJECT_TYPE_ID.

OPB_COMPONENT - Session Component

This table stores the component details like Post-Session-Success-Email, commands in Post-Session/pre-Session etc.

Usage: Match the TASK_ID with that of the SESSION_ID in OPB_SESSION table to get the SESSION_NAME and to get the shell command or batch command that is there for the session, join this table with OPB_TASK_VAL_LIST table on TASK_ID.

OPB_CFG_ATTR - Session Configuration Attributes

This table stores the attribute values for Session Object configuration like "Save Session log by", Session log path

Monday, 17 December 2012

How to make reusable transformation into nonreusable transformation?

Reusable transformation into nonreusable transformation
=====================================
1) Drag the reusable transformation from Repository Navigator into Mapping Designer
      by pressing the left button of the mouse
2 ) Then press the Ctrl key before releasing the left button of mouse.
3) Release the left button of mouse.


To Find a CHEK CONSTRATINT in DB2
================================
SELECT
TBNAME,
TBOWNER,
CHECKCONDITION
FROM SYSIBM.SYSCHECKS
WHERE
TBNAME='TABLE_NAME'
AND TBOWNER='SCHEMA'

Best Regards,
Moorthy. G

Monday, 26 November 2012

1. How To Find Primary Key and Foreign Key Relationship in a table in DB2?
Ans:

 SELECT A.CREATOR, A.TBNAME, A.RELNAME, B.COLNAME, B.COLSEQ,
       A.REFTBCREATOR, A.REFTBNAME
  FROM SYSIBM.SYSRELS A, SYSIBM.SYSFOREIGNKEYS B
  WHERE A.CREATOR = 'SOURCE'
  AND B.CREATOR = 'SOURCE'
  AND A.TBNAME = 'TABLE_NAME'
--  AND B.TBNAME = 'PROJ'
  AND A.RELNAME = B.RELNAME
    ORDER BY A.RELNAME, B.COLSEQ

2. How to find index in a Table in DB2?
Ans:
SELECT DISTINCT
A.TBNAME,
B.COLNAME,
A.INDEXSPACE,
A.DBNAME,
A.CLUSTERING,
A.CLUSTERED
FROM SYSIBM.SYSINDEXES A, SYSIBM.SYSKEYS B
WHERE
A.CREATOR = 'SOURCE'
AND TBNAME = 'TABLE_NAME'
AND A.NAME =B.IXNAME

Best Regards,
Moorthy. G

Saturday, 27 October 2012

STORE PROCEDURES:
==================


COPY TABLE
==========

create or replace procedure table_copy(
  GM_tab_from varchar2,
  GM_tab_to   varchar2)
Is

Begin

  execute immediate 'insert into '||GM_tab_to||' (select * from '||GM_tab_from||')';

End;
/

CREATE_INDEX:
=============

Create or replace procedure CREATE_INDEX

As

Begin

Execute immediate 'create index unconn_dept on SP_UNCONN_EXAMPLE(DEPTNO)';

End;

/

DROP_INDEX:
===========
Create or replace procedure DROP_INDEX

As

Begin

Execute immediate 'drop index unconn_dept';

End;

/

Tuesday, 10 July 2012


Informatica workflow status  SQL Query

SELECT WORKFLOW_NAME,
SERVER_NAME,
RUN_ERR_CODE,
RUN_ERR_MSG,
SUBJECT_AREA,
decode (RUN_STATUS_CODE,1 , 'Succeeded',
2,'Disabled',
3,'Failed',
4,'Stopped',
5,'Aborted',
6,'Running',
15,'Terminated')  Status
from infa_metadata_schema.REP_WFLOW_RUN
where START_TIME>= sysdate-2 and END_TIME<=sysdate
order by SUBJECT_AREA,WORKFLOW_NAME,RUN_STATUS_CODE;

If file exists then send email with attachment ?

if
 [[ -f $your_file ]]; then uuencode $your_file $your_file|mailx -s "$your_file exists..." your_email_address
fi

Best Regards,
Moorthy. G

Monday, 2 July 2012


Unconnected Lookup Transformation -- Returning Multiple Values

> We can achieve Multiple values from Unconnected Lookup-Tr. We just need to override the default lookup sql query, there in one of the return port we can concatnate the values using ||.

> The concatnated multiple values will be returned from lookup to calling expression. In the expression we can extract / separate the concatnated string value (multiple values concatnated in lookup) and can pass to the target…

SELECT DEPT.DNAME||' '||DEPT.LOC as OUT_MUL_Values, DEPT.DNAME as DNAME, DEPT.LOC as LOC, DEPT.DEPTNO as DEPTNO FROM DEPT

> Before overrideing we should create one return port in the lookup-tr (here OUT_MUL_Values )

> Devide that OUT_MUL_Values in an expression

(Variable) OUT_MUL_Values  :LKP.LKP_UNCONN(DEPTNO)


O_DNAME =     REG_EXTRACT(OUT_MUL_Values,'(\w+)\s+(\w+)',1)
O_LOC  =           REG_EXTRACT(OUT_MUL_Values,'(\w+)\s+(\w+)',2)

> Connect to target...

Best Regards,
Moorthy. G

Sunday, 24 June 2012


SQL QUESTIONS AND ANSWERS


1. Select duplicate value from the table?

select no, name from tt group by no, name having count(no) > 1;

2. Delete duplicate record from the table.

delete from tt a where rowid <> (select max(rowid) from tt b where a.no=b.no);


3. Delete duplicate record from the table which is recent

delete from tt a where rowid <> (select min(rowid) from tt b where a.no=b.no);

4. Delete duplicate record from the table which is old fear.

delete from tt a where rowid <> (select max(rowid) from tt b where a.no=b.no);

5. select top 5 salary

SELECT ENAME, SAL FROM ( SELECT ENAME, SAL FROM EMP ORDER BY SAL DESC) WHERE ROWNUM <=5;

6. select senior 5 people

SELECT ENAME, HIREDATE FROM EMP WHERE ROWNUM <=5

7. select top 2 salary for each dept

SELECT ENAME, SAL, DEPTNO FROM( SELECT ROW_NUMBER() OVER(PARTITION BY DEPTNO ORDER BY SAL DESC) RN, ENAME, SAL, DEPTNO FROM EMP) WHERE RN <=2;

8. select top 2 salary using rank()

SELECT ENAME, SAL FROM(SELECT RANK() OVER(ORDER BY SAL DESC) RN, ENAME, SAL FROM EMP) WHERE RN<=2;

9. What is rank and dense rank?
rank()

1 100
2 50
2 50
4 30

DENSE_rank()

1 100
2 50
2 50
3 30

10. how many employes are working in each deptment table

SELECT D.DEPTNO, COUNT(E.EMPNO) "Number Of Employees" FROM EMP E, DEPT D WHERE E.DEPTNO=D.DEPTNO GROUP BY D.DEPTNO;

12. select name, manager_Name for each employee.

 SELECT E.ENAME, E1.ENAME FROM EMP E, EMP E1 WHERE E.MGR=E1.EMPNO;


SELECT E.ENAME, E1.ENAME FROM EMP E LEFT OUTER JOIN EMP E1 ON   E.MGR=E1.EMPNO;

13. How to convert column to column in oracle?


SELECT *FROM (
SELECT NAME,
CASE PIVOT
WHEN 1
THEN CUST_VALUE_1
WHEN 2
THEN CUST_VALUE_2
WHEN 3
THEN CUST_VALUE_3
END SALARY FROM TR1,(SELECT ROWNUM PIVOT FROM DUAL CONNECT BY LEVEL <=3))
ORDER BY NAME;

14. Select First and Second Half Record:

select *from emp where rownum <= (select count(*)/2 from emp) --------------  First Half


select *from emp minus select *from emp where rownum <= (select count(*)/2 from emp)   --------------- Second Half


Saturday, 9 June 2012

How to create sequence number using trigger?

create sequence SEQ_NAME start with 1;

Sequence created.

SQL> create or replace trigger TRIGG_NAME
2 before insert on TABLE_NAME
3 for each row
4 begin
5 select SEQ_NAME.nextval
6 into :new.COLUMN
7 from dual;
8 end;
9 /

Trigger created.

Regards,
Moorthy. G

Monday, 7 May 2012

How to load Workflow using PMCMD Command

#!/bin/ksh
DATE=$1         
# Reads the variables from the environment file.
. ./.salesenv

/stage_area/pm/script/RemoveDate.sh -d $DATE /stage_area/pm/SrcFiles/basdb A.TNB2.dat B.TNB2.dat C.TNB2.dat
errorcode="$?"
if [ $errorcode -ne 0 ]; then
        echo "Couldn't load with date $DATE, Please chek the files!"
fi
$PMDIR/pmcmd startworkflow -sv ${PMSERVICE} -d ${PMDOMAIN} -u ${PMUSER} -p ${PMLOSEN} -f ${PMFOLDER} -wait bLoadSaleDomainMan
errorcode="$?"
if [ $errorcode -ne 0 ]; then
        echo "Batch failed loading the file with date $ DATE"
        exit 1
fi
rm $LOADDIR/A.TNB2.dat
rm $LOADDIR/B.TNB2.dat
rm $LOADDIR/C.TNB2.dat