Friday, November 17, 2006

Informatica 7.1:How to validate multiple mappings in one shot....Unix Shell Script

In my previous post the I have described the problem while validating multiple mappings.
Here is the script to find out which mappings are valid and whcih are invalid....

##########################################################################################################
# Script: This is the wrapper script to collect invalid objetcs at one shot of informatica. #
# Author: M.A.Hasim
# Modification:
# Modification
# History: 11-16-2006-- INTIAL VERSION
# Calling: fetch_object_map_v1.sql
# Called By: None
##########################################################################################################

. .my_env
rm -f mappingcheckhasim_v1.sh validoutput.txt
echo "Collecting Objects To Be Validated...."
if [ $# -eq 0 ];
then
sqlplus -s $CNCTDEV @fetch_object_map_full.sql
chmod 777 mappingcheckhasim_v1.sh
totmapno=`wc -l mappingcheckhasim_v1.sh|cut -d" " -f1`
cp mappingcheckhasim_v1.sh $PM_HOME/../repositoryserver
cd $PM_HOME/../repositoryserver
echo "Starting Validation of $totmapno mappings...."
echo "At -----`date`----- Please wait..It May Take Some Time..."
exec
pmrep $PMREPCONDEV
if [ $? -eq 0 ];
then
echo "Connected With Infa...Parsing..Wait..It may take some time..."
fi;
pmrep run -f mappingcheckhasim_v1.sh -o validoutput.txt -e Hasim
if [ $? -ne 0 ];
then
errormapping=`tail -10 validoutput.txt|grep 'validate -n'|cut -d" " -f3`
echo "Internal Error Occurred While validating $errormapping"
echo "If you wish to get Info about remaining mappings..."
echo "Run again"
echo "Please dont delete mails untill you become sure you got all info..."
fi;
wait
#exit 0
echo "Validation Finished at -----`date`-----Sending Mail..."
rm -f mappingcheckhasim_v1.sh
cd -
mv $PM_HOME/../repositoryserver/validoutput.txt .
grep 'is VALID **' validoutput.txt>validmappings.txt
grep 'is INVALID ***' validoutput.txt>invalidmappings.txt
totvalidmapno=`wc -l validmappings.txt|cut -d" " -f1`
totinvmapno=`wc -l invalidmappings.txt|cut -d" " -f1`
if [ -s validmappings.txt ];then
cat validmappings.txt|mailx -s "$totvalidmapno Valid mappings in DEV " m_a_hasim@yahoo.com
else
echo "No Valid mappings in DEV"| mailx -s "No Valid mappings in DEV " m_a_hasim@yahoo.com
fi;

if [ -s invalidmappings.txt ];then
cat invalidmappings.txt|mailx -s "$totinvmapno Invalid mappings in DEV " m_a_hasim@yahoo.com
else
echo "No Invalid mappings in DEV"| mailx -s "No Invalid mappings in DEV " m_a_hasim@yahoo.com
fi;

echo "Cheers...Go Ahead..."

else

echo "Starting after mapping $1......"
sqlplus -s $CNCTDEV @fetch_object_map_partial.sql $1
chmod 777 mappingcheckhasim_v1.sh
totmapno=`wc -l mappingcheckhasim_v1.sh|cut -d" " -f1`
cp mappingcheckhasim_v1.sh $PM_HOME/../repositoryserver
cd $PM_HOME/../repositoryserver
echo "Starting Validation of $totmapno mappings...."
echo "At -----`date`----- Please wait..It May Take Some Time..."
exec
pmrep $PMREPCONDEV
if [ $? -eq 0 ];
then
echo "Connected With Infa...Parsing..Wait..It may take some time..."
fi;
pmrep run -f mappingcheckhasim_v1.sh -o validoutput.txt -e Hasim
if [ $? -ne 0 ];
then
errormapping=`tail -10 validoutput.txt|grep 'validate -n'|cut -d" " -f3`
echo "Internal Error Occurred While validating $errormapping"
echo "If you wish to get Info about remaining mappings..."
echo "Run again"
echo "Please dont delete mails untill you become sure you got all info..."
fi;
wait
#exit 0
echo "Validation Finished at -----`date`-----Sending Mail..."
rm -f mappingcheckhasim_v1.sh
cd -
mv $PM_HOME/../repositoryserver/validoutput.txt .
grep 'is VALID **' validoutput.txt>validmappings.txt
grep 'is INVALID ***' validoutput.txt>invalidmappings.txt
totvalidmapno=`wc -l validmappings.txt|cut -d" " -f1`
totinvmapno=`wc -l invalidmappings.txt|cut -d" " -f1`

if [ -s validmappings.txt ];then
cat validmappings.txt|mailx -s "$totvalidmapno Valid mappings in DEV after error Occured in $1" m_a_hasim@yahoo.com
else
echo "No Valid mappings in DEV after error Occured in $1"| mailx -s "No Valid mappings in DEV after error Occured in $1 " m_a_hasim@yahoo.com
fi;
if [ -s invalidmappings.txt ];then
cat invalidmappings.txt|mailx -s "$totinvmapno Invalid mappings in DEV after error Occured in $1" m_a_hasim@yahoo.com
else
echo "No Invalid mappings in DEV after error Occured in $1"| mailx -s "No Invalid mappings in DEV after error Occured in $1 " m_a_hasim@yahoo.com
fi;
echo "Cheers...Go Ahead..."
fi;



Steps Followed:-
1/
Collected all mappings to be validated.
2/
Made pmrep statements for validation.
3/
sorted valid mappings and invalid mappings in different files.
4/
Mailed them.

Error Handling:-
Some times wat happened is,while validating,pmrep got stuck for some mappings and come out.That time my scipt will tell that there is a problem while validating any specific mapping.And then will give you option to start validating remaining mappings.




---: My blog is not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m_a_hasim@yahoo.com

Labels:

Thursday, November 16, 2006

Informatica 7.1 : How to validate all mappings in a reposirory in one shot

Problem :
We are to upgrade INFA7.1 to INFA8.1.The most common problem is after upgrading many mappings just become invalid which remains valid before upgradation.We faced that problem while exporting-importing also.
So our first concern is to find out
i/
which mappings becomes invalid after upgradation
ii/
Sort out them.Fix them.
iii/
Restore them.

But the first task iteself is tough as we have almost 700 mappings on run.So its tedious and cumbersome if we are to check them manually one by one.

Solution:
I have automated the whole process of cheking which will tell you which mapping are invalid after parsing them.

Process:
i/
INFA has its own repository in which it keeps all records,status about all mappings.
At first we are to find out from the metadata level which mappings are of which status.
So we will creat a wrapper unix shell ( main_map_check_hasim_v1.sh ) in which we will call a sql script having the following sql code.

select 'validate -n '||parent_mapping_name||' -o mapping -f '||parent_subject_area||' -p valid,invalid_before,invalid_after -b' from rep_all_mappings where order by parent_subject_area

ii/
we will take all the output in one spool file which will be the feeder for the main unix script ( pmrep_map_check_hasim_v1.sh ).

iii/
making that mappingcheckhasim_v1.sh excecutable.

iv/
invoke pmrep-->connect-->call that mappingcheckhasim_v1.sh with appropriate parameters.

connect -r repositoryname -n repositoryuser -x repositorypassword -h repositoryhostname -o repositorportno

run -f validchekhasimrun.sh -o validoutput.txt
run -f invalidchekhasimrun.sh -o invalidoutput.txt

v/
Exit from pmrep,look for the output file which has been created by pmrep.grep it for 'invalid' entities,create file for those invalid mappings,send it to prospective users.

Enhancement:

i/
Help developers giving them the reson for invalid mappings.
ii/
Help developers assisting them to validate it.
iii/
Help developers assisting them to save it.
iv/
Help developers assisting them to check-in it with proper message.
---: My blog is not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m_a_hasim@yahoo.com

Labels:

Friday, November 03, 2006

Informatica Error: ORA-00932: inconsistent datatypes: expected %s got %s

The error is something like this which you can collect from sessionlog.

READER_1_1_1> BLKR_16007 Reader run started.
READER_1_1_1> RR_4029 SQ Instance [SQ_Shortcut_To_table_A] User specified SQL Query [SELECT table_A.field1,table_A.field2, table_A.field3, table_A.field4, table_A.field5, table_A.field6, table_A.field7, table_A.field8, table_A.field9, table_A.field10, table_A.field11, table_A.field12, table_A.field13, table_A.field14, table_A.field15, table_A.field16
FROM Schema_a.table_A
WHERE
table_A.field10 IS NOT NULL AND
table_A.field11 = 'N']
READER_1_1_1> Thu Nov 02 21:37:13 2006
READER_1_1_1> RR_4035 SQL Error [
ORA-00932: inconsistent datatypes: expected %s got %s


Resolution:-Check your SQL qualifier transformation,validate the SQL Query.And then keep on checking other transformations whether any inconsistent data flow is happenning there.In my case I was trying to squeeze records from one port(number(10,2)) of SQL Source Qualifier tranasformation to the target port(decimal(8)) of the Expression Transformation.And hence was the error.

---: My blog is not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m_a_hasim@yahoo.com

Labels: