How to analyze_table_through_informatica

252 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
252
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How to analyze_table_through_informatica

  1. 1. Analyze Table through informatica 13/11/2014 Union Bank of California Relationship-UB Indrajit Srimani Domain-Finance indrajit.srimani@tcs.com
  2. 2. Confidentiality Statement Includethe confidentiality statement within the box provided.This has to be legally approved ConfidentialityandNon-Disclosure Notice The information contained in this documentis confidential and proprietary to TATA ConsultancyServices. This information may not be disclosed,duplicated or used forany other purposes.The information containedin this documentmay notbe released in whole or in part outside TCSfor any purposewithoutthe express written permission of TATA ConsultancyServices. Tata Code of Conduct We, in ourdealings, are self-regulated by a Codeof Conductasenshrined in the Tata Code ofConduct.We requestyour supportin helping us adhere tothe Codein letter and spirit. We request that any violation orpotential violation ofthe Code by anyperson be promptly broughtto the notice ofthe Local EthicsCounseloror the Principal EthicsCounselor orthe CEOof TCS. All communication received in this regard will be treated and kept as confidential.
  3. 3. Table of Content 1. INTRODUCTION...................................................................................4 2. SCENARIO............................................................................................5 3. IMPLEMENTATION ..............................................................................6
  4. 4. 1. INTRODUCTION We can use the DBMS_STATS package or the ANALYZE statement to gather statistics about the physical storage characteristics of a table, index, or cluster. These statistics are stored in the data dictionary and can be used by the optimizer to choose the most efficient execution plan for SQL statements accessing analyzed objects. Oracle recommends using the more versatile DBMS_STATS package for gathering optimizer statistics, but you must use the ANALYZE statement to collect statistics unrelated to the optimizer, such as empty blocks, average space, and so forth. The DBMS_STATS package allows both the gathering of statistics, including utilizing parallel execution, and the external manipulation of statistics. Statistics can be stored in tables outside of the data dictionary, where they can be manipulated without affecting the optimizer. Statistics can be copied between databases or backup copies can be made.
  5. 5. 2. SCENARIO Purpose of this document of to explain how we can analyze an oracle table while processing data using ETL tool Informatica. Suppose there is a table in ORACLE database which is very huge in size(GB). As per business requirement, we have to use look up transformation on this table may be once or couple of time. It will cause a huge performance problem. The mapping may take couple of hours to get it complete or it may stuck for ever. One of the solution overcome this situation is to analyze the table before execution of the specific mapping which will speed up the execution. In that case ANALYZE statement needs to be included in PRE_SQL command of session level. But the biggest challenge is, developer needs admin rights to execute such command at ORACLE db which is not granted usually. So the trick here is, create one STORED_PROCEDURE for analyze the particular table and we can have execution right very easily for this STORED_PROCEDURE.
  6. 6. 3. IMPLEMENTATION Create or compile the below stored procedure at particular schema in which the table is exists. STORED PROCEDURE CREATE OR REPLACE PROCEDURE SCHEMA_NAME.SP_NAME(TABLE_NAME inVARCHAR2, cascade_opt in VARCHAR2) as ot_cascade Boolean; BEGIN dbms_application_info.set_module(‘SP_NAME’,’analyze SCHEMA_NAMEtable’); dbms_application_info.set_action(‘analyze table’||TABLE_NAME); IF length(TABLE_NAME) >32 THEN dbms_application_info.set_action(NULL); dbms_application_info.set_module(NULL,NULL); raise_application_error(-20002,’SP_NAME:’||cascade_opt,TRUE); END IF; IF length(cascade_opt) >5 THEN dbms_application_info.set_action(NULL); dbms_application_info.set_module(NULL,NULL); raise_application_error(-20002,’SP_NAME:’||cascade_opt,true); END IF; IF cascade_opt= ‘TRUE’ OR cascade_opt= ‘true’ then ot_cascade := true; ELSE ot_cascade := false; END IF; dbms_stats.gather_table_stats(‘SCHEMA_NAME’ ,TABLE_NAME , cascade => ot_cascade,estimate_percent=>33, granularity => ‘ALL’ , degree =>6); dbms_application_info.set_action(NULL); dbms_application_info.set_module(NULL,NULL);
  7. 7. exception whenothers then dbms_application_info.set_action(NULL); dbms_application_info.set_module(NULL,NULL); END SP_NAME; / SYNONYM AND GRANT Create synonym for the store procedure for a particular user. Get the list of role for the particular schema from DBA and give execute and debug grant like below. CREATE OR REPLACE SYNONYMUSER.SP_NAME FOR SCHEMA_NAME.SP_NAME; GRANT EXECUTE,DEBUG ON SCHEMA_NAME.SP_NAME to SCHEMA_ADMIN_ROLE; CALL STORE PROCEDURE FROM INFORMATICA Call the above created Store Procedure through Pre_SQL command of informatica(ETL) like below. BEGIN SP_NAME (‘TABLE_NAME’,’TRUE’); END ;
  8. 8. Thank You
  9. 9. About Tata Consultancy Services (TCS) Tata ConsultancyServices is an IT services, consulting andbusiness solutions organizationthat delivers real results to global business, ensuring a level of certaintyno other firm can match. TCS offers a consulting-led, integrated portfolioof IT andIT- enabledinfrastructure, engineering andassurance services. Thisis deliveredthroughits unique Global NetworkDeliveryModelTM, recognizedas the benchmark ofexcellence in software development. A part of the Tata Group, India’s largest industrial conglomerate, TCS has a global footprint and is listedonthe National Stock Exchange and Bombay Stock Exchange inIndia. For more information, visit us at www.tcs.com. IT Services Business Solutions Consulting All content / information present here is the exclusive property of Tata Consultancy Services Limited (TCS). The content / information contained here is correct at the time of publishing. No material from here may be copied, modified, reproduced, republished, uploaded, transmitted, posted or distributed in any form without prior written permission from TCS. Unauthorized use of the content / information appearing here may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties. Copyright © 2011 Tata Consultancy Services Limited

×