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 5 December 2011

What is the use of "plus sign" in where clause?

Ex:
column = 'String_Value'
column (+) = 'String_Value'

SQL> select d.deptno, d.dname, count(e.empno) cnt
  2  from dept d, emp e
  3  where e.deptno (+) = d.deptno
  4    and e.ename      = 'SMITH'
  5  group by d.deptno, d.dname
  6  order by d.deptno
  7  /
    DEPTNO DNAME                 CNT
---------- -------------- ----------
        20  RESEARCH                1

1 row selected.

SQL> select d.deptno, d.dname, count(e.empno) cnt
  2  from dept d, emp e
  3  where e.deptno (+) = d.deptno
  4    and e.ename  (+) = 'SMITH'
  5  group by d.deptno, d.dname
  6  order by d.deptno
  7  /
    DEPTNO DNAME                 CNT
---------- -------------- ----------
        10  ACCOUNTING              0
        20  RESEARCH                    1
        30  SALES                            0
        40  OPERATIONS               0

4 rows selected.
Best Regards,
Moorthy. G

Saturday 26 November 2011

ORA-27101 SHARED MEMORY REALM DOES'NT EXIST

When you get this error message ->
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist


check that oracle service has been started -
For Windows machine go to run -> type services.msc -> start the respective oracle sevice .
Evan after this the same error comes then manually start the service in command prompt.

For Windows machine go to run -> type cmd

Type the following commands
C:\set oracle_sid = sidname
C:\sqlplus
SQL*Plus: Release 8.1.7.0.0 - Production on Mon Oct 19 14:58:50 2009

(c) Copyright 2000 Oracle Corporation. All rights reserved.

Enter user-name: sys/sys as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 237856796 bytes
Fixed Size 75804 bytes
Variable Size 80416768 bytes
Database Buffers 157286400 bytes
Redo Buffers 77824 bytes
Database mounted.
Database opened.
SQL> exit
Then you can start oracle. It will work.

Best Regards,
Moorthy. G

Wednesday 9 November 2011

How to create a table and insert values using script?

#! /bin/sh
ORACLE_VALUE=`sqlplus -s schema_name/pwd@server_name << EOFSQL
set head off
CREATE TABLE TEST20(NO NUMBER NOT NULL, NAME VARCHAR2(20));
INSERT INTO test20 VALUES (10,'A');
INSERT INTO test20 VALUES (20,'B');
INSERT INTO test20 VALUES (30,'C');
INSERT INTO test20 VALUES (40,'D');
COMMIT;
exit;
EOFSQL`

Sunday 23 October 2011

Informatica Interview Questions And Answers_Part 1

1. How to get UNIQUE Record?

S-SQ-SRT-EXP-FLT OR RTR – TGT

In Expression:

flag = Decode(true,eid=pre_eid, 'Y','N')

flag_out = flag

pre_eid=eid


2. How to get sequence value using Expression?

v_temp= v_temp+1

o_seq=IIF(ISNULL(v_temp), 0, v_temp)


3. How will restrict values in 0-9,  A-Z, a-z and special character. Only allowed these chars otherwise we will reject the records?

Answer:

Using RegMatch in Informatica to validate

IIF(reg_match(in_Email,'^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$'),'Valid','Invalid')

4. What is diff between Decode and case? Give some Example?

In case, you can use logic as >, <, <=,>= , whereas in  decode you can only use =.

Example:1

select

case snum

when snum > 10 then 'High'

when snum>5 then 'Low'

end

from sales..

Ex:2

select decode(snum,10,'high',5,'low') from sales...


5. What is the difference between bitmap and btree index?

Bitmap index is used for repeating values.

 Ex: Gender: male/female

       Account status: Active/Inactive

Btree index is used for unique values.

 Ex: Emp_id.

Thursday 13 October 2011

Renaming a file and append it with a date

$  touch temp
$ mv temp temp_`date +"%Y%m%d"`

Output: temp_20111013
FTP File Transfer

#! /usr/bin/ksh
ftp -v -n "servername" << cmd
user "username" "pwd"
cd /stage_area/pm/sales/script
lcd /stage_area/pm/sales/script get loadCash_new
put loadCash_new
quit
cmd

Wednesday 12 October 2011

Create A Deployment Group In Informatica Power center

Create A Deployment Group In Informatica Power Center

Step 1. Create a label

In Informatica Power Repository Manager
Click on Versioning à Labels à New
Choose a name like INITXXXXXXX (depending on which INIT this label is for) and write a comment like “Due to Release 10.1”.

Step 2. Applying Labels to Objects

In Informatica Power Center Designer.
Choose the object that you want to apply a label on. For example a mapping like m_LoadSalesDetail 
Right click on the mapping à Versioning à View History
Choose the mapping.
Click on Tools à Labels à Apply Labels
If there is a totally new mapping/object you should choose both “Label all Children” and “Label all Parents” and if it´s only an update of a current mapping you only choose “Label all Children”.

Step 3. Create a Deployment Group

