Open and close the connection in oracle procedure

Here is the procedure I'm in I insert data into the table temp_soap_monitoring using the select statement. I have soap_monitoring table FONIC_RETAIL database where I want to take the data and insert into the table temp_soap_monitoring. I play the position of planner of all 5 minutes for this procedure so that I get always the latest data in soap_monitoring@fonic_retail table. The problem of this procedure is that it takes too much cost and the query execution time to perform this procedure. Whenever he tries to extract the data from db link and save my local database. I remember in Java, php, and other programming languages, we have method in order to open the db connection when we tried to extract data from db link and then once integration is complete, we can close the db connection. So the performance improves and also has no load on db link. In this method, we have to assign link db to retrieve the data. So I think is it possible to apply this logic in my oracle procedure. The question arises because at this moment I am hard code the link db, but now I have 3 db more links and I will not reproduce the same procedure by assigning diffferent db links.

PROCEDURE  "EXT_SOAP_MONITORING" AS

LAST_SM_ID Number
:= 0;
LAST_CAPT_DATE DATE
;

BEGIN

SELECT LAST_TASK_ID INTO LAST_SM_ID FROM CAPTURING where DB_TABLE='TEMP_SOAP_MONITORING';

insert into TEMP_SOAP_MONITORING(ID,REQUEST_XML,RESPONSE_XML,WEB_SERVICE_NAME,WEB_METHOD_NAME,CREATE_DATE,ERROR_CODE,ERROR_MESSAGE)
select ID,REQUEST_XML,RESPONSE_XML,WEB_SERVICE_NAME,WEB_METHOD_NAME,CREATE_DATE,ERROR_CODE,ERROR_MESSAGE from
SOAP_MONITORING
@FONIC_RETAIL WHERE WEB_SERVICE_NAME ='RatorWebShopService'  and WEB_METHOD_NAME = 'placeShopOrder' and ID > LAST_SM_ID order by ID desc;

update
CAPTURING
set LAST_TASK_ID=
CASE WHEN ((SELECT MAX(ID) from TEMP_SOAP_MONITORING) IS NULL) AND (LAST_TASK_ID  IS NULL)  THEN (SELECT MAX(ID) from SOAP_MONITORING@FONIC_RETAIL)
WHEN (SELECT MAX(ID) from TEMP_SOAP_MONITORING) IS NULL THEN LAST_TASK_ID + 1
ELSE (SELECT MAX(ID) from TEMP_SOAP_MONITORING) END,
CAPTURING_DATE
= CURRENT_TIMESTAMP, LAST_CAPTURED_DATE = LAST_CAPT_DATE where DB_TABLE='TEMP_SOAP_MONITORING';

END EXT_SOAP_MONITORING;

I have it here is the procedure which I insert data in

temp_soap_monitoring table by using the select statement. I have

soap_monitoring table of FONIC_RETAIL database where I want to take the data and insert into the table temp_soap_monitoring.

WHY? Why you are moving the data? Why not just use it table, is it already?

The problem of this procedure is that it takes too much cost and the query execution time to perform this procedure.

The solution is to FIND THE PROBLEM. Troubleshoot the code and find out where is the problem, if any.

Based SOLELY on what you have posted the solution might be to add just an appropriate index.

Whenever he tries to extract the data from db link and save my local

database. I remember in Java, php, and other programming languages, we

method to open the db connection when we tried to extract data of

DB link and then once integration is complete, we can close the db

connection.  So the performance improves and also has no load on db link.

What? The LAST thing you want to do is keep the closing and opening of the connections. I don't know how 'remember you' from Java or other languages. The main reasons pools of connections were invented to AVOID have to repeatedly open and close connections.

A db link not a NOT a "charge" - the "charge" is the query is made. If you write a poor query or have a poor data without the necessary index model, or have missing statistics, then you will get poor results.

In this method, we have to assign link db to retrieve the data. So I have
is it possible to apply this logic in my oracle procedure to belive. The
question arises because at the moment, I'm hardcode db link but now I
have more ties db 3 and I will not reproduce the same procedure by
assigning diffferent db links.

You can certainly write Java code to connect to each database with a direct connection. But all write code PL/SQL must include the database link. And the only way to avoid hard-coding the link is to keep the names of link in a table and use dynamic sql statements to build and run the query. This isn't what you want to do if you're looking for performance.

