Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
9Activity
0 of .
Results for:
No results containing your search query
P. 1
mgmt ebs ll metrics

mgmt ebs ll metrics

Ratings: (0)|Views: 702|Likes:
Published by anon-58026

More info:

Published by: anon-58026 on Sep 05, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

07/19/2013

pdf

text

original

 
CREATE OR REPLACE PACKAGE "APPS"."MGMT_EBS_LL_METRICS" ASTYPE GenericCurType IS REF CURSOR;/*Puts the config data into the file*/procedure collect_config_metrics(directory_location IN VARCHAR2);END MGMT_EBS_LL_METRICS;/CREATE OR REPLACE PACKAGE BODY "APPS"."MGMT_EBS_LL_METRICS" ASg_config_handle UTL_FILE.FILE_TYPE := NULL;METRIC_END_MARKER constant VARCHAR2(4) := ':End';METRIC_BEGIN_MARKER constant VARCHAR2(6) := ':Begin';ORACLE_EBS_META_VER CONSTANT VARCHAR(17) := '10.2.7.1.0';/*Put marker for the metric*/PROCEDURE put_metric_marker( marker in VARCHAR2, metric in VARCHAR2)ISBEGINUTL_FILE.PUT_LINE(g_config_handle,metric||marker);END put_metric_marker;/*Generic function to write to the config dump file*/PROCEDURE write_metric( metric IN VARCHAR2,query IN VARCHAR2, separator INVARCHAR2 default '|')ISl_em_result_cur INTEGER DEFAULT DBMS_SQL.OPEN_CURSOR;l_col_cnt NUMBER DEFAULT 0;l_columnValue VARCHAR2(4000);l_status NUMBER ;l_begin_done BOOLEAN DEFAULT FALSE;l_end_done BOOLEAN DEFAULT FALSE;BEGINBEGINdbms_sql.parse(l_em_result_cur, query, dbms_sql.native );/* define all the columns */FOR i IN 1 .. 255 LOOPBEGINdbms_sql.define_column( l_em_result_cur, i, l_columnValue, 4000 );l_col_cnt := i;EXCEPTIONWHEN OTHERS THENIF ( sqlcode = -1007 ) THEN exit;ELSERAISE;END IF;END;END LOOP;
 
dbms_sql.define_column( l_em_result_cur, 1, l_columnValue, 4000 );l_status := DBMS_SQL.EXECUTE (l_em_result_cur);put_metric_marker(METRIC_BEGIN_MARKER,metric);l_begin_done := TRUE;LOOPexit when ( dbms_sql.fetch_rows(l_em_result_cur) <= 0 );UTL_FILE.PUT( g_config_handle, 'em_result=');FOR i IN 1 .. l_col_cnt LOOPIF i != 1 THENUTL_FILE.PUT( g_config_handle, separator);END IF;dbms_sql.column_value( l_em_result_cur, i, l_columnValue );/* replace seperators with escaped separators */l_columnValue := replace(l_columnValue,'#','##');l_columnValue := replace(l_columnValue,separator,'#'|| separator);UTL_FILE.PUT( g_config_handle, l_columnValue );END LOOP;UTL_FILE.NEW_LINE(g_config_handle );END LOOP;dbms_sql.close_cursor(l_em_result_cur);/* Should be the last callout in the block*/put_metric_marker(METRIC_END_MARKER,metric);l_end_done := TRUE;EXCEPTIONWHEN UTL_FILE.INVALID_FILEHANDLE OR UTL_FILE.INVALID_OPERATION ORUTL_FILE.WRITE_ERROR THENIF DBMS_SQL.IS_OPEN(l_em_result_cur) = TRUETHENdbms_sql.close_cursor(l_em_result_cur);END IF;RAISE;WHEN OTHERS THENIF DBMS_SQL.IS_OPEN(l_em_result_cur) = TRUETHENdbms_sql.close_cursor(l_em_result_cur);END IF;/*On any non-utl file exceptions, log as em_errorfor the metric.If the BEGIN marker is not write, need to write it.If the END marker is not write, need to write it.There won't be the case that END marker is written and we reach HERE.*/IF not l_begin_done THENput_metric_marker(METRIC_BEGIN_MARKER,metric);END IF;UTL_FILE.PUT_LINE(g_config_handle,'em_error=' || 'SQLERRM: '|| SQLERRM || ' SQLCODE: '|| SQLCODE);IF l_end_done THENRAISE;END IF;put_metric_marker(METRIC_END_MARKER,metric);
 
END;END write_metric;/*Internal API to check if a column exists in a table*/function does_column_exist (p_table varchar2, p_column varchar2) return booleanISv_cnt number := 0;BEGIN-- Using all_tab_columns instead of all_tab_cols as all_tab_cols-- did not exist in 8.1.7select count(*) into v_cnt from all_tab_columnswhere table_name = p_tableand column_name = p_column;if (v_cnt > 0) thenreturn true;end if;return false;END does_column_exist;/*Internal API to check if an object exists*/function does_object_exist (p_object_name varchar2, p_object_type varchar2) return booleanISv_cnt number := 0;BEGINselect count(*) into v_cnt from all_objectswhere object_name = p_object_nameand object_type = p_object_type;if (v_cnt > 0) thenreturn true;end if;return false;END does_object_exist;/*Private procedureCollect metric=apps_summary*/procedure collect_apps_summary ISBEGINwrite_metric('apps_summary','select applications_system_name, release_name, multi_org_flag,multi_lingual_flag, multi_currency_flag from fnd_product_groups');END collect_apps_summary;/*Private procedureCollect metric=apps_topology*/procedure collect_apps_topology ISBEGINif (does_column_exist('FND_NODES','SUPPORT_DB') = true) thenwrite_metric('apps_topology',

Activity (9)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
payakkamron liked this
payakkamron liked this
gemini311 liked this
maleem liked this
robwolters liked this
overmind13 liked this
wulongr1206 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->