Saturday, September 27, 2014

Information Power center 9.1 Free download

Information Power center 9.1 (with Data Quality), Oracle,Microsoft SQL Server And Teradata (Free Download) all in one package.

Free Informatica Power Center 9.1(With direct and Server installed Pack) for all windows Vist, Windows 8/7.

No need to install server and client. just unzip the below links and open with VMware.
Up and running power center is ready to get started.

Installation Steps:-

Check the below video on how to install
https://www.youtube.com/watch?v=y9q3_7VctKY&feature=youtu.be

download links:-

Part 1:-
https://drive.google.com/file/d/0B6HgeXG_yRq1Y1ZPZHNGSFB3bVk/edit?usp=sharing

Part 2:-
https://drive.google.com/file/d/0B6HgeXG_yRq1Z1F6b3ZlZFJNcUk/edit?usp=sharing

Part 3:-
https://drive.google.com/file/d/0B6HgeXG_yRq1Q0FMQ1BLX29Lbk0/edit?usp=sharing

Part 4:-
https://drive.google.com/file/d/0B6HgeXG_yRq1RHdnUUdUYzBJLW8/edit?usp=sharing

Part 5:-
https://drive.google.com/file/d/0B6HgeXG_yRq1R1FjU1hYTnB2Rlk/edit?usp=sharing

Part 6:-
https://drive.google.com/file/d/0B6HgeXG_yRq1TnZTd2RFcGdVQzA/edit?usp=sharing

VMware:-
https://drive.google.com/file/d/0B6HgeXG_yRq1OTNmaENQS3FLSFU/edit?usp=sharing

Software versions:-
Oracle 9i
Microsoft SQL Server 2005
Teradata 13

Monday, September 22, 2014

Netezza Functions

SQL server equivalent functions in Netezza

** As Netezza is case sensitive be careful with String comparison (best practice to use upper/lower case when comparing string columns both the sides) this applicable for joining group by as well.
The exception is when one wants to find a specific string (ex: - I want to search only ‘NeteZZA’ in my column).

String Functions
Date Functionss 
Sno

SQL Server Functions

Netezza Functions

Purpose of the function


SUBSTRING(CASE_NO, PATINDEX('%[^0 ]%', CASE_NO+ ' '), LEN(CASE_NO))  
ltrim(CASENUMBER,'0')

Remove left hand side zero’s from case number



RTRIM (CASENUMBER,'0')
EX:- RTRIM (0011124500,'0')
Result:- 00111245

Remove right hand side zero’s from case number


LEFT()
substr()
EX:-  substr(VAMSHI’,0,3)
Result ‘VA’

When we want only LEFT had side last 3 digits or charades


RIGHT()
substr('VAMSHI',LENGTH('VAMSHI')-1)

RESULT:- HI
Formula for last 2 alphabets do Length -1
For 3 its length -2
For 4 its Length -3
Use when we need Right hand side digits or charades


CONVERT(VARCHAR(10), DATE_FLD, 101)
TO_CHAR(RECIEVEDATE,'DD/MM/YYYY')
To convert date to the format we want
Ex:- 'DD/MM/YYYY' or ‘DD/MON/YYYY etc.,


Like Function
Like
The LIKE  function syntax and functionality is same to SQL server


Case Function
Case
The CASE function syntax and functionality is same to SQL server

DATE FUNCTION (For numeric result)



Year(RCV_DAY_DAY_DT)
extract(year from RCV_DAY_DAY_DT)

This give us the year
EX:- 2014


MOTH(RCV_DAY_DAY_DT)
extract(MOTH from RCV_DAY_DAY_DT)

This give us the year
EX:- 1(JAN)


DAY(RecieveDate)
extract(DAY from current_date)
This give us day of the year
EX:- 14(day of the year)



extract(WEEK from current_date)
Week of the year
EX:- its 38 week of this year 2014

                                                                       DATE FUNCTION (For String result)




to_char(DATE_D,'DAY')

EX:- ‘WEDNESDAY’



to_char(DATE_D,'Month')

EX:- September

                                  Adding months days and to get QUARTER out of DATE






SELECT EXTRACT(QUARTER FROM now());
To get the quarter from DATE



months_between(d1, d2)
To get the months between 2 dates



age(t,t)
To get the difference between to dates



last_day(now())
To get the last day of the month



add_months(now(),-1))
To Add or subtract a month to the date



date_part('Month', to_date('2014201', 'YYYYDDD'));
Extract month from julian date in netezza







First 10 records or Top 100 records


TOP 1
LIMIT 1
It limits the no of records we want to see


LIMIT 2 OFFSET 2
Ex:-
SELECT * FROM TABLE ORDER BY CASENUMBER LIMIT 2 OFFSET 2
Offset will skip the first 2 records and limit will give 3 and 4 records

**Order by is key for these functions

How to get part of a string separated any symbol's character
Ex:- Comma, Tab, Star etc.,

Function:-
select get_value_varchar(array_split('IBM_NETEZZA_DB_FUNCTIONS','_') , 4);

 Explanation:-
Actual String                  'IBM_NETEZZA_DB_FUNCTIONS'
Position of the string           1      2    3   4  

Result:- 
           'FUNCTIONS'

Functions available in Netezza(in your database)

Select * from _v_Function

the above query will list all the functions available in database.

Netezza is case sensitive:-
Is there a way to make Netezza case insensitive?



Let's see how it will effect and how to handle it in Netezza.


Example 1:- 


WITH test (NAME)
     AS (SELECT 'Netezza' AS NAME
         UNION
         SELECT 'Netezza Db' AS NAME1)
SELECT NAME
FROM   test
WHERE  NAME = 'netezza' 


Result:-  No records found 


The above behavior is not at all weird, Some one worked on SQL server may feel it as weird (as it is case insensitive)


Example 2:-

WITH test (NAME)
     AS (SELECT 'Netezza' AS NAME
         UNION
         SELECT 'Netezza Db' AS NAME1)
SELECT NAME
FROM   test
WHERE  NAME LIKE '%ntezza%'  


Result:- No records found

Example 3:-

WITH test (NAME)
     AS (SELECT 'Netezza' AS NAME
         UNION
         SELECT 'NeTezZa' AS NAME1

         UNION
         SELECT 'NETEZZA' AS NAME1
         UNION
         SELECT 'netezza' AS NAME1)

SELECT NAME ,COUNT(*) AS COUNT
FROM   test
Group by NAME

Result:-  Name           COUNT    
         "Netezza"          1
         "NeTezZa"          1
         "NETEZZA"          1
         "Netezza"          1
 Case sensitive has to handle in below cases.

1) While joining two string columns
2) Group by and Order by (by string columns)
3) WHERE or LIKE conditions.
4) CASE statements or DECODE statements.


The best way to handle is to handle it in the first place ETL.

To handle the same in Netezza data base we have the below function.

Let's see the difference using the function "UPPER".

WITH test (NAME)
     AS (SELECT 'Netezza' AS NAME
         UNION
         SELECT 'NeTezZa' AS NAME1

         UNION
         SELECT 'NETEZZA' AS NAME1
         UNION
         SELECT 'netezza' AS NAME1)

SELECT UPPER(NAME) ,COUNT(*) AS COUNT
FROM   test
Group by UPPER(NAME)

Result:-  Name           COUNT    
         "NETEZZA"          4


Sunday, September 21, 2014

Informatica Audit Framework

Different name but the requirement or functionality is same:-


1) An ETL/Informatica Framework for Operational Metadata Logging

2) Process Control / Audit of Workflows in Informatica 

3) ETL Audit and Control information

4) A Scheduler framework for Audit - Balance and Control

5) Collecting Session Stat for audit purpose

