Professional Documents
Culture Documents
Query1:
and c.version_number=y.version_number
order by a.mapping_name
Query2:
Table used in Lookup query
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
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
Query 10
This query is used to list all the workflows which have the source as flat
file
Query11
This query is used to list all the Target instances for a given Source
instance
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
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 3
QUERY TO FIND DISK SPACE