0% found this document useful (0 votes)
136 views8 pages

Informatica Repository

The document contains 13 queries for Informatica and 3 queries for Teradata. The Informatica queries are used to retrieve mappings, workflows, sessions and other metadata information from the Informatica repository. The Teradata queries are used to retrieve user access reports on database objects, table sizes, and disk space information from the Teradata database.

Uploaded by

Venkat Bharadwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views8 pages

Informatica Repository

The document contains 13 queries for Informatica and 3 queries for Teradata. The Informatica queries are used to retrieve mappings, workflows, sessions and other metadata information from the Informatica repository. The Teradata queries are used to retrieve user access reports on database objects, table sizes, and disk space information from the Teradata database.

Uploaded by

Venkat Bharadwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

INFORMATICA QUERIES

Query1:

Source Qualifier Query:


With z as
(
select mapping_id,max(mapping_version_number) as mapping_version_number
from rep_all_mappings group by mapping_id),
x as (select b.mapping_id,b.widget_id,max(b.version_number) as version_number
from
rep_widget_inst b where b.widget_type =3 group by b.mapping_id,b.widget_id),
y as (select c.widget_id,max(c.version_number) from rep_widget_attr c where
attr_name ='SQL_QUERY'
group by c.widget_id)
select distinct
a.subject_area,a.mapping_name,b.instance_name,c.attr_value,a.mapping_versio
n_number,
b.version_number,c.version_number
from
rep_all_mappings a,
rep_widget_inst b,
rep_wdget_attr c ,z,x,y
where a.mapping_id=b.mapping_id
and b.widget_id=c.widget_id
and c.attr_name='SQL Query'
and b.widget_type=3
and (UPPER(c.attr_value) like '%table_name%')
and a.mapping_id=z.mapping_id
and a.mapping_version_number=z.mapping_version_number
and b.mapping_id=x.mapping_id
and b.widget_id=x.widget_id
and b.version_nuber=x.version_number
and c.widget_id=y.widget_id

and c.version_number=y.version_number
order by a.mapping_name
Query2:
Table used in Lookup query

select distinct a.subject_area,a.mapping_name,b.instance_name,


from
rep_all_mappings a,
rep_widget_inst b,
rep_widget_attr c
where
a.mapping_id=b.mapping_id
and c.mapping_id=0
and b.widget_id=c.widget_id
and c.attr_id=1
and b.widget_type=1
and upper(c.attr_value) like '%table_name%'
order by a.mapping_name

Query3:
Table used in Source,Target and lookup instance

select distinct
b.subject_area,b.mapping_name,a.instance_name,a.widget_type_name
from
rep_all_mappings b,
rep_widget_inst a,
where a.mapping_id=b.mapping_id
and a.widget_type in (1,2,11)
and upper(a.instance_name) like '%table_name%'

Query4:
To find connections used in sessions in a work flow
select distinct b.workflow_name,b.session_name,a.instance_name,a.cnx.name
from (select distinct conn.session_id,conn_instance_name,conn.cnx_name from
rep_sess_widget_cnxs conn ) a,
(select * from rep_sess_log a where upper(subject_area ='SUBJECT_AREA' AND
WORKFLOW_NAME LIKE '%WORKFLOW_NAME%' AND
SESSION_TIMSTAMP =(SELECT MAX(SESSION_TIMESTAMP) FROM REP_SESS_LOG
B WHERE A.SESSION_ID =B.SESSION_ID ))B WHERE
A.SESSION_ID =B.SESSION_ID ORDER BY B.SESSION_NAME

Query5:
Find which workflows are using a script
Select distinct r.subject_area,r.workflow_name,s.instance_name from
rep_workflows r,(select task_id,workflow_id from
opb_task_val_list where lower(pm_value) like '%scriptname%') t,rep_task_inst s
where s.workflow_id =r.workflow_id and
t.task_id=s.task_id

Query 6:
Query used to list all target instances from the mappings where the
object on which we are performing impact analysis is one of the targets

select subject_area,mapping_name,instance_name,widget_type_name from (


select
b.subject_area,b.mapping_name,a.instance_name,a.widget_type_name,a.version
_number,
rank() over (partition by b.subject_area,b.mapping_name order by
version_number desc) rn
from rep_widget_inst a, rep_all_mappings b where a.mapping_id = b.mapping_id
and a.widget_type =2 and
b.mapping_id in (select distinct b.mapping_id from from rep_widget_inst a,
rep_all_mappings b where a.mapping_id = b.mapping_id and a.widget_type =2
and upper(a.instance_name) like '%table_name%'))) z where rn =1

Query 7:
Pre and post sql in mapping level
select distinct
c.subject_area,b.mapping_name,a.attr_name,a.attr_value,d.widget_type_name,d.
instance_name
from
rep_all_mappings b,
rep_widget_inst d,
rep_wdget_attr a ,
rep_subject c
where
a.mapping_id=b.mapping_id
and b.subject_id =c.subject_id
and a.mapping_id=d.mapping_id
and a.attr_value is not null
and a.attr_name in ('Pre SQL','Post SQL')
and upper(a.attr_value ) like '%table_name%')

Query 8
Pre and post sql in session level
select distinct a.subject_area,a.workflow_name,b.task_name,d.attr_value
from
rep_subject a,opb_task b,opb_session c ,opb_swidget_attr d,rep_sess_log e
where a.subject_id=b.subject_id and b.task_id=c.session_id and
c.session_id=d.session_id and e.session_id=d.session_id
and upper(d.attr_value) like '%table_name%' and d.attr_id in (7,8)

Query 9
List all the workflows and email tasks usinga particular mail
select distinct c.subj_name subject_area,b.task_name
workflow_name,d.instance_name email_task_name,e.attr_value recepient