SELECT LAST_TASK_ID INTO LAST_SM_ID FROM CAPTURING where DB_TABLE='TEMP_SOAP_MONITORING';

For all we know which could be the WHOLE CAUSE of your problem. If there is no index on the table, you could do a full table to a table with lines scan 800 billion;

We have NO WAY of knowing since you haven't posted info. Please read the faq to find out how to post a request for tuning and the info you provide.

1. the query

2. the table and index DDL

3. the execution plan

4 RowCounts for tables and query predicates

5. the info on the stats: how you collected them and if they are up to date

update
CAPTURING set LAST_TASK_ID=
CASE WHEN ((SELECT MAX(ID) from TEMP_SOAP_MONITORING) IS NULL) AND (LAST_TASK_ID  IS NULL)  THEN (SELECT MAX(ID) from SOAP_MONITORING@FONIC_RETAIL)
WHEN (SELECT MAX(ID) from TEMP_SOAP_MONITORING) IS NULL THEN LAST_TASK_ID + 1
ELSE (SELECT MAX(ID) from TEMP_SOAP_MONITORING) END,
CAPTURING_DATE = CURRENT_TIMESTAMP, LAST_CAPTURED_DATE = LAST_CAPT_DATE where DB_TABLE='TEMP_SOAP_MONITORING';

My guess is that TERRIBLE method of trying to get a 'LAST ID' is what's causing ALL your problems of performance. This method will not scale, and it will NOT properly work in a multiuser environment.

You need create a good BATCH_CONTROL table that all processes use during the creation and execution of lots.

The MASTER of the process batch:

1 Gets a new BATCH_ID using a sequence

2 locks the current row in the table control and uses / change the value "last".

3 creates a new line in the control table for the new batch process

4. the line of control to date with the start time, end time, result State, County, etc. for the batch

Your likely PROBLEM of has NOTHING to do with the links of the db.

Tags: Database