below is the approach to implement the above requirement:-

Approach:-

The above requirement can be implemented using Informatica repository Views:-

The 2 vies used for this framework are:-
REP_SESS_LOG and REP_SESS_TBL_LOG one can find these view in the data base where Informatica repository server installed.

Let's understand what blow query will do. 

 Both query's will return last session run related records.

for example in the development Env we have 6 months of data in the views, out of that we will get only last run information for each session in a folder (as we are filtering data based on the folder first) **Where SUBJECT_AREA=PROJECT_FOLDER.





Querys:-

SELECT 
A.SUBJECT_AREA               AS FOLDER_NAME,
B.WORKFLOW_NAME              AS WORKFLOW_NAME     ,    
B.SESSION_NAME               AS SESSION_NAME, 
B.MAPPING_NAME               AS MAPPING_NAME,
A.TYPE_NAME                  AS TABLE_TYPE_NAME ,
A.TABLE_NAME                 AS TARGET_TABLE_NAME ,
A.TABLE_INSTANCE_NAME        AS TARGET_INSTANCE_NAME,
B.SUCCESSFUL_SOURCE_ROWS     AS TOTAL_SRC_RECORD_COUNT,
B.FAILED_SOURCE_ROWS         AS REJECTED_SRC_RECORD_COUNT,
A.SUCCESSFUL_AFFECTED_ROWS   AS AFFECTED_TGT_RECORD_COUNT,
A.FAILED_ROWS                AS REJECTED_TGT_RECORD_COUNT,
TO_CHAR(B.ACTUAL_START,'MM/DD/YYYY HH24:MI:SS') AS SESSION_START_DATE, 
TO_CHAR(B.SESSION_TIMESTAMP,'MM/DD/YYYY HH24:MI:SS') AS SESSION_END_DATE, 
TO_CHAR(A.START_TIME  ,'MM/DD/YYYY HH24:MI:SS') AS TARGET_LOAD_START_TIME,
TO_CHAR(A.END_TIME,'MM/DD/YYYY HH24:MI:SS')  AS    TARGET_LOAD_END_TIME,
THROUGHPUT                   AS TARGET_THROUGHPUT,
B.FIRST_ERROR_MSG            AS FIRST_ERROR_MSG,
B.FIRST_ERROR_CODE           AS FIRST_ERROR_CODE,
B.LAST_ERROR                 AS LAST_ERROR,
B.LAST_ERROR_CODE            AS LAST_ERROR_CODE
FROM 
DEV9.REP_SESS_TBL_LOG A , DEV9.REP_SESS_LOG B
WHERE 
A.WORKFLOW_ID=B.WORKFLOW_ID
AND 
A.SESSION_ID=B.SESSION_ID   
AND 
A.END_TIME<=B.ACTUAL_START
AND 
A.END_TIME>=B.SESSION_TIMESTAMP
AND
A.SUBJECT_AREA='BI_CORE_Work'            
ORDER BY 
A.START_TIME DESC;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SELECT * FROM (SELECT 
SUBJECT_AREA AS FOLDER_NAME, 
WORKFLOW_NAME,
SESSION_NAME, 
MAPPING_NAME,
TRUNC (MOD ( (SESSION_TIMESTAMP - ACTUAL_START)* 24, 24))
|| ' HOUR '|| TRUNC (MOD ( (SESSION_TIMESTAMP - ACTUAL_START) * 24 * 60, 60))
|| ' MIN '|| TRUNC ( MOD ( (SESSION_TIMESTAMP - ACTUAL_START) * 24 * 60 * 60, 60))
|| ' SEC ' AS RUN_TIME,
ACTUAL_START AS SESSION_START_DATE, 
SESSION_TIMESTAMP AS SESSION_END_DATE, 
SUCCESSFUL_SOURCE_ROWS AS SRC_SUCCESSFUL_RECORD_COUNT, 
SUCCESSFUL_ROWS AS        TGT_SUCCESSFUL_RECORD_COUNT,
FAILED_SOURCE_ROWS AS     SRC_REJECTED_RECORD_COUNT, 
FAILED_ROWS AS            TGT_REJECTED_ROWS_COUNT,
FIRST_ERROR_CODE  AS ERROR_CODE,
DECODE (RUN_STATUS_CODE, 1, 'SUCCEEDED', 2, 'DISABLED', 3, 'FAILED', 4, 'STOPPED', 5, 'ABORTED',
6, 'RUNNING', 7, 'SUSPENDING', 8, 'SUSPENDED', 9, 'STOPPING', 10, 'ABORTING', 11, 'WAITING',
12, 'SCHEDULED', 13, 'UNSCHEDULED', 14, 'UNKNOWN', 15, 'TERMINATED', 'UNKNOWN') AS RUN_STATUS,
FIRST_ERROR_MSG AS FIRST_ERR_OF_THE_MAPPING,
LAST_ERROR AS LAST_ERR_OF_THE_MAPPING,
ROW_NUMBER() OVER(PARTITION BY SESSION_ID,WORKFLOW_ID 
ORDER BY workflow_run_id DESC) AS LATES_VESRION_ID
FROM 
DEV9.REP_SESS_LOG
WHERE
 SUBJECT_AREA='BI_CORE_Work' AND SESSION_NAME='s_m_veeba_bi_load_STG_SRVC_stg')
 WHERE LATES_VESRION_ID=1;

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT 
A.SUBJECT_AREA               AS FOLDER_NAME,
B.WORKFLOW_NAME              AS WORKFLOW_NAME     ,    
B.SESSION_NAME               AS SESSION_NAME, 
B.MAPPING_NAME               AS MAPPING_NAME,
A.TYPE_NAME                  AS TABLE_TYPE_NAME ,
A.TABLE_NAME                 AS TARGET_TABLE_NAME ,
A.TABLE_INSTANCE_NAME        AS TARGET_INSTANCE_NAME,
B.SUCCESSFUL_SOURCE_ROWS     AS TOTAL_SRC_RECORD_COUNT,
B.FAILED_SOURCE_ROWS         AS REJECTED_SRC_RECORD_COUNT,
A.SUCCESSFUL_AFFECTED_ROWS   AS AFFECTED_TGT_RECORD_COUNT,
A.FAILED_ROWS                AS REJECTED_TGT_RECORD_COUNT,
TO_CHAR(B.ACTUAL_START,'MM/DD/YYYY HH24:MI:SS') AS SESSION_START_DATE, 
TO_CHAR(B.SESSION_TIMESTAMP,'MM/DD/YYYY HH24:MI:SS') AS SESSION_END_DATE, 
TO_CHAR(A.START_TIME  ,'MM/DD/YYYY HH24:MI:SS') AS TARGET_LOAD_START_TIME,
TO_CHAR(A.END_TIME,'MM/DD/YYYY HH24:MI:SS')  AS    TARGET_LOAD_END_TIME,
THROUGHPUT                   AS TARGET_THROUGHPUT,
B.FIRST_ERROR_MSG            AS FIRST_ERROR_MSG,
B.FIRST_ERROR_CODE           AS FIRST_ERROR_CODE,
B.LAST_ERROR                 AS LAST_ERROR,
B.LAST_ERROR_CODE            AS LAST_ERROR_CODE
FROM 
DEV9.REP_SESS_TBL_LOG A , DEV9.REP_SESS_LOG B
WHERE 
A.WORKFLOW_ID=B.WORKFLOW_ID
AND 
A.SESSION_ID=B.SESSION_ID   
AND 
A.END_TIME>=B.ACTUAL_START
AND 
A.END_TIME<=B.SESSION_TIMESTAMP
AND
A.SUBJECT_AREA='BI_CORE_Work'            
ORDER BY 
A.START_TIME DESC;