from opb_workflow a,opb_task b,opb_subject c,opb_task_inst d,opb_task_attr e


where a.workflow_id=b.task_id and b.task_type in (70,71) and d.task_tye<>62
and b.task_id=d.workflow_id
and d.task_id=e.task_id and e.task_type=65
and e.attr_id=1 and b.subject_id=c.subj_id and upper(e.attr_value) like
'%email_id%'
order by subject_area,workflow_name,task_name

Query 10
This query is used to list all the workflows which have the source as flat
file

SELECT DISTINCT c.subj_name folder_name,b.task_name workflow_name,


d.instance_name session_name, e.file_name src_file_name,
e.dir_name src_file_dir_name
FROM OPB_WORKFLOW A,
OPB_TASK B,
OPB_SUBJECT C,
OPB_TASK_INST D,
OPB_SESS_FILE_VALS E,
OPB_SESS_EXTNS F
WHERE D.TASK_ID=E.SESSION_ID
AND E.SESS_WIDG_INST_ID=F.SESS_WIDG_INST_ID
AND E.SESSION_ID=F.SESSION_ID
AND A.WORKFLOW_ID=B.TASK_ID
AND B.TASK_TYPE IN (71,70)
AND D.TASK_TYPE=68
AND B.TASK_ID=D.WORKFLOW_ID
AND B.SUBJECT_ID=C.SUBJ_ID
AND (F.OBJECT_TYPE-78)=0
AND LOWER(E.FILE_NAME) LIKE '%source_file_name%'
ORDER BY folder_name,workflow_name,session_name

Query11
This query is used to list all the Target instances for a given Source
instance

SELECT DISTINCT B.SUBJECT_AREA,B.MAPPING_NAME,A.INSTANCE_NAME,


A.WIDGET_TYPE_NAME FROM REP_WIDGET_INST A,REP_ALL_MAPPINGS
WHERE A.MAPPING_ID=B.MAPPING_ID
AND A.WIDGET_TYPE=2
AND B.MAPPING_ID IN (
SELECT DISTINCT B.MAPPING_ID
FROM REP_WIDGET_INST A,REP_ALL_MAPPINGS B
WHERE A.MAPPING_ID=B.MAPPING_ID
AND A.WIDGET_TYPE=1
AND (UPPER(A.INSTANCE_NAME) LIKE '%SOURCE_TABLE_NAME%')

Query12
This query is used to list all the Source instances for a given Target
instance

SELECT DISTINCT
B.SUBJECT_AREA,B.MAPPING_NAME,A.INSTANCE_NAME,A.WIDGET_TYPE_NAME
FROM REP_WIDGET_INST A,REP_ALL_MAPPINGS B
WHERE A.MAPPING_ID=B.MAPPING_ID
AND A.WIDGET_TYPE=1
AND B.MAPPING_ID IN (
SELECT DISTINCT B.MAPPING_ID
FROM REP_WIDGET_INST A,REP_ALL_MAPPINGS B
WHERE A.MAPPING_ID=B.MAPPING_ID
AND A.WIDGET_TYPE=2
AND (UPPER(A.INSTANCE_NAME) LIKE '%TARGET_TABLE_NAME%')

Query13
This query is used to display the workflow name for a given mapping

SELECT DISTINCT
W.SUBJECT_AREA,W.WORKFLOW_NAME,LS.MAPPING_NAME,S.SESSION_INSTANCE
_NAME
FROM REP_WORKFLOWS W
INNER JOIN REP_SESS_LOG S
ON W.WORKFLOW_ID=S.WORKFLOW_ID
INNER JOIN REP_LOAD_SESSIONS LS
ON S.SESSION_ID=LS.SESSION_ID
INNER JOIN REP_ALL_MAPPINGS M
ON LS.MAPPING_ID=M.MAPPING_ID
WHERE LOWER(LS.MAPPING_NAME)='mapping_name'

TERADATA QUERIES
Query 1
Query to fetch user acces report of any objECT

SELECT VW.OBJECTDATABASENAME AS DATABASENAME,


VW.OBJECTTABLENAME AS TABLENAME,
VW.USERNAME,
COUNT(*) AS ACCESS_COUNT,
MAX(VW.COLLECTTIMESTAMP) AS MAX_TS
FROM
(
SELECT
A.OBJECTDATABASENAME,
A.OBJECTTABLENAME,
B.USERNAME,
A.COLLECTTIMESTAMP

FROM PDCRINFO.DBQLOBJTBL_HST A
PDCRINFO.DBQLOBJTBL_HST B
WHERE A.PROCID=B.PROCID
AND A.LOGDATE=B.LOGDATE
AND A.QUERYID=B.QUERYID
AND A.OBJECTDATABASENAME ='DATEBASENAME'
AND A.OBJECTTABLENAME ='TABLENAME'
AND CAST(A.COLLECTTIMESTAMP AS DATE )>'DATE'
) VW GROUP BY 1,2,3

QUERY 2

QUERY TO FIND TABLE SIZE

SELECT (SUM(CURRENTPERM))/1024/1024/1024 FROM DBC.TABLESIZE WHERE


TABLENAME='TABLENAME'
AND DATABASENAME='DATABASENAME'

QUERY 3
QUERY TO FIND DISK SPACE

SELECT DATABASENAME,(SUM(MAXPERM))/1024/1024/1024 ASSIGNED_SPACE,


(SUM(CURRENTPERM))/1024/1024/1024 USED_SPACE,
ASSIGNED_SPACE -USED_SPACE AS AVAILABLE_SPACE FROM DBC.DISKSPACE
WHERE
DATABASENAME ='DATABASENAME' GROUP BY 1 ORDER BY 4 DESC

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy