Tuesday, June 3, 2008

DBMS_PROFILER

What is DBMS_PROFILER
dbms_profiler is oracle supplied package which use for tunning plsql application.through this package we can tune our plsql procedure, trigger,funtions. and findout where plsql spent more time to execute.How to install dbms_profiler package
In Basic Oracle Installation "dbms_profiler" package is not created. We have to manually create this packages running below scripts.conn with SYS user and run "PROFLOAD.SQL" Located: $ORACLE_HOME/rdbms/admin folderSQL> conn sys@hgc as sysdbaEnter password:Connected.SQL> @d:\oracle\product\10.1.0\db_1\rdbms\admin\profload.sqlPackage created.Grant succeeded.Synonym created.Library created.Package body created.Testing for correct installationSYS.DBMS_PROFILER successfully loaded.PL/SQL procedure successfully completed.Conn to application user and run "PROFTAB.SQL", this script create three tables.1. PLSQL_PROFILER_RUNS2. PLSQL_PROFILER_UNITS3. PLSQL_PROFILER_DATASQL> conn scott/tiger@hgcConnected.SQL> @d:\oracle\product\10.1.0\db_1\rdbms\admin\proftab.sqldrop table plsql_profiler_data cascade constraints*ERROR at line 1:ORA-00942: table or view does not existdrop table plsql_profiler_units cascade constraints*ERROR at line 1:ORA-00942: table or view does not existdrop table plsql_profiler_runs cascade constraints*ERROR at line 1:ORA-00942: table or view does not existdrop sequence plsql_profiler_runnumber*ERROR at line 1:ORA-02289: sequence does not existTable created.Comment created.Table created.Comment created.Table created.Comment created.Sequence created.How can use dbms_profiler ?1. Connect with application user which you want to optimize.Start dbms_profilerSQL> exec dbms_profiler.start_profiler('Test procedure by Scott');Information is store in memory so flash profiler to update their repository.SQL> exec dbms_profiler.flush_data();Stop dbms_profilerSQL> exec dbms_profiler.stop_profiler();View Information Generated by dbms_profilerQuery in below views1. plsql_profiler_runs2. plsql_profiler_units3. plsql_profiler_data

No comments: