Tool in Sql Anywhere 11 to view procedure/function I/O?

We have had some of our branches complaining about slowness. I have tried tracing the database and viewed the slow running queries to see if that would help but would like to see the I/O impact of some of the procedures to see if it needs to be tuned more.
Branches are on 11.0.1.2452 (running on Windows)

Hi Kevin,
There are a few different ways you can do this:
First, try looking at the %Idle Time counter on the disk in perfmon.exe. If this is getting close to zero while the procedure is running, then your procedure is probably affected by I/O performance.
Are there specific queries that are taking a long time? If so, you should try gathering the plans using Interactive SQL. Select the top node and look at the DiskReadTime and DiskWriteTime counters. If these are a significant portion of the RunTime then you are likely bound by disk I/O.
If you already have the trace database of the procedure executing, you can try running some queries against the sa_diagnostic_statistics table to view the state of the disk counters over time. You will need to capture the trace at a fairly high tracing level for this to work. The below code compares the DiskReadTable to the CacheReadTable, you should also check the corresponding index counters (DiskReadIndLeaf, DiskReadIndInt, etc.). The percent read from disk should be less then 10% for table reads and very small for index reads (except for perhaps initial runs on a cold cache)
Here's a rough outline:
-- Create index for performance reasons
CREATE INDEX IF NOT EXISTS idx_stats ON sa_diagnostic_statistics ( counter_id ASC, connection_number ASC );
DROP TABLE IF EXISTS #samples;
DECLARE LOCAL TEMPORARY TABLE #samples(
"time" timestamp,
connection_number unsigned int,
counter_id unsigned int,
counter_value unsigned int)
NOT TRANSACTIONAL ;
-- Iterate over the connections table and grab the initial and final
-- DiskReadTable and CacheReadTable counter values (per connection)
FOR myloop as curs CURSOR FOR
    SELECT connection_number as c
    FROM sa_diagnostic_connection
FOR READ ONLY
DO
    INSERT INTO #samples
    SELECT DISTINCT TOP 1 "time",connection_number,counter_id,counter_value
    FROM sa_diagnostic_statistics
    WHERE connection_number = c
    AND counter_id = 61         --DiskReadTable
    ORDER BY "time" DESC;
    INSERT INTO #samples
    SELECT DISTINCT TOP 1 "time",connection_number,counter_id,counter_value
    FROM sa_diagnostic_statistics
    WHERE connection_number = c
    AND counter_id = 19         --CacheReadTable
    ORDER BY "time" DESC;
    INSERT INTO #samples
    SELECT DISTINCT TOP 1 "time",connection_number,counter_id,counter_value
    FROM sa_diagnostic_statistics
    WHERE connection_number = c
    AND counter_id = 61         --DiskReadTable
    ORDER BY "time" ASC;
    INSERT INTO #samples
    SELECT DISTINCT TOP 1 "time",connection_number,counter_id,counter_value
    FROM sa_diagnostic_statistics
    WHERE connection_number = 64246
    AND counter_id = 19         --CacheReadTable
    ORDER BY "time" ASC;
END FOR;
-- Display the CacheReadTable vs. DiskReadTable for each connection
SELECT c.connection_number as "Connection Number" ,c.value as "CacheReadTable", d.value as "DiskReadTable", IF "CacheReadTable" > 0 THEN ("DiskReadTable"*100.0)/"CacheReadTable" ENDIF as "% Disk" FROM
(SELECT connection_number, MAX(counter_value)-MIN(counter_value) as value
FROM #samples
WHERE counter_id = 19
GROUP BY connection_number ) c
JOIN
(SELECT connection_number, MAX(counter_value)-MIN(counter_value) as value
FROM #samples
WHERE counter_id = 61
GROUP BY connection_number) d
ON c.connection_number = d.connection_number
WHERE "% Disk" IS NOT NULL
ORDER BY "% Disk" DESC
edit- Fixed code