Similar Questions

  • Open and close the Panel the Subvi front

    Hi all

    Run LabVIEW 2011 on Windows 7 x 64.  I am trying to get a Subvi front to open from my main PC with the touch of a button, then close with a button press in the Subvi.  Here's the piece of my main FP who calls the VI and opens the FP

    Locations is defined in another loop and all loops are in a flat order.  I made this way because I want to start with the first press and not stop my main loop to run.  So I don't know if I can run in the same line as the event or not, I've moved the element to the left loop around a lot.  Anyway the VI of openness seems to work very well.

    The problem arises when you try to close the Subvi for the SECOND time.  The code is here:

    As I said, the first time I open and close the VI everything works as it should, hopefully.  Then, I am able to reopen but now 'empty' button does not work and I can't close the window or even to open the block diagram to probe anything.  I tried to understand this point for a while, any insite would be greatly appreciated!

    Thank you

    Found my problem, I had the wrong boolean on one of my other events.  If this seems to be a good way to open/close a Subvi if anyone is interested!

  • No video and microphone when I open and close the laptop

    I have a Pavilion dv7 everytime I open and close my laptop to the camera and the microphone stops and it does not appear in Device Manager. It of like something is loose inside, this happened before its just out of warranty and how can it be solved?

    Thanks, I still have a warranty on the outside and I talked to them, so I'll send for repair. In the case of an ongoing problem I wish HP would recall and fix the problem.

  • Open and close the Popup with Javascript

    Using Apex 3.2

    I probably have done this lots of times in my old job, but do not have access to the code and now I can't work properly.

    I opened a window pop up with javascript
    Now, I need to close and refresh the calling page, but only if it ratifies the validation on the popup.
    I have an item hidden on my pop up called P7_FLAG.
    I have a process page after validation that affects P7_FLAG (only the value 1, if passes validation).
    I also have a "SUBMIT" button.

    So once I click my button "SUBMIT" page should look at validations, so ok, P7_FLAG the value 1, then close the popup and refresh the calling page.

    My current look of javascript like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    {
    window.close();
    window.opener.doSubmit('REFRESH');
    }
    }
    </script>
    My button
    javascript:saveChanges();
    The problem is that I need to click twice on the button SUBMIT.
    First, it sets P7_FLAG
    Second time, it closes page and refreshes.

    I probably made a fundamental mistake, but today I can't.

    See you soon

    Gus

    Published by: Gus C 10 may 2012 12:48

    Sorry about that I was blind

    Add this function to your page

    
    

    Call this function on the loading of the page

    onload="onloadclose();"
    
  • AR 11 opens and closes the unexpectadly.

    I just downloaded AR 11 and every time I try to open a file PDF AR closes after a few seconds. I can't view any PDF file. My operating system is windows 7.

    You can try Windows Explorer, navigate to C:\Program Files (x 86) \Adobe\Reader 11.0\Reader, and then double-click Eula.exe and accept the license agreement

  • Is there a tip action that will open and close the table of contents?

    I like that in CP5, Adobe has allowed users to change the icon associated with opening and closing of a Table of contents in layers.  Having said that, unfortunately, they show if small, I don't see what I created.  So, I was wondering, is there an advanced action or an action script that I could assign to a button that will allow my users open/close the table of contents?

    Thoughts?

    Eric

    I created a quick and dirty AS3 widget that can be used in Captivate 4 and Captivate 5 projects to open / close a table of contents in overlay with your own button mode.

    http://www.cpguru.com/2010/10/14/free-TOC-button-widget-for-Adobe-Captivate-4-AS3-and-Adob e-Captivate-5.

    Have fun; (o)

    / Michael

  • A menu button using custom on the slide to open and close the table of contents of Captivate 7

    Hello

    I have a custom menu button. When the user clicks on I want to see the table of contents, (I see there is a State to display the table of contents), but when the user clicks on the same menu again button on this slide how to hide the table of contents. IE, go hide and show.

    Thank you

    Captivate 7.0.1 contains a rocking action that allows you to enable a Boolean variable (for example the system variable that displays or hides the table of contents), and shutdown.  Use this action.

  • When I have two open browser windows, the first with several tabs, the second a window from a link (if one tab), and close the second window, I Quit Firefox message, ' do you want to save the tabs...?

    This was happening with FF 3 before moving on to 4 and not going on with FF4.0 until the 4.0.1 update has been applied, the first time, he ran. Same problem on another computer running FF3, so maybe a related problem of the extension.

    If I have three windows open and close the third, I don't get it. Only when two are open and one is closed. I could have three, close one, then the second and get the prompt.

    Non-disabled extensions
    Adblock more
    BugMeNot
    Cooliris
    Download Statusbar
    DownloadHelper
    DowntThemAll!
    FireGestures
    HTML5 Extension for Windows Media Player
    HTTPS everywhere
    Java Console
    Download the PDF
    Session manager
    TinEye Reverse Image Search
    YouTube how Snob

    People with disabilities

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • VI of hand stops fucntioning after as I open and close a Subvi to a structrue event.

    Hello

    I try to open a pop up vi of an event. I've been struggling with this for a while now. When I open a pop up vi and close it, the main vi stops correctly.

    I narrowed down it to the fact that the event that reminds the Subvi is never ending when the Subvi is closed.

    The attached picture is an example of what I'm doing. When I run the present, I never see the dialog box indicating "here.

    may be useful as an allusion to the problem...

    This does not work correctly if I run the vi, click to open the Subvi, close the Subvi (here the main vi is not working properly, do not click on anything whatsoever) then stop the main vi, run the main vi has even once, open and close the Subvi and then I see the dialog 'here '. , and my main vi works correctly.

    Thank you

    J

    What actually happens, is press you the Ok button and your panel closes and you set the stop 2 true.  OK, it's fine except that the stop Terminal 2 has already been read during this iteration of the loop.  So the loop will go again.  This time, it is read stop 2 to a REAL, but the structure of event needs an event before the loop can fill.  But the façade was already closed and you're stuck.

    As Dennis said, get rid of the 2 stop and just wire the TRUE constant straight out of the case of the event.  Wire a FALSE for all other cases of event.

  • I opened the window and 1-2 sec it close and open and close only I can't use firefox what should I do?

    When I open firefox, it opens and after 1-2 seconds it closes so I can't do anything and it will open and close automatically several times.
    I have uninstall for a month of waiting for the new version hopes can solve this problem, but he cant last vertion is 37.0.1 now 38.0 I used Windows 7
    What should I do?
    I always use firefox be my browser. But if this problem cannot be resolved, so I can't use it

    What happens when you start Firefox in Firefox SafeMode?
    https://support.Mozilla.org/en-us/KB/troubleshoot-Firefox-issues-using-safe-mode#w_how-to-start-Firefox-in-safe-mode

  • FF31: When I only have a tab open, even empty and close the tab window closes.

    FF31: When I only have a tab open, even empty and close the tab window closes.

    Type of topic: config in the address bar and press enter.
    Accept the warning.

    browser.tabs.closeWindowWithLastTab

    Double click to switch to false and then restart Firefox.

    Now, if you close the last tab of that window (or Firefox) does not close, but a new tab will be there.

  • I can't open my e-mail address. Error Msg "check online for a solution and close the program."

    I couldn't open my email... get a pop up block saying message "check online for a solution and close the program.

    Hello

    Please check the email client that you use to send and receive mail.  You use Outlook or Windows Mail, or you are using an Internet e-mail account?  If you please you would follow with me to provide detailed information about your question, I would be very happy.

    If you use Outlook, go to the Control Panel, go to programs and features and attempt to repair the installed program.  If necessary, back up your data to this show and uninstall and reinstall.

    Thank you

    Aaron
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • I opened a word from Windows Mail document, changed using Word 2007, you press on save and close the document. Now I can not find where he saved.

    original title: Windows Mail ate my file

    I opened a word from Windows Mail document, changed using Word 2007, you press on save and close the document.  Now I can not find where he saved.  I tried the search function in Vista, but it can not find the file either.  I tried to re - open the file in the email, but I just get the original version.  Can anyone suggest where it might be?

    Thank you very much

    Eamonn

    Once you open a Word attachment in an email, you must save it to your HARD drive until you make changes. If you do not, the changes are lost, but the original attachment is still with the e-mail.

  • When I try to defrag, a window opens and closes and a file download-security warning. A loop repeats. Other programs to do the same thing. Please help me fix this loop? SOS?

    When I run defrag, an IE window opens and closes and a file download-security warning comes up and asks me to run or save the file name: c:\windows\system32 dfrgui.exe, if I hit then another warning of IE - sec stands up and says 'the Publisher could not be verified. Are you sure that you want to run. I struck and the loop repeats. I run a diag of the F10 boot menu with dell. They say that its software and non-material, pay! Microsoft says that Dell is responsible. Other programs to do the same thing. I've updated and rerun my AVG security without error. We are automatically updated, and no other programs were added. Please help me fix this loop? SOS?

    Vista - open file - security warning
    http://www.Vistax64.com/Vista-security/125044-open-file-security-warning.html

    How to repair the operating system and how to restore the configuration of the operating system to an earlier point in time in Windows Vista
    http://support.Microsoft.com/kb/936212/#appliesTo

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/default.aspx/KB/929135

    Your programs launch properly from Safe Mode?  Or Normal Mode if you create another user to test with?

    Vista advanced boot options
    http://Techblissonline.com/Vista-advanced-boot-options/

    Try running ChkDsk to check your drive for errors. Right click on your drive icon / properties / tools / error checking.  Try first by checking do not each box (that it will run in read-only mode) to see if it reports any problems file or hard drive.  If so, restart it by checking both boxes and restart to allow him to attempt to fix any problems found.

    I see a lot of recommendations here for programs such as -

    Malwarebytes' Anti-Malware
    http://www.Malwarebytes.org/MBAM.php

    SuperAntispyware
    http://SUPERAntiSpyware.com/

  • Two days ago, I downloaded Adobe Acrobat update for mac desktop. It is registered with Adobe and watch on my account, such as registered. I try to open and get the error message "you are not connected to the internet or your clock is wrong" are all two in

    Two days ago, I downloaded Adobe Acrobat update for mac desktop. It is registered with Adobe and watch on my account, such as registered. I try to open and get the error message "you are not connected to the internet or your clock is wrong" are all two inaccurate statements. I GET NOTHING BUT NOTHING ADOBE 'SUPPORT '.  How can I get just the program open and running?

    Check your hosts file.

    help for that and other adobe.com sure common connection problems read, http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

Maybe you are looking for