PL/SQL Execution Proccess

Hello,
If I have a LONG RUNNING PL/SQL Procedure, how do I monitor the Execution Proccess of the procedure.
This Procedure LOOPs through a table and sets some field values according to other field values in the same record. The table is pretty big so i need a DISPLAYES RECORD COUNTER of some sort so I know what record the loop is on.
Thanks.

You can use dbms_pipe to send some info to another process
Or you can call some procedure with autonomous transaction pragma and update some table in this procedure with appropriate count
I'm sure there are other solutions too

Similar Messages

  • SQL execution error, ORA-01843: not a valid month

    Im using ASP/VBScript and its my first time starting to use Oracle as a DB provider.
    Just having an issue with a statement that I have.
    Heres my statement:
    SELECT T592_NOON.SHIP_CODE, T592_NOON.REPORT_DATE, T592_NOON.L_B, T592_NOON.AVERAGE_SPEED, T592_NOON.SEASTATE, T592_NOON.DISTANCE, T592_NOON.WIND_DIRECTION, T592_NOON.IFO_MAIN, T592_NOON.IFO_BOILER, T592_NOON.IFO_AUXENGINE FROM T592_NOON WHERE (((SHIP_CODE)='S271') AND (REPORT_DATE BETWEEN to_date('08/02/2004 13:00:00', 'DD-MON-YYYY HH24:MI') and to_date('28/02/2004 18:15:00', 'DD-MON-YYYY HH24:MI')))
    Whenever I run it it errors and returns:
    SQL execution error, ORA-01843: not a valid month
    Can anyone tell why this wouldnt work?
    REPORT_DATE type is DATE
    REPORT_DATE Sample data: 2003-04-28-12.00.00.000000

    Changing the format of the date seemed to fix it.
    Incorrect: '08/02/2004 13:00:00'
    Correct: '08-FEB-2004 13:00'

  • OEM 11g - Monitored SQL Executions, click SQL ID, shows blank screen??

    I am trying to investigate my execution plans against my DB; and was informed i can check current status of SQL scripts using:
    Performance tab > SQL Monitoring > Monitored SQL Executions
    I click on SQL ID i want to investigate and comes back with blank screen instead of the overview tab.
    See Oracle URL below for screenshot
    Figure 6-8 Monitored SQL Execution Details Page
    http://download.oracle.com/docs/cd/E11857_01/em.111/e11982/database_management.htm
    Kind Regards,
    Paul

    Please log an SR provide SQL Monitor Active Report for your SQL. Thanks.
    -Mughees

  • Backtrace of ABAP and SQL execution

    Hello everyone!
    Does anybody know how to see logs of ABAP and SQL execution. I saw SLG1 but didn't found this information.
    I'm not interested in writing to SLG, I want to have opportunity to see the User, who deleted some entries from tables or launched ABAP code, for example.

      Do you mean transcation SCU3 for viewing table changes?
    Yes
    About ABAP-SQL execution... I can't foresee which program will be executed and which table will be effected, so I need some report that shows for particular table which statement was executed, and report about list of programs run by user. Do you know this?
    You can see which transaction is executed by a user on given period of time by using transaction ST03
    But which table accessed or which sql executed, in a scenrio in which you cannot forsee then its not possible.

  • Question on Dynamic SQL Execution

    Hi,
    Our company is currently using Oracle 7 but will move to Oracle 8i soon. I am trying to execute a dynamic SQL statement in a function and it always error-out during execution. The SQL statement is NOT doing any update to a table. Its doing a select only. The function is being called during an execution of another dynamic SQL statement in a procedure. Here are examples of the code listing for the procedure and function:
    CREATE OR REPLACE PROCEDURE TEST_PROC
    lookup_cursor      integer;
    ignore          integer;
    VARvalue          number;
    begin
    lookup_cursor := DBMS_SQL.open_cursor;
    DBMS_SQL.PARSE( lookup_cursor,
              'SELECT ' || TEST_FUNCTION || ' FROM DUAL,
              DBMS_SQL.NATIVE);
    DBMS_SQL.DEFINE_COLUMN( lookup_cursor, 1, VARvalue);
    ignore := DBMS_SQL.EXECUTE(lookup_cursor);
    loop
         IF DBMS_SQL.FETCH_ROWS(lookup_cursor) > 0 THEN
         DBMS_SQL.COLUMN_VALUE(lookup_cursor, 1, VARvalue);
         ELSE
         EXIT;
         END IF;
    END LOOP;
    DBMS_SQL.CLOSE_CURSOR(lookup_cursor);
    end TEST_PROC;
    CREATE OR REPLACE PROCEDURE TEST_FUNCTION
    lookup_cursor      integer;
    ignore          integer;
    VARvalue          number;
    VARsql_string     VARCHAR2(200);
    begin
    lookup_cursor := DBMS_SQL.open_cursor;
    VARsql_string := SOME GENERATED SQL STATEMENT;
    DBMS_SQL.PARSE( lookup_cursor,
              VARsql_string,
              DBMS_SQL.NATIVE);
    DBMS_SQL.DEFINE_COLUMN( lookup_cursor, 1, VARvalue);
    ignore := DBMS_SQL.EXECUTE(lookup_cursor);
    loop
         IF DBMS_SQL.FETCH_ROWS(lookup_cursor) > 0 THEN
         DBMS_SQL.COLUMN_VALUE(lookup_cursor, 1, VARvalue);
         ELSE
         EXIT;
         END IF;
    END LOOP;
    RETURN VARvalue;
    end TEST_FUNCTION;
    The error I received during execution of TEST_PROC is:
    ORA-06571: Function TEST_FUNCTION does not guarantee not to update database
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 239
    ORA-06512: at "SYS.DBMS_SQL", line 32
    It may seem like the example procedure doesnt need to use a dynamic SQL execution to call TEST_FUNCTION but the actual code that I extracted from does.
    Does Oracle 7 always treat the dynamic SQL command set as some kind of update statement? Is that a bug? I understand that the EXECUTE IMMEDIATE command in Oracle 8i will replace the old command set found in the above examples. Will using the new EXECUTE IMMEDIATE command in Oracle 8i solve this problem?
    Thank you for any help,
    Tony

    In Oracle 7, for a function to be called from a select statement it has to follow the 'purity rule' that it does not modify any database table or package variable.
    Probably you will have to use the compiler directive PRAGMA RESTRICT_REFERENCES (WNDS,WNPS) on your TEST_FUNCTION so that it can be called within a SQL statement.
    This restriction is removed in Oracle 8i onwards.
    Hope this solves your problem.
    Regards

  • Monitoring pl/sql execution from Enterprise Manager

    I need to implement monitoring of PL/SQL code from within Oracle Enterprise
    Manger 10g. OEM has Custom user defined metrics (UDM) that allow one to issue
    queries against a database and decide whether the output from the query is a
    warning or a critical alert based on some threshold.
    In my case, my pl/sql will write to a database table that OEM will monitoring by
    querying periodically.
    My question is how does OEM know not to report on the same error about the same
    session multiple times. Once OEM has detected that my PL/SQL routine generated
    an exception during one of its execution, how will know not to alert on the same
    exception from the same pl/sql execution, the next time it's querying the
    database?
    It almost sound like the SQL query OEM will be executing needs to know what it
    reported on before.
    Any clarity on this would be appreciated.

    ok ..thanx .. can i view all historical SQL Text that is executed by a perticuler User say SCOTT.??? In the same page within SQL DETAIL you can find task owner also,

  • SSMA "Loading to database new table File Name.dbo[Table] ...sql execution failed

    In this case I had already processed this table once before 'no changes' and processed the second time I received this error ...sql execution Failed. It's like the sql server 2008 R2 doesn't see or detect the process. Starting Phase #0 Synchronizing Database:
    then it shows 'Loading to database new table file name.dbo[table] ... sql execution failed (this is my issue)

    Hi TheJudge2,
    Based on my understanding, you have installed SQL Server Migration Assistant successfully then you perform migration. After migration, you can’t find the table which you want to migrate to SQL Server 2008 R2 under the database in your SQL Server Management
    Studio, then you perform migration again. Then error message “Loading to database new table file name.dbo[table] ... sql execution failed” is thrown out. Please correct me if I misunderstand your meaning.
    Firstly, I would like to know whether you perform migration from Access database to SQL Server. I have performed migration from Access database to SQL Server in my lab environment.  Based on my test, I could migrate Access database to SQL Server successfully
    and table existed under the database in SQL Server Management Studio after migration.
    Besides, “sql execution failed” is a general error message. It is hard to find out the cause from this error message. Please check the information under the Output in SQL Server Migration Assistant again. It would be better if you can provide the complete
    output information for our deep analysis.
    Best regards,
    Qiuyun Yu

  • Error during SQL execution

    Hi Experts,
    We run a report which fails frequently with the below error. Could any one help me with the solution and reasons for this error.
    Error during SQL execution: (DA0003): [Exception: DBD, ORA-01722: invalid number State: N/A] The following data providers have not been successfully refreshed: His. (DMA0007): []
    Connection or SQL sentence error: (DA0005): [Exception: DBD, ORA-12535: TNS:operation timed out State: N/A] A connection required to refresh this document is unavailable. (DA0004): [] The following data providers have not been successfully refreshed: Reservations CW. (DMA0007): []
    Many Thanks
    Regards,
    Syed

    Hi,
    The report is running for long time and it's getting failed. could you please let me know what could be the reason for this?
    And could you please tell me the reason/Solution for the first error which i mentioned before.
    Many Thanks
    Regards,
    Syed

  • How many days old we can see SQL Executions OEM 11g

    one of my technical guy asked me 5 days back sql session information how many days old we can see SQL Executions OEM 11g ..?

    Metric Historical Information will be saved for a year by default.
    Check http://download.oracle.com/docs/cd/E11857_01/em.111/e16790/repository.htm#i1030660
    SQL Statement execution might be analyzed from AWR snapshots using ADDM.
    You can keep AWR Snapshots as long as you like.
    Bare in mind that this will occupy database space.
    From the Database Home page select the Server tab and select the Automatic Workload Repository link to set Snapshot Retention
    Regards
    Rob
    http://oemgc.wordpress.com

  • Slow sql execution

    I have SQL query retreiving lots of data from several tables, and having specific condition for nohem as it is displayed in following subquery:
    ss.nohem=(select Max(ss.nohem)
    from sschem ss
    where nohem in (3,5,6)
    and TRIM(ss.id)=TRIM(hc.id)
    As I notice, this subquery slows down main SQL execution (besides the tables are large and not well organazied).
    select ss.nohem, hc.time, hc.id, hc.shift, hc.crew, tm.qualityorg,
    ss.c, ss.si, ss.mn, ..., ..., ss.ca,
    l2_min.c as c_min, l2_max.c as c_max,
    l2_min.si as si_min, l2_max.si as si_max,
    l2_min.mn as mn_min, l2_max.mn as mn_max,
    l2_min.ca as ca_min, l2_max.ca as ca_max,
    tm.quality
    from sschem ss, tmelt tm, h_cast hc,
    l2_chem_grade l2_min, l2_chem_grade l2_max
    where (hc.time > {?from} and hc.time <= {?to})
    and ss.nohem=(select Max(ss.nohem)
    from sschem ss
    where nohem in (3,5,6)
    and TRIM(ss.id)=TRIM(hc.id)
    and tm.qualityorg=l2_min.quality_code and l2_min.range_type='MIN'
    and tm.qualityorg=l2ch_max.quality_code and l2_max.range_type='MAX'
    and TRIM(ss.id)=TRIM(tm.id)
    and TRIM(hc.id)=TRIM(tm.id)
    and TRIM(ss.id)=TRIM(hc.id)
    order by hc.time
    How can I reorganize this query to make its execution faster?
    Thanks!

    Problem with the sub-query is likely a full table scan needs to be performed. The predicate "TRIM(ss.id)=TRIM(hc.id)" uses a function to convert the searched column.
    This means reading every row applicable, applying the TRIM function to the ID column, and then evaluating the predicate. If the ID column is indexed, the index is made useless by the function.
    Solution in this case - either make use of a function index, or better still, apply the TRIM via the INSERT/UPDATE trigger and create a normal index on the ID column.
    Second problem is that the sub-select is ran for every single row selected in the main loop - it is a corellated query as the predicate for the sub-query includes a value from the row from the main query.
    So if the main query hits 10,000 rows, this sub-query will be executed 10,000 times. With the sub-query doing a full table scan, this is very, very expensive.
    Solutions. Ensure that all filters and processing are done (upfront) to reduce the result of the main query to a minimum, in order to reduce the number of sub-queries to perform (1 per row) to a minimum. Or rethink the logic and design of the entire query and do away together with the corellated sub-query.

  • How to get the SQL Execution Plan from complex Extractors ?

    Hi
    I am looking for a way to get  the
    SQL Execution Plan(s!) 
    from
    Complex Extractors like 0CO_OM_CCA_9 ?
    Anybody has got a suggestion ?
    How to get this in SM50 ?
    ThanXs
    Martin

    Identifying the query is the hard part. If you can identify it(based on table access or some such parameter, getting the execution plan is easy in ST04 .

  • How to find out if SQL execution plan is changed proactively using job/grid

    Hello,
    Can you help me on How to find out if SQL execution plan is changed proactively using job/grid control?
    Thank you..
    -

    The answers so far are supposed to show ways how to see that a plan changed after the fact - that is not really proactive but that was the question.
    A way to see a plan change proactively would be to create a SQL Plan Baseline for the SQL statement with the 'good old' plan and then watch DBA_SQL_PLAN_BASELINES for new rows with that SQL_HANDLE which would indicate that a new execution plan was computed - although not yet used.
    Kind regards
    Uwe Hesse
    "Don't believe it, test it!"
    http://uhesse.com

  • Top Activity and Monitored SQL Executions

    Hi,
    We have some issues with our batch jobs and I bumped into an issue I've seen before.
    I can see in Top Activity that there is a job running in my database and I can see the SQL through Top Activity page in GC. When I try to monitor the SQL "live" with Monitored SQL Executions I can't see any executions at all in the database.
    If I go to the session browser in TOAD I can see the process (SID) as active and I can see the current statment (the same as in Top Activity)
    So to summarize:
    Why can't I see the SQL in Monitored SQL Executions?
    Btw We run Oracle 11.2.0.2
    Regards
    Morten

    Please log an SR provide SQL Monitor Active Report for your SQL. Thanks.
    -Mughees

  • To track SQL Execution time automatically

    Hi All,
    I have requirement of tracking execution time of for each SQL executed.
    For Eg, If i run command create index, in SQLPLus session, time to execute create index command should be tracked.
    Any idea how to implement this?
    Any help is appreciated.

    899485 wrote:
    You have mistaken me. We have 2 environments. Dev,Prod and QA. 2 or 3?
    So when code is moving to Production we need atleast approx time of deployment of code. Why should there be a relationship between execution times on Prod and Dev?
    Do Prod and Dev have the very same hardware? Same type storage system? Same storage system configuration ito redundancy? Same data volumes? Same processing loads? Are the execution plans the same? Are the Oracle version and patch levels the same? Are the instance and database initialisation settings the same? Etc. etc.
    It may vary but we want approx time. For that we want to capture SQL execution time.So if the Prod execution time is larger than the Dev approx time, then there is a problem?
    How is that a more sensible approach than looking at overall performance and utilisation on Prod, determining the most CPU intensive SQLs, the most I/O intensive SQLs, the most often executed SQLs, and addressing these within the context and environment and h/w and processing loads on Prod?
    Comparing execution times will simply say that the may be a problem. Not that there is a definitive problem. You still need to evaluate that metric and determine if this indicates a problem.
    So seeing that this evaluation needs to be done, why not use better metrics? Like what AWR uses? Like what OEM shows?
    Our application is dataware house application. So before insertion we disable the index and after load we enable index while enabling we capture execution time for enabling.Instrumentation is a different principle. And instrumenting your code to record the process run, the number of rows processed is a sensible approach to keeping track of production run-times, data volumes processed and even failures.
    But I see very little value in taking Dev runtimes and trying to apply that as a benchmark on Prod for identifying performance issues.

  • How to write SQL in crystal report that can reuse SQL execution plan cache?

    I write the following SQL with crystal report parameter fields, and it is connecting to SQL 2005
    Select Name from Customer where CustID = '{?CustID}'
    The SQL profiler show that It is an ad-hoc query, how to write parameterized SQL which can reuse Execution Plan.
    Edited by: Chan Yue Wah on May 14, 2009 3:17 AM

    Since there are too many report, it is not possible rewrite all. Is that crystal report do not have option to change how it query the database ?

Maybe you are looking for