Similar Messages

  • Rename view,procedure,function,trigger in oracle.

    hi all,
    Just i am thinking a concept in oracle.
    can i rename view,procedure,function,trigger in oracle. i know it is not possible bcos it is a script.
    can u please confirm me

    You can rename View
    http://download.oracle.com/docs/cd/B12037_01/server.101/b10759/statements_9019.htm
    You can rename Trigger
    http://www.ss64.com/ora/trigger_a.html
    Well there we go. Having never had a need to do it myself (I put it down to good design and coding standards!) I never knew it was possible.
    ;-))

  • View procedures, functions for OS authenticated user

    Hello,
    Using JDeveloper 9.0.3.3 on HPUX 11i.
    User 'oroot' is a OS authenticated user. Using the JDBC url in the connection wizard I was able to login to the database with a /. The URL is shown below: "jdbc:oracle:oci8:/@".
    Now, if I expand the "Procedures", "Functions", Packages", "Tables" etc. under this connection tree, nothing is listed, but from sqlplus I could see all these informations for user 'oroot'.
    For a Database authenticated user it works fine.
    -murali

    Hi,
    Are you saying what are the roles/privileges required for this user to access cubes in global AW?
    The user must have read permission to the workspace and user should have OLAP_USER role as a default role assigned.
    If accessing through Discoverer for OLAP(D4O) then D4OPUB role should also be given.
    What is the front end tool u r using to create reports?
    Thanks
    Brijesh

  • Tables/views/Procedures/functions etc are not showing up in tree view, but can execute select * on dba_objects (can view in DBVisualizer)

    There was one other thread from years ago detailing this same problem. The only clue was to check whether select all privs were enabled for the user on dba_objects. They are for the user accessing the system. In fact, all tables/views/procs/funcs can be viewed in the tree view of DBVisualizer.  For whatever reason, OSD does not show anything.
    I'd appreciate any clues! Thank you!
    OSD Version  Version 4.1.0.18
    OS: Windows 7/64
    Java: 1.8.0
    Connecting to Oracle 11g 11.2.0.3.0

    Thank you, Gary.
    I updated the post with the version info. I did not explicitly install this JDBC driver, so whatever the OSD came with?  Unless it is using whatever is installed on my machine, in which case would be the thin driver.
    I did check out that post, and I appreciate you sharing it. I did click the 'include synonyms' filter, but behavior remained unchanged.
    I would prefer to use OSD, and that is what our dev team was expecting to use, but we just can't see the information.  We are using an ID that does not 'own' those tables, per se.  But, why would DBVisualizer show these tables, when OSD does not?

  • Sql Developer - View source code of procedures, functions & packages in another schema

    Our developers need the ability to view procedures, function, packages etc. in the production database (using SQL DEVELOPER).  They don't have access to sign on as the owner of these
    objects in Production.  They must use their own limited access UserID for this purpose.
    This limited access UserID has been granted select privilege on DBA_SOURCE & DBA_OBJECTS.  The developers need the ability to view the source of these object via
    the tree view in SQL DEV.  They should be able to click on "other users" in the SQL DEV tree view and see a listing of the owner schema objects.  Then they should
    be able to select the desired object and view the source code.  These developers are used to using GUI interfaces.  Selecting from DBA_SOURCE would not be an
    option for them.
    I understand that if the limited user is granted SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE then this functionality will work.  The problem is those
    privileges/roles  provide much more access than should be granted to these limited access users. Granting DBA to these users is also not an option.
    In TOAD and other end-user tools this functionality works when only select privilege on DBA_SOURCE & DBA_OBJECTS has been granted.  We need this same functionality
    in SQL DEV.
    While searching this forum and the internet, I see that other installations have this same issue.
    Please enhance SQL Developer with this functionality. 
    Thank you, ellen

    Just to double check that I'm interpreting the problem correctly, is the following true:
    select * from all_objects where object_name = 'DBA_SOURCE'
    returns nothing
    select * from dba_source where name = your PL/SQL module
    returns all the code

  • View a function in PL/SQL developer

    I'm a sql developer, quite new to oracle.
    I'm using PL/SQL developer tool. Now I would like to view how a function is defined.
    But don't know how to open it.
    I can see the function, when right click it I have the option of the following: Refresh, copy comma separated, Test, and describe.
    How can I view the function contents?
    Thanks

    Hi,
    You can double click on that function name, you can watch one window in left side.
    If you want the bebug the fuction(first you should have the debug rights) just click on test and select ok for debug result, you watch the result step by step.
    Regards
    Sree

  • SQL query statement  for stored procedure / function listing ...

    Hi everyone,
    Is there a SQL query to list all the stored procedures and functions of an user in an Oracle 8 database?
    I have this idea:
    select * from USER_SOURCE where TYPE = 'PROCEDURE' or TYPE = 'FUNCTION'
    but I am not too sure whether this is correct.
    Thanks in advance,
    Eric

    Yeah
    I agree with you Garcia , my above posting was a correction to the query mentioned in the question only.
    you are correct
    If you only want the name of the object,
    SELECT Object_Name from User_Objects where object_type in ( 'PROCEDURE' ,'FUNCTION');
    is much faster than Selecting (distinct) from User_Source.

  • Parameter index move while executing PL/SQL stored procedure/function

    Hello, community.
    Have a question for you. It looked like very easy to write some small JDBC-wrapper to handle stored procedure/functions call for Oracle.
    Here is the code snippet of it:
    import java.io.Serializable;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Iterator;
    import javax.sql.DataSource;
    import oracle.jdbc.driver.OracleTypes;
    import org.apache.log4j.Logger;
    public class SmallHelper {
         public static final int CALL_TYPE__PROCEDURE = 1;
         public static final int CALL_TYPE__FUNCTION = 2;
         public static final int PARAMETER__IN = 1;
         public static final int PARAMETER__OUT = 2;
         private static final Logger log = Logger.getLogger(SmallHelper.class);
         private Connection con = null;
         private CallableStatement statement = null;
         private String name;
         private int type;
         private int resultType;
         private HashMap arguments = new HashMap();
          * Creates connection using data source as parameter.
          * @param ds - data source
          * @throws EhlApplicationException
         public SmallHelper(DataSource ds) throws Exception {
           try {
                   con = ds.getConnection();
              catch (SQLException e) {
                   ExceptionHelper.process(e);
         public void registerProcedure(String name) {
              this.name = name;
              this.type = CALL_TYPE__PROCEDURE;
         public void registerFunction(String name, int resultType) {
              this.name = name;
              this.resultType = resultType;
              this.type = CALL_TYPE__FUNCTION;
          * NB! When You're dealing with stored function index should start with number 2!
         public void registerArgument(int index, Object value, int type, int inOutType) {
              arguments.put(new Long(index), new CallableStatementArgument(value, type, inOutType));
         private String getSQL() {
              StringBuffer str = new StringBuffer("{ call  ");
              if ( type == CALL_TYPE__FUNCTION )
                   str.append(" ? := ");
              str.append(name).append("( ");
              for ( Iterator i = arguments.values().iterator(); i.hasNext(); ) {
                   i.next();
                   str.append("?");
                   if ( i.hasNext() )
                        str.append(", ");
              str.append(") }");
              return str.toString();
         public void execute() throws SQLException{
              String query = getSQL();
              statement = con.prepareCall(query);
              if ( type == CALL_TYPE__FUNCTION )
                   statement.registerOutParameter(1, resultType);
              for ( Iterator i = arguments.keySet().iterator(); i.hasNext(); ) {
                   Long index = (Long) i.next();
                   CallableStatementArgument argument = (CallableStatementArgument) arguments.get(index);
                   int type = argument.getType();
                   if ( argument.getInOutType() == PARAMETER__OUT )
                        statement.registerOutParameter(index.intValue(), type);
                   else if ( type != OracleTypes.CURSOR )
                        statement.setObject(index.intValue(), argument.getValue(), type);
              log.info("Executing SQL: "+query);
              statement.execute();
         public CallableStatement getStatement() {
              return statement;
         public void close() throws EhlApplicationException {
              try {
                   if (statement != null)
                        statement.close();
                   if (con != null)
                        con.close();
              catch (SQLException e) {
                   EhlSqlExceptionHelper.process(e);
         private class CallableStatementArgument implements Serializable{
              private Object value;
              private int type;
              private int inOutType;
              public CallableStatementArgument(Object value, int type, int inOutType) {
                   this.value = value;
                   this.type = type;
                   this.inOutType = inOutType;
              public int getType() {
                   return type;
              public Object getValue() {
                   return value;
              public int getInOutType() {
                   return inOutType;
    }It was really done in 10-15 mins, so don't be very angry at code quality :)
    Here is the problem.:
                   helper.registerProcedure("pkg_diagnosis.search_diagnosis");
                   helper.registerArgument(1, null, OracleTypes.CURSOR, EhlJdbcCallableStatementHelper.PARAMETER__OUT);
                   helper.registerArgument(2, pattern, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(3, lang, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(4, EhlSqlUtil.convertSetToString(langs, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(5, EhlSqlUtil.convertSetToString(diagnosisClass, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(6, parentId, OracleTypes.NUMBER, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.execute();
                   ResultSet rs = ((OracleCallableStatement) helper.getStatement()).getCursor(1);
                   procedure definition:
    procedure search_diagnosis (l_res OUT dyna_cur,
                               in_search_string IN VARCHAR2,
                               in_search_lang IN VARCHAR2,
                               in_lang_list IN VARCHAR2,
                               in_diag_class_list IN VARCHAR2,
                               in_parent_id IN NUMBER) Procedure call has inner check that fail because of som strange reason:
    in_search_string has 2 as index, that is correct. but procedure recieves is as number 3 in parameter list (what is in_search_lang). Other parameters are moved to. It seems like a cursor takes 2 places in definition. It's clear that if I put in_search_string as 1 parameter and cursor as 0 I'll get invalid parametr bindong(s) exception. So... any ideas why 2nd parameter is actually 3rd?
    Thanks beforehand.

    hmm...moreover:
    if we change procedure to function and call it in a simple way:
    CallableStatement stmnt = helper.getConnection().prepareCall("begin ? := pkg_diagnosis.search_diagnosis(?,?,?,?,?); end;");
                   stmnt.registerOutParameter(1, OracleTypes.CURSOR);
                   stmnt.setString(2, pattern);
                   stmnt.setString(3, lang);
                   stmnt.setString(4, langs);
                   stmnt.setString(5, diagnosisClass);
                   stmnt.setObject(6, parentId, OracleTypes.NUMBER);
                   stmnt.execute();
                   ResultSet rs = (ResultSet) stmnt.getObject(1);the exception is:
    [BEA][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 14:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignoredif we return some string or number - it works. but when we want cursor back - it fails.
    cursor is defined like ordinary dynamic cursor:
    TYPE dyna_cur IS REF CURSOR;

  • Encryption of pl/sql package/procedures/function code

    Is it possible to make the code inside a package/procedure/function un readable to other users.
    As is some of the api package body code in portal ?
    thanks in anticipation.
    SD,

    PL/SQL Wrap Utilityhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
    Note, however that you cannot revert back to original un-wrapped code from a code that has been wrapped. You would need access to the original source files to get the original source code.

  • To find last updated date in sql developer for a procedure or a function

    hi
    how to to find last updated date in sql developer for a procedure or a function.
    i m using sql developer version in 1.2

    I think you are in the wrong forum...
    Anyway you can try
    select * from
    all_objects o
    where o.object_type in ('FUNCTION','PROCEDURE');
    you have there the created date, last DDL and timestamp

  • To run mutipal SQLs in one procedure / function

    Hi,
    First of all, your help and efforts will be highly appreciated!
    I am new to the Oracle world and learning to write PL/SQL with real world problems.
    This is what I am facing now:
    I have a bunch of SQL scripts need to run several times a year, they are simple and just to create/rebuild indexes on different tables. samples as below
    CREATE INDEX ST_CODE_INDX_JAN2013 ON TREE_JAN2013
    (CODE)
    NOLOGGING
    TABLESPACE ST_LRG_INDX
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
                BUFFER_POOL      DEFAULT
    NOPARALLEL;
    CREATE UNIQUE INDEX ST_ID_INDX_JAN2013 ON RECORDS_JAN2013
    (M_ID)
    NOLOGGING
    TABLESPACE ST_LRG_INDX
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       UNLIMITED
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
                BUFFER_POOL      DEFAULT
    NOPARALLEL;
    And in total we probably will need to run around 100 scripts like this every time. Basically what we are doing is to import new tables every time and recreate/rebuild indexes. As you may see in the sample scripts above, all tables keep the same suffix but different table names. So, for now, what we are doing is to manually modify the script to reflex changes then kick it off.
    Now, how can I create a procedure/function stored in database and waiting for a EXEC command to pass the suffix and then run automatically?
    Once again, appreciated your great help!

    Use DBMS_STATS package instead of 'analyze'.  'ANALYZE' is deprecated and may not exist in future releases.
    Again - what you are trying to do (build tables/indexes on the fly) is extremely wrong.
    Add a DATE column and keep everything in one table.  You can then just add the PARTITION clause for EE instances.
    (against my better judgement)
    Two methods exist to run dynamically generated DDL statements:
    EXECUTE IMMEDIATE
    DBMS_SQL -- I'm not 100% sure on this one. read the manual.
    If you are dynamically generating the SQL, help limit SQL Injection by using DBMS_ASSERT on any user provided input.

  • SQL Anywhere Monitoring Tool

    Hi, what is the difference between "Monitoring Tool (Development and testing)"
    and "Monitoring Tool (Deployment)"? I cannot find it enywhere.
    thanks

    Hi Miroslav,
    The SQL Anywhere Monitor is a stand-alone product that is separately licensed from SQL Anywhere. The version included with SQL Anywhere is the Development version, which is intended for you to try out the product and see if it useful for your purposes.
    The full version has the following features, listed in the documentation: http://dcx.sap.com/index.html#sa160/en/dbadmin/da-server-monitoring-s-5157863.html
    If you do find that the utility is useful, you should purchase a full license for your production deployments.
    Regards,
    Jeff Albion
    SAP Active Global Support

  • Oracle PL/SQL procedure/function to post message into weblogic jms queue

    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    Regards,
    Steve

    904640 wrote:
    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue

  • SQL Anywhere Migration Tool

    Does anyone know of an expected time frame for Migrating from SQL Anywhere to 8i?

    Hello
    Seems like a bug in SQL Developer that it is not picking up the scale. Will notify the appropriate group for a fix. NUMBER(x,y) is a valid representation in Oracle. Can you check to see what the default mapping is in SQL Developer before the conversion process begins?. If it shows up as NUMBER(x) then change it to NUMBER(x,y).
    In the meanwhile iyou can fix the DDL before generating the schema in Oracle.
    Regards
    Prakash

  • Feature Request: Provide search functionality to procedures, functions and keywords in code

    Have been using SQL Server since 1998, and been wondering why MS cant better the GUI , in terms of ease of use, as its done in Visual Studio and other such tools, though there are some enhancements like multiple window etc, would expect few more for easy
    working for developers.
    1) A search text box, in the SSMS interface, for searching stored procedures, functions, tables etc would be very useful, instead of expanding the entire tree and going through a long list to find your procedure or table, especially when you have a large
    list of them.
    2) Also a code search tool, like to find a keyword in the entire stored procedures, triggers and functions would be useful, currently we had to generate whole script and then find the keyword, and this is cumbersome, as you have to move back and forth to
    find which stored procedure or function has that keyword etc.
    Thanks.

    1. You already have feature in SQL management studio to search for objects using full names or patterns through object explorer
    See
    http://visakhm.blogspot.in/2013/02/object-filtering-using-ssms-object.html
    2. For this you can use the catalog view sys.sql_modules and fire a query on it
    see
    http://visakhm.blogspot.in/2012/03/advantages-of-using-syssqlmodules-view.html
    http://visakhm.blogspot.in/2013/01/systemsqlmodules-and-allsql-modules.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for