Timer in PL/SQL (not using DBMS_JOB)

Is there a way to set a 1 second timer without using DBMS_JOB. I am trying to capture some information and the timestamp, yet the putting a long FOR LOOP does help and all the timestamps end up being the same time.
Thanks
David

Check dbms_lock.sleep

Similar Messages

  • Create timer function that does not use start-sleep

    Hey all I would like to create a timer function that does not use the start-sleep command because this freezes my GUI. I've wrote the start of a function but it seems to move on before the specified time has finished.
    Here's what I have:
    $Global:timerCounter=0
    $Global:timer = new-object System.Windows.Threading.DispatcherTimer
    Function Timer{
    param(
    [parameter(Mandatory=$true)]
    [int]$time
    $timer.Interval = [TimeSpan]"0:0:$($time)"
    $timer.Add_Tick({
    $Global:timerCounter++
    if($Global:timerCounter -ge 1) {
    $Global:timer.Stop()
    $timer.Start()
    Then in my script i would like to call Timer -time #of seconds. It seems that when I call it the add_tick is registered and then started but it continues on with the rest of my script. Is there a better way of doing this without using start-sleep?
    Thanks!

    Okay the issue I'm having is that I have code after the $timer.start that I don't wan't to run till a powershell job is done. In all the examples I've seen it has to come to the end of the code then it starts the tick. So in your example it comes to the
    end of of your code and showsDialog() then starts ticking.
    So:
    add-type -AssemblyName system.windows.forms
    $form=New-Object System.Windows.Forms.Form
    $btn=New-Object System.Windows.Forms.Button
    $form.Controls.Add($btn)
    $btn.add_Click({$form.Close()})
    $btn.Dock='Fill'
    $btn.Font='Lucida Console, 20.25pt, style=Bold'
    $btn.Text=[DateTime]::Now
    $timer=New-Object System.Windows.Forms.Timer
    $timer.Interval=1000
    $timer.add_Tick({$btn.Text=[DateTime]::Now})
    $timer.Start()
    $form.ShowDialog()
    #I want to do other things here but only after the ps job has finished
    Thanks I really am trying to figure this out. 
    Here is the code I'm working with I guess I'm unclear on how to order the timer and the rest of my code:
    if($syncHash.mainCopy){
    $syncHash.mainJobDone = $false
    $syncHash.writeHost = $false
    while(-not $syncHash.mainJobDone){
    [System.Windows.Forms.Application]::DoEvents()
    if($syncHash.writeHost -eq $false){
    Write-OutputBox -Message "Copying"
    $syncHash.writeHost = $true
    $syncHash.inProgress = $syncHash.mainCopy | Where-Object {$_.State -match 'running'}
    $syncHash.currentCopyTime++
    }elseif($syncHash.currentCopyTime -ge ($syncHash.averageCopyTime * 2) -and $syncHash.collectionCopyTime.Count -ne 0){
    $syncHash.Unusable += $syncHash.currentMainCopyMachine
    $syncHash.computersNotForInstall += $syncHash.currentMainCopyMachine
    $syncHash.inProgress = $null
    $syncHash.mainCopyTimedOut = $True
    Write-OutputBox -Type WARNING: -Message "$($syncHash.currentMainCopyMachine) is taking too long. Removing Job.."
    Add-Content -Path $log_path -Value "$($syncHash.currentMainCopyMachine) taking to long to copy to"
    Stop-Job $syncHash.mainCopy
    }else{
    $syncHash.inProgress = $syncHash.mainCopy | Where-Object {$_.State -match 'running'}
    Write-OutputBox -Message "." -NoNewLine
    ############################# ############# So I need it to wait right here I have other code other than in this block ############# that needs to run $syncHash.currentCopyTime++
    if(-not $syncHash.inProgress){
    $syncHash.mainJobDone = $true

  • Why is my SQL not using an index?

    I have a small SQL query (10g) where I join to basic table together on a customer_id column.
    select *
    from customer c
    inner join work_item sp1 ON sp1.customer_id = c.customer_id
    and I am using TOAD, which tells me (in the Explain Plan area), that I'm doing a "TABLE ACCESS FULL" scan on the customer table.
    But when I look at the details of BOTH tables, I can clearly see that they both have an index on the customer field, and they are both the same data types...
    The interesting thing, is that if I change the query to only select data from the work_item table,
    select sp1.*
    from customer c
    inner join work_item sp1 ON sp1.customer_id = c.customer_id
    I can see that the indexes are being used...
    Why is this? I must be able to select certain columns from the customer table, but why would it not use an index when I do?
    Thanks!

    If I understand correctly, below is a simple test case.
    I created a small table and indexed "object_id" column.
    When I issue "Select * from t" optimizer goes with FULL TABLE SCAN, whereas wehn "select OBJECT_ID from t" is issued, optimizer chooses to read from the index instead of accessing the table. This is because FAST FULL SCAN is far cheaper than a FTS in this case.
    SQL> create table t as select object_id, object_name from all_objects;
    Table created.
    SQL> exec dbms_stats.gather_table_stats(user, 't');
    PL/SQL procedure successfully completed.
    SQL> create index t_idx1 on t(object_id);
    Index created.
    SQL> set autotrace traceonly exp
    SQL> select * from t;
    Execution Plan
    Plan hash value: 1601196873
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      | 37932 |  1074K|    55   (2)| 00:00:01 |
    | 1 | TABLE ACCESS FULL| T | 37932 | 1074K| 55 (2)| 00:00:01 |
    SQL> select object_id from t;
    Execution Plan
    Plan hash value: 3958994525
    | Id  | Operation            | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |        | 37932 |   185K|    25   (0)| 00:00:01 |
    | 1 | INDEX FAST FULL SCAN| T_IDX1 | 37932 | 185K| 25 (0)| 00:00:01 |
    SQL>

  • Why does my battery usage and standby show as nearly the same amount of time yet I am not using my phone constantly ??

    Can anyone tell me why my battery usage and standby times are the same yet I am not using my eye phone all this time ? I am having real problems with my battery life it is running out after about 13 hours I have disabled most things suggested by other sites but to no avail !! Any suggestions ???

    Can anyone tell me why my battery usage and standby times are the same yet I am not using my eye phone all this time ? I am having real problems with my battery life it is running out after about 13 hours I have disabled most things suggested by other sites but to no avail !! Any suggestions ???

  • Why am I being charged data usage during the times my phone is not being used?

    I got a notice on my phone that my number has used all of its allowed data usage for the month.  I looked at my current usage and seen that I was being charged for data usage during the times that I am not using my phone.  I figured it up and it adds up to be more than the amount that you say I am over.  Explain please.

    Ok, what all should I turn off on my 5s and I should get any additional fees waived.  I just got this new phone about a week before Thanksgiving and never got a notice till it was full.  I have never went over before.  I also have never been told that I could be charged data even if I am not using my phone and I should make these changes to prevent this.
    Also, the phone was 2 days late getting to me.  So in addition to any additional fees that I may occur from the overage I should get a credit for the delay in my phone being sent.  Oh, and it probably would have been longer had I not called to see where it was at, which the guy that helped me put in the order and was to follow up the next day with a phone call to let me know what the status was and never did.

  • To use SQL or to not use SQL ..... That is the question

    A couple of posts lately have brought something to my attention that I wanted to discuss between the folks that view this forum because I believe it is important. I highly value the opinions of many of the members here so I think getting your insight would not only benefit me, but many other forum members as well.
    This discussion stems from two posts:
    {message:id=3786432} (Billy)
    ...The question that you need to ask yourself is why use such a technique? For rendering the data a specific way in the client? Well, rendering data is NOT a SQL function and in essence a result of ignorance of how to correctly use client-server. Rendering on the client is dealt with by the client itself. Using SQL to do it.. not only nasty (as many of these examples above are), but also far from optimal and efficient SQL. And in most cases, will not scale. Increase the data volume of the table queried and there will be a hefty performance knock as SQL is incorrectly used.
    ...>
    {message:id=3914362} (Sven W.)
    ...For the Pivot considerations. It is usually much better not to try to do this inside the database. If you think about it. The data itself can be fetch from the database very easily. To do a PIVOT is a kind of GUI/Layout representation for this data. This should be done in the GUI Layer.
    >
    I tried to respond to the thread Billy posted in, so I'll cut and paste my response here:
    Discussion
    Where do we as database developers draw the line between the correct use of SQL or not? Or between rendering on the client and just returning data?
    Now with LISTAGG, PIVOT and UNPIVOT all available to us would these be considered correct uses of SQL?
    Where does this leave the TO_CHAR function? Is this considered rendering?
    I'm fully expecting a fuzzy answer with something along the lines of "do the work where it makes the most sense" from a ease of development and maintainability perspective but I just wanted to ask.
    Hopefully this is a valuable discussion.
    Thanks!

    Let me give a simple example. You can store images in a table as a LOB. You can serve these images to a web browser client via mod_plsql.
    However, the data is static. It requires I/O (and some hefty ones for larger images). What is the biggest performance penalty we have in Oracle? I/O? What is affected by doing I/O to read these images? The buffer cache (which will age out other data in the cache).
    Where else can we store this data? The web server. At what cost to the performance of Oracle? None. Impact on web server? Heck, web servers are designed at their very core to do this!
    So where is the best place to storage static images in this specific case? Not the database, but the web server.
    Now simply extend this concept to the client - where is the best place to render data?
    Should the data be formatted for rendering (e.g. converted into HTML) in the database layer, or should it rather be done in the presentation layer?
    Now I can already hear the argument that the former is exactly what we are doing using APEX. We create dynamic HTML pages on the Oracle server side and then dish that up to the rendering layer to display.
    Two issues that need to be considered. Firstly, this is not done using SQL. This is done using a procedure language called PL/SQL - not using native SQL. PL/SQL in this case is used exactly as Java or PHP or Perl or any other "+app layer+" language would be used. It only happens that PL/SQL resides in the database too. But do not mistake it for what it really is - the application layer.
    The second issue drives home the point that even in 3 tier client server, the application layer is not the best place to do the formatting for the rendering layer. Web 2.0 aka AJAX.. Where the app layer delivers a dynamic rendering engine (as Javascript) to the rendering layer. After which rendering and formatting are done solely inside that rendering layer. And interaction between that and the app layer is requests for new/fresh data to be rendered.
    Why is AJAX becoming so popular? Key issues and concepts like performance, and a rich client interface and so on.
    This all points that the fundamental principle of using the rendering layer to do its thing and using the SQL layer to do its (separate and different) thing, still holds true.
    Yes, we may not always stick to this principle - as we do with doing the rendering (creating HTML) in PL/SQL using APEX for example.. but this is not because the principle is unsound. It is because of technology reasons (different browsers, different behaviour), lack of support for W3C standards (hello IE) and so on.
    It is only recently that these problem areas have been meaningfully addressed.. and why rendering frameworks like extJS is the (rendering layer) future of 3 tier client server.
    If the concept of using SQL to perform rendering and formatting had any substance.. then there would have been a lot of resistance to AJAX for example. The reverse is true.. as we all want to use SQL to do SQL and want the rendering layer to do its thing without us having to code in SQL to specifically support rendering and formatting. It is clunky. It slows down the SQL (every formatting function is a tiny overhead that adds up). It does not bode well for maintenance and changes to the presentation layer. And all those tiny overheads can spell doom for scalability.
    I do not see any gray lines here, or a question of "+opinion+", or "+it depends+". The architecture is clear. The fundamentals are sound.
    The real issue is how we choose to apply these. But (the "+incorrect+") application (of these fundamentals) does not invalidate the fundamentals.

  • I cloud will not use i tunes password windows 7

    I have changed the password so many times but still can not use icloud on my pc hope you can help

    No, it won't. That's the Restrictions passcode you are thinking about.
    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.

  • Why my query not using any index but doing a FULL TABLE SCAN

    Hi,
    My EXPLAIN PLAN output is
    Plan hash value: 1163866984                                                                                                                                                                                                                                                                                 
    | Id  | Operation               | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                                       
    |   0 | SELECT STATEMENT        |                   |   774 |   159K|       | 40847   (2)| 00:08:11 |                                                                                                                                                                                                       
    |*  1 |  FILTER                 |                   |       |       |       |            |          |                                                                                                                                                                                                       
    |   2 |   SORT GROUP BY         |                   |   774 |   159K|       | 40847   (2)| 00:08:11 |                                                                                                                                                                                                       
    |*  3 |    HASH JOIN            |                   | 77337 |    15M|  9744K| 40843   (2)| 00:08:11 |                                                                                                                                                                                                       
    |*  4 |     HASH JOIN           |                   | 77337 |  8836K|  5896K| 20987   (2)| 00:04:12 |                                                                                                                                                                                                       
    |*  5 |      HASH JOIN          |                   | 77337 |  4984K|       |  9292   (3)| 00:01:52 |                                                                                                                                                                                                       
    |*  6 |       HASH JOIN         |                   | 24991 |   951K|       |  3349   (3)| 00:00:41 |                                                                                                                                                                                                       
    |*  7 |        TABLE ACCESS FULL| IDS_TXNIDNUMBERS  | 24991 |   683K|       |  2328   (3)| 00:00:28 |                                                                                                                                                                                                       
    |   8 |        TABLE ACCESS FULL| IDS_TXNDEMDATAMAP |  2419K|    25M|       |  1006   (3)| 00:00:13 |                                                                                                                                                                                                       
    |   9 |       TABLE ACCESS FULL | IDS_IDNUMBERS     |  7435K|   191M|       |  5903   (2)| 00:01:11 |                                                                                                                                                                                                       
    |  10 |      TABLE ACCESS FULL  | IDS_DEMDATA       |  2583K|   125M|       |  3683   (5)| 00:00:45 |                                                                                                                                                                                                       
    |  11 |     TABLE ACCESS FULL   | IDS_TXN           |  2583K|   231M|       |  6403   (1)| 00:01:17 |                                                                                                                                                                                                       
    -----------------------------------------------------------------------------------------------------  All my 5 tables IDS_TXNIDNUMBERS, IDS_TXNDEMDATAMAP, IDS_IDNUMBERS,IDS_DEMDATA, IDS_TXN has indexes in relevant columns. Is it cause less time so CBO is not using the indexes.
    Thanks
    Amitava.

    amitavachatterjee1975 wrote:
    Please be polite when responding to my queries. If you find these questions not to your standard, stay away from them. This is an open forum and I have got my full rights to ask questions.Unsure, what wrong did you find in SB's reply. I find those links perfectly knowledgeable. The question of having so many unanswered questions probably pricked you a little too much. But that, IMO, is a legitimate question, to be asked to a User who even after being associated with OTN for over an year has 100% record of not getting an answer.
    For your original question, you will have to provide more details to allow people to answer you.
    You must read {message:id=3292438} and post the mentioned details. People do not carry a Crystal Ball to identify the problem merely by reading few lines of Problem description and Explain plans. Do not make people guess, provide appropriate details, to help them Help "You".

  • I have set up my time capsule but can not see it in finder

    I have setup my time capsule, I can see it on the network and have done an initial backup, I can see it under shared devices in finder but when I open it I cannot see any files in the folder

    If you have backed up your Mac using Time Machine to the Time Capsule, you would not use the Finder to see the files on the Time Capsule.
    If you want to see the backups, click on the Time Machine "clock" icon on the dock at the bottom of the screen and wait a few minutes for everything to load.
    Use the scale at the right of the screen to move from different recent backup times or dates. Select the time that you want and use the Finder like interface to navigate to locate a file or folder.
    More info on Time Machine is available in this Apple support document:
    http://support.apple.com/kb/HT1427

  • Yesterday was attempting to download music.my daughter used her itunes account and added the $30  i had purchased. since she had not used the account ina while she forgot the security ? and it locked us out for what the rep said would be 8 hours..

    yesterday I attempted to download music after purchasing $30 itune card from my daughters laptop..It cam to thje point where it asked 2 security questions and we were incorrect both times since she had not used it in 4 yrs..It locked us out. Had a rep call and he could not help since it was blocked. he sadi it would take up to 8 hours to go back in and we can changed the security ?s...How do I get there to do that?

    Hi FishonRB,
    Please go to your profile page for the forum by clicking on your name, and look at the top of the middle column where you will find an area titled "My Private Support Cases". There you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis, as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal

  • Start one job after another complets using PL/SQL procedure and DBMS_JOB

    All,
    I am attempting to refresh a materialized view using DBMS_JOB and having a PL/SQL program loop through each materialized view name that resides in a table I created. We do the table because they have to be refreshed in a specific order and I utilize the ORDER_OF_REFRESH column to dictate which MV comes first, second, third, etc.
    Now - I have this working to the extent that it kicks off 4 materialized views (currently set the procedure to only do 4 MVs for testing purposes) but I would ultimately like the procedure to create a new DBMS_JOB that calls DBMS_MVIEW.REFRESH of the next view in line ONLY after the preceeding materialized view DBMS_JOB completes.
    The purpose of all of this is to do a few things. One - if I simply create a procedure with the DBMS_MVIEW.REFRESH call to each materialized view in order - that works but if one fails, the job starts over again and will up to 16 times - BIG PROBLEM. Secondly, we want the job that will call this procedure to fail if it encounters 2 failures on any one materialized view (because some MVs may be dependant upon that data and cannot use old stale data).
    This may not be the "best" approach but I am trying to make the job self-sufficient in that it knows when to fail or not, and doesn't kick off the materialized views jobs all at once (remember - they need to start one after the other - in order).
    As you can see near the bottom, my logic doesn't work quite right. It kicks off all four jobs at once with the date of the whatever LAST_REFRESH is in my cursor (which ultimately is from the prior day. What I would like to happen is this:
    1.) 1st MV kicks off as DBMS_JOB and completes
    2.) 2nd MV kicks off with a start time of 3 seconds after the completion of 1st MV (based off LAST_REFRESH) date.
    3.) This conitnues until all MVs are refresh or until 2 failures are encountered, in which no more jobs are scheduled.
    - Obviously I am having a little bit of trouble with #2 and #3 - any help is appreciated.
    CREATE OR REPLACE PROCEDURE Next_Job_Refresh_Test2 IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_DELIMITER VARCHAR2(1);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH < 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    CURSOR MV_ORDER IS SELECT B.ORDER_OF_REFRESH,
                                  B.MV_OBJECT_NAME,
                                  A.LAST_REFRESH
                             FROM USER_SNAPSHOTS A,
                                  DISCO_MV_REFRESH_ORDER B
                             WHERE A.NAME = B.MV_OBJECT_NAME
                        ORDER BY B.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE + (30/86400); -- Start job one minute after execution time
              ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
         V_FAILURES := 0;
         V_JOB_NO := 0;
         V_NAME := I.MV_OBJECT_NAME;
         V_DELIMITER := '''';
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || V_DELIMITER || V_NAME || V_DELIMITER || ');',V_START_DATE,NULL);
              SELECT JOB, FAILURES INTO V_JOB_NO, V_FAILURES
              FROM USER_JOBS
              WHERE WHAT LIKE '%' || V_NAME || '%'
              AND SCHEMA_USER = 'CATEBS';
    IF V_FAILURES = 3
    THEN DBMS_JOB.BROKEN(V_JOB_NO,TRUE,NULL); EXIT;
    END IF;
    FOR O IN MV_ORDER
    LOOP
    IF I.ORDER_OF_REFRESH > 2
    THEN V_NEXT_DATE:= (O.LAST_REFRESH + (3/86400)); -- Start next materialized view 3 seconds after completion of prior refresh
    END IF;
    END LOOP;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Next_Job_Refresh_Test2;
    ---------------------------------------------------------------------------------------------------------------------

    Justin,
    I think I am getting closer. I have a procedure shown just below this that updates my custom table with information from USER_SNAPSHOTS to reflect the time and status of the refresh completion:
    CREATE OR REPLACE PROCEDURE Upd_Disco_Mv_Refresh_Order_Tbl IS
    V_STATUS VARCHAR2(7);
    V_LAST_REFRESH DATE;
    V_MV_NAME VARCHAR2(30);
    CURSOR MV_LIST IS SELECT DISTINCT NAME, LAST_REFRESH, STATUS
                             FROM USER_SNAPSHOTS
                        WHERE OWNER = 'CATEBS';
    BEGIN
    FOR I IN MV_LIST
    LOOP
         V_STATUS := I.STATUS;
         V_LAST_REFRESH := I.LAST_REFRESH;
         V_MV_NAME := I.NAME;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.LAST_REFRESH = V_LAST_REFRESH
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.REFRESH_STATUS = V_STATUS
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    END LOOP;
    END Upd_Disco_Mv_Refresh_Order_Tbl;
    Next, I have a "new" procedure that does the job creation and refresh show just below this which, when starting the loop, sets the LAST_REFRESH date in my table to NULL and the STATUS = 'INVALID'. Then if the order of refresh = 1 then it uses SYSDATE to submit the job and start right away, else if it's not the first job, it uses V_NEXT_DATE. Now, V_NEXT_DATE is equal to the LAST_REFRESH date from my table when the view has completed and the V_PREV_STATUS = 'VALID'. I think tack on 2 seconds to that to begin my next job.... See code below:
    CREATE OR REPLACE PROCEDURE Disco_Mv_Refresh IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_PREV_STATUS VARCHAR2(7);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME,
                                  A.LAST_REFRESH,
                                  A.REFRESH_STATUS
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH <= 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    V_NAME := I.MV_OBJECT_NAME;
    V_FAILURES := 0;
    UPDATE DISCO_MV_REFRESH_ORDER SET LAST_REFRESH = NULL WHERE MV_OBJECT_NAME = V_NAME;
    UPDATE DISCO_MV_REFRESH_ORDER SET REFRESH_STATUS = 'INVALID' WHERE MV_OBJECT_NAME = V_NAME;
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE;
    ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || '''' || V_NAME || '''' || '); BEGIN UPD_DISCO_MV_REFRESH_ORDER_TBL; END;',V_START_DATE,NULL);
    SELECT A.REFRESH_STATUS, A.LAST_REFRESH INTO V_PREV_STATUS, V_NEXT_DATE
    FROM DISCO_MV_REFRESH_ORDER A
    WHERE (I.ORDER_OF_REFRESH - 1) = A.ORDER_OF_REFRESH;
    IF I.ORDER_OF_REFRESH > 1 AND V_PREV_STATUS = 'VALID'
    THEN V_NEXT_DATE := V_NEXT_DATE + (2/86400);
    ELSE V_NEXT_DATE := NULL;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Disco_Mv_Refresh;
    My problem is that it doesn't appear to be looping to the next job. It worked succesfully on the first job but not the subsequent jobs (or materialized views in this case).... Any ideas?

  • Using dbms_job for the 1st time

    I am attempting to use dbms_job for the 1st time and doing some test, but I can't get it to run.
    Connected to: Oracle Database 10g Release 10.1.0.2.0 - Production
    SQL*Plus: Release 8.0.6.0.0 - Production on Wed Mar 1 10:36:18 2006
    I have alter system set job_queue_interval = 10;
    When I tried
    SQL> alter system set job_queue_interval = 10;
    alter system set job_queue_interval = 10
    ERROR at line 1:
    ORA-25138: JOB_QUEUE_INTERVAL initialization parameter has been made obsolete
    my code is as below.
    1 create or replace procedure d1 is
    2 v_job_no binary_integer;
    3 begin
    4 DBMS_JOB.SUBMIT(
    5 v_job_no,
    6 'test_dbms_job',
    7 trunc(sysdate,'hh')+1/24,
    8 'trunc(sysdate,''hh'')+2/24');
    9 commit;
    10* end;
    SQL> /
    Procedure created.
    SQL> exec d1;
    BEGIN d1; END;
    ERROR at line 1:
    ORA-06550: line 1, column 107:
    PLS-00103: Encountered the symbol "END" when expecting one of the following:
    := . ( @ % ;
    The symbol ";" was substituted for "END" to continue.
    ORA-06512: at "SYS.DBMS_JOB", line 79
    ORA-06512: at "SYS.DBMS_JOB", line 136
    ORA-06512: at "PMC_ERP_PROD.D1", line 4
    ORA-06512: at line 1
    Any clues??

    sorry, when I cut and pasted this I but in
    job_queue_interval in twice.
    I alredy have the following set also.
    SQL> alter system set job_queue_processes = 4;
    System altered.Well, it's good...
    And what about semicolon ? ;-)

  • SSIS - Change Config File Path LOCATION in SQL Agent Job Step (NOT USING DTEXEC)

    SSISers;
    I am not new to ssis but am trying to deal with promoting of ssis config files differently for a specific project. We are using SQL 2008 R2.
    As a standared pattern used for years, we just use SQL Agent, build a job step for the ssis package, add the ssis package as SQL Integration Services Package type from fileshare (not using Integration Services), and add the necessary production
    config files in the configutation tab of the job step. Easy.  We do not execute our packages with DTEXEC command line.
    A new project has the developers leaving the config files in the package - not removing the config files for deployment. Is there a way to override JUST THE CONFIG FILE PATH LOCATION in the job step for ssis package? Remember, we are NOT using dtexec. 
    I was told that /SET might do it but I do not see a good example anywhere of hooking this in and how it works for a CONFIG FILE PATH LOCATION - I see variable overrides but not CONFIG FILE PATH LOCATION. The packages were written with Absolute config file
    path and not Relative path.
    Please understand that my goal is to let them leave the packages as is, we move the config files to the production sever and all we have to do is flip the location of where the config files are sitting for the ssis pacakge to look for them.  We would
    rather NOT have to use DTEXEC command  line with the job step for reasons that I do no need to get into on this forum.
    Any suggestions are appreciated.

    Hi mg30,
    There is no way to overwrite the XML configurations file just through modifying the SQL Server Agent job steps.  The Dtexec utility will apply the default package configurations for the second time after applying the options specified in the command
    lines or other package configurations configured in the job step.
    If the package is not deployed/installed, the Dtexec utility looks for the XML configurations file according to the file path defined in the Package Configurations Organizer window. In this situation, you need to either disable the package configurations
    or modify the XML file path in the BIDS.
    If the package is already deployed/installed, you need to modify the package as above or re-specify the install folder for the package configurations file. 
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • Sql is not using index

    SELECT DISTINCT eval.match_student_name (a.booking_id,
                                             2059980
                                            ) "Student Name",
                    NVL (b.student_email, b.email_address) email_address,
                    a.booking_id "Student Registration Number",
                    b.customer_name "Company Name",
                    DECODE (b.pmt_confirmed,
                            'E', 'Exception',
                            'Y', 'Yes',
                            'N', 'No'
                           ) "Confirmed Commitment ",
                    '1' "Edit", a.title "Class Id",
                    b.exception_comments "Exception Comments",
                    NVL (b.opn_member, 'N') "OPN_Member",
                    NVL (b.opn_partner_name, '-') "OPN Company Name",
                    a.booking_id "View Attendance",
                    DECODE (eval.check_bookingid_push_gsi (a.booking_id),
                            1, apex_item.checkbox (1, a.booking_id, 'Checked'),
                            apex_item.checkbox (1, a.booking_id, 'Disabled')
                           ) "Select",
                    DECODE
                       (eval.check_bookingid_push_gsi (a.booking_id),
                        1, 'Ready TO push TO GSI',
                        2, 'In Progress',
                        3, 'Complete',
                        'MANUAL'
                       ) "Booking ID Status"
               FROM ( select * from eval.eattend_student_attendance where title = 2059980 ) a,
                    ( select * from eval.eattend_student_info where verified_by IS NOT NULL ) b
              WHERE
                --AND b.verified_by IS NOT NULL
            a.title = b.title
           AND a.booking_id = b.booking_id
           ORDER BY a.booking_idExecution Plan
    Plan hash value: 3921177175
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 11 | 1870 | 353 (3)| 00:00:05 |
    | 1 | SORT ORDER BY | | 11 | 1870 | 353 (3)| 00:00:05 |
    | 2 | HASH UNIQUE | | 11 | 1870 | 352 (3)| 00:00:05 |
    | 3 | NESTED LOOPS | | | | | |
    | 4 | NESTED LOOPS | | 11 | 1870 | 351 (2)| 00:00:05 |
    |* 5 | TABLE ACCESS FULL | EATTEND_STUDENT_ATTENDANCE | 11 | 176 | 318 (3)|
    |* 6 | INDEX RANGE SCAN | PERF_EATTEND_STUDENT_INFO_N98 | 1 | | 2 (0)| 0
    |* 7 | TABLE ACCESS BY INDEX ROWID| EATTEND_STUDENT_INFO | 1 | 154 | 3 (0)| 0
    pls see the table full access of EATTEND_STUDENT_ATTENDANCE , i have a index in that table for a column being used in sql. why index not used ???
    thanks
    Raj

    Because Optimizer thinks that the query will take longer when using an index.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:736825544526
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9422487749968
    Please use:
    explain plan for [your query];and then
    select * from table(dbms_xplan.display);when you want an execution plan.

  • Can we use DBMS_JOB.BROKEN IN PL/SQL CODE

    HI
    below is my code
    CREATE OR REPLACE procedure dept_insert1 is
    X NUMBER;
    y number;
    BROKEN_FLAG CHAR(1);
    begin
    Select count(*) into Y from dept1;
    if y < 20 then
    SELECT trim(BROKEN) INTO BROKEN_FLAG FROM USER_JOBS WHERE JOB='1517';
    DBMS_OUTPUT.PUT_LINE ('FLAG.....'||BROKEN_FLAG);
    IF BROKEN_FLAG='Y' THEN
    DBMS_JOB.BROKEN(1517,FALSE);
    DBMS_OUTPUT.PUT_LINE ('FLAG.....1'||BROKEN_FLAG);
    DBMS_JOB.RUN(1517);
    DBMS_OUTPUT.PUT_LINE ('FLAG.....2'||BROKEN_FLAG);
    END IF;
    for i in 1..5
    loop
    insert into dept1 values (i,'DEPT'||i,'India');
    commit;
    end loop;
    end if;
    DBMS_JOB.BROKEN(1517,TRUE);
    End;
    i have 2 jobs --
    1st is validation job and second will excute if 1st compelete successfully.
    so hw can we do that??
    i did in following way --
    i created 2nd job and load it then set broken flag is Y then i called that job in my 1st job ..above is my proc which i using in my 1st job.
    but my 1st job fails every time and unable to broken flag =n for second job
    Reply ASAP

    1st is validation job and second will excute if 1st compelete successfully.
    so hw can we do that??using DBMS_JOBs to implement this sort of workflow is rather difficult because it is hard to co-ordinate these things, being as how they are background processes and don't talk nicely with each other.
    One way is to just have one job which calls a wrapping procedure which executes the procedure from the first job and then conditionally executes the code from the second job. This is the easiest way so I presume you have a good reason for not implementing things this way.
    Alternatively you could build a progress tracking table. the code in the first job sets a status flag. The code in the second jobs checks this flag to determine whether to continue with its processing or abend.
    Cheers, APC

Maybe you are looking for

  • Finder slow to show items in column, icon views (OK in list, cover flow)

    I'm seeing new perplexing slow behavior on our three-month old iMac running 10.5.5: when in column view and selecting (or in icon view and double-clicking) a folder, there is an initial five-second lag before items will appear in the next column or w

  • Recovering files from iPod that is apparently corrupted??

    I only use my 5th Gen 80GB ipod as a portable hard disc so it has a lot of crucial files on it.. suddenly its now saying its corrupted and needs to be restored, which i won't do until i can copy my files from it.. anyone know how to do this? i'm usin

  • Merging albums in iTunes

    I have uploaded CDs 1 to 4 of a large compilation on my Macbook Pro. The last 3 CDs appear as a single album in iTunes while the first one is standing alone. I would like to merge all 4 CDs into a single iTunes album. How do I do that?

  • How do i fix light leaks in my photos?

    i have a light leak in my camera and my last roll of film has come out with lots of red stripes over the images, is there a plugin i can use for aperture to repair the photos? or any other suggestions would be great! thank you

  • N70 Unable to establish network connection using p...

    . . . but can browse the net using handset alone; PC suite can do other functions but OTA is not able to connect. This happened after I downloaded the latest PC Suite 7. Recommendation of FAQ/Help is to check connections settings (duh) and have coope