You can create two types of deployment groups; Static and Dynamic.
StaticYou populate a static deployment group by manually selecting objects. Create a static deployment group if you do not expect the set of deployment objects to change. For example, you might group objects for deployment on a certain date and deploy all objects at once.
 Dynamic. You use the result set from an object query to populate the deployment group. Create a dynamic deployment group if you expect the set of deployment objects to change frequently. For example, you can use a dynamic deployment group if you develop multiple objects to deploy on different schedules. You can run the dynamic deployment group query multiple times and add new objects to the group each time you run the query.
Most commonly you choose to create a Static Deployment group.
To create a deployment group:
  1. In the Repository Manager, choose the first mapping.
  2. Click Versioning à Deployment à Groups to view the existing deployment groups in the Deployment Group Browser.
2. Click New to configure the deployment group in the Deployment Group Editor.
3. Enter a name for the deployment group like INITXXXXXXX
4. Select whether to create a static or dynamic deployment group.
5. If you are creating a dynamic deployment group, click Queries to select a query from the Query Browser, and then click Close to return to the Deployment Group Editor.
6. Optionally, enter a comment for the deployment group for ex. Due to  Release 10.1
7. Click OK.
After you create a deployment group, it appears in the Deployment Groups node in the Navigator of the Repository

Step 4. Add objects to the deployment group.


In the Repository Manager
Right-click an object you want to add to the deployment group.
Click Versioning à View History à Tools à Add to Deployment group
Choose the deployment group that you want to add the object to.
Loop this step until you have moved all objects that you want to have in the deployment group.
If this was done for a release, don´t forget to update the release notes with the path and name of the deployment group that you have created.

Tuesday 11 October 2011

Important SQL Questions And Answers

1) My boss has changed his mind. Now he doesn't want to pay more than 10,000.so revoke that salary constraint.
SQL>alter table emp modify constraint chk_001 enable;
2) Add column called as mgr to your emp table;
SQL>alter table emp add(mgr number(5));
3) Oh! This column should be related to empno. Give a command to add this constraint.
SQL>ALTER TABLE EMP ADD CONSTRAINT MGR_DEPT FOREIGN KEY(MGR) REFERENCES EMP(EMPNO)
4) Add deptno column to your emp table;
SQL>alter table emp add(deptno number(5));
5) This deptno column should be related to deptno column of dept table;
SQL>alter table emp add constraint dept_001 foreign key(deptno)
reference dept(deptno) [deptno should be primary key]
6) Give the command to add the constraint.
SQL>alter table <table_name) add constraint <constraint_name>
<constraint type>
7) Create table called as newemp. Using single command create this table as well as get data into this table(use create table as);
SQL>create table newemp as select * from emp;
SQL>Create table called as newemp. This table should contain only
empno,ename,dname.
SQL>create table newemp as select empno,ename,dname from emp,dept where 1=2;
8) Delete the rows of employees who are working in the company for more than 2 years.
SQL>delete from emp where (sysdate-hiredate)/365>2;
9) Provide a commission(10% Comm Of Sal) to employees who are not earning any commission.
SQL>select sal*0.1 from emp where comm is null
10) If any employee has commission his commission should be incremented by 10% of his salary.
SQL>update emp set comm=sal*.1 where comm is not null;
21) Display employee name and department name for each employee.
SQL>select empno,dname from emp,dept where emp.deptno=dept.deptno
22)Display employee number,name and location of the department in which he is working.
SQL>select empno,ename,loc,dname from emp,dept where emp.deptno=dept.deptno;
23) Display ename,dname even if there are no employees working in a particular department(use outer join).
SQL>select ename,dname from emp,dept where emp.deptno=dept.deptno(+)
24) Display employee name and his manager name.
SQL>select p.ename,e.ename from emp e,emp p where e.empno=p.mgr;
25) Display the department name and total number of employees in each department.
SQL>select dname,count(ename) from emp,dept where emp.deptno=dept.deptno group by dname;
26)Display the department name along with total salary in each department.
SQL>select dname,sum(sal) from emp,dept where emp.deptno=dept.deptno group by dname;
27) Display itemname and total sales amount for each item.
SQL>select itemname,sum(amount) from item group by itemname;
28) Write a Query To Delete The Repeated Rows from emp table;
SQL>Delete from emp where rowid not in(select min(rowid)from emp group by ename)
29) TO DISPLAY 5 TO 7 ROWS FROM A TABLE
SQL>select ename from emp where rowid in(select rowid from emp where rownum<=7 minus select rowid from empi where rownum<5)
30) DISPLAY TOP N ROWS FROM TABLE?
SQL>SELECT * FROM (SELECT * FROM EMP ORDER BY ENAME DESC)WHERE ROWNUM <10;
31) DISPLAY TOP 3 SALARIES FROM EMP;
SQL>SELECT SAL FROM ( SELECT * FROM EMP ORDER BY SAL DESC ) WHERE ROWNUM <4
32) DISPLAY 9th FROM THE EMP TABLE?
SQL>SELECT ENAME FROM EMPWHERE ROWID=(SELECT ROWID FROM EMP WHERE ROWNUM<=10 MINUS SELECT ROWID FROM EMP WHERE ROWNUM <10)
33) select second max salary from emp;
select max(sal) fromemp where sal<(select max(sal) from emp);