Parallelize a procedure call

Is there a simple way to call a parallel procedure?

I wan't something like this:

declare

int l_first;

int l_second;

int l_third;

Start

l_first: = start_new_thread ('call my_procedure (1)');

l_second: = start_new_thread ('call some_procedure (2)');

l_third: = start_new_thread ('call some_procedure (3)');

join_thread (l_first);

join_thread (l_second);

join_thread (l_third):

end;

The variant when you create task, create pieces, run the task and after all you drop the task is not convenient I want to just run my procedure in new thread, I don't need to chunk of other tables by rowid or something else.

It seems that you want to use threading and not necessarily parallel processing.

The difference? Well, parallel processing takes a load of unique work and that at the same time (hence the need for segmentation of the workload). Threads can be performed in parallel of the different workloads - for example in a a Flight Simulator thread can do the rendering, another sound, another model flight, another weather model, etc.

And this (and other) announces, is seems you want to put on and treatment not specifically parallel.

We can implement as background process threads (aka jobs).  But unlike the typical Windows/Posix thread synchronization between threads and access for the threads data segment, are not really possible.

Here is an example of a class Thread base to be used in PL/SQL:

SQL> create or replace type TThread authid current_user as object(
  2          thread_code     varchar2(32767),
  3          job_id          integer,
  4
  5          constructor function TThread( plsqlCode varchar2, startImmediate boolean default true ) return self as result,
  6          member procedure StartThread(  self in out TThread ),
  7          member function ThreadCompleted return boolean
  8  );
  9  /

Type created.

SQL>
SQL> create or replace type body TThread as
  2
  3          constructor function TThread( plsqlCode varchar2, startImmediate boolean default true ) return self as result is
  4          begin
  5                  self.thread_code := plsqlCode;
  6                  if startImmediate then
  7                          self.StartThread();
  8                  end if;
  9                  return;
10          end;
11
12          member procedure StartThread( self in out TThread ) is
13                  pragma autonomous_transaction;
14          begin
15                  DBMS_JOB.Submit(
16                          job => self.job_id,
17                          next_date => sysdate,
18                          what => self.thread_code
19                  );
20                  commit;
21          exception when OTHERS then
22                  rollback;
23                  raise;
24          end;
25
26          member function ThreadCompleted return boolean is
27                  i       integer;
28          begin
29                  select 1 into i from user_jobs where job = self.job_id;
30                  return( false );
31          exception when NO_DATA_FOUND then
32                  return( true );
33          end;
34
35  end;
36  /

Type body created.

SQL>
SQL> declare
  2          thread1 TThread;
  3  begin
  4          thread1 := new TThread( 'dbms_lock.sleep(10);' );
  5          dbms_output.put_line( to_char(sysdate,'hh24:mi:ss')||': thread running as job '||thread1.job_id );
  6
  7          while not thread1.ThreadCompleted() loop
  8                  dbms_output.put_line( to_char(sysdate,'hh24:mi:ss')||': thread busy...' );
  9                  dbms_lock.sleep(1);
10          end loop;
11
12          dbms_output.put_line( to_char(sysdate,'hh24:mi:ss')||': thread completed' );
13
14  end;
15  /
07:52:50: thread running as job 767
07:52:50: thread busy...
07:52:51: thread busy...
07:52:52: thread busy...
07:52:53: thread busy...
07:52:54: thread busy...
07:52:55: thread busy...
07:52:56: thread busy...
07:52:57: thread busy...
07:52:58: thread busy...
07:52:59: thread busy...
07:53:00: thread busy...
07:53:01: thread busy...
07:53:02: thread busy...
07:53:03: thread completed

PL/SQL procedure successfully completed.

SQL>

Note that no validation is to ensure that the StartThread() method is not called repeatedly - this class is a simple test model that has yet to evolve before production use.

Tags: Database

Similar Questions

  • Remote procedure call (RPC) - how can I determine if a person has been access to my system remotely? I think someone is.

    I think that my computer is accessed remotely, files and emails being read. I disabled remote access in the Services section and have also disabled Mobile Sync; I did not use one of these services.

    When I took the remote procedure call (RPC) service and open the properties, the logon tab has the section "This account" clicked, "Network Services" typed in the box and a password. I can't change anything on this tab properties. I can't disable the service or disable the 'unattached profile '. How access to this service to make changes and more importantly, how can I confirm that someone logging into my system to remote and checking e-mails, files, etc.. This isn't a networked system, it's my computer in my home office. I am running Vista Ultimate.

    Thanks in advance for your help anticiapted.

    Hello

    Ultimate also has group policies that you can set to lock the machine - GPedit.

    Management of Windows Vista Group Policy (part 1) - see links to part 2 and 3
    http://www.windowsecurity.com/articles/managing-Windows-Vista-Group-Policy-part1.html

    Don't forget someone might access your email on the server, so do not forget to set a new password.
    As someone else has physical access to the computer?

    System Services stop isn't really the best/correct method to ensure safety.

    1. make sure that the system is free malware:

    Do a thorough check of the malware as no program detects and removes everything. Easy to find addition
    Malware is often accompanied by more difficult to discover and remove the payloads. Better to be cautious
    now that suffer the consequences later.

    It can be made repeatedly in Mode safe - F8 tap that you start, however you must also run them
    the Windows when you can.

    Download malwarebytes and scan with it, run MRT and add Prevx to be sure that he is gone. (If Rootkits run UnHackMe)

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN

    Malwarebytes - free
    http://www.Malwarebytes.org/

    Run the malware removal tool from Microsoft

    Start - type in the search box-> find MRT top - right on - click RUN AS ADMIN.

    You should get this tool and its updates via Windows updates - if necessary, you can download it here.

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
    (Then run MRT as shown above.)

    Microsoft Malicious - 32-bit removal tool
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=AD724AE0-E72D-4F54-9AB3-75B8EB148356&displaylang=en

    Microsoft Malicious removal tool - 64 bit
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=585D2BDE-367F-495e-94E7-6349F4EFFC74&displaylang=en

    also install Prevx to be sure that it is all gone.

    Download - SAVE - go to where you put it-right on - click RUN AS ADMIN

    Prevx - Home - free - small, fast, exceptional CLOUD protection, working with other security programs. It comes
    a scan only, VERY EFFICIENT, if it finds something to come back here or use Google to see how to remove.
    http://www.prevx.com/   <-->
    http://info.prevx.com/downloadcsi.asp  <-->

    Choice of PCmag editor - Prevx-
    http://www.PCMag.com/Article2/0, 2817,2346862,00.asp

    --------------------------------------------------------

    If necessary here are some free online scanners to help the

    http://www.eset.com/onlinescan/

    http://OneCare.live.com/site/en-us/default.htm

    http://www.Kaspersky.com/virusscanner

    Other tests free online
    http://www.Google.com/search?hl=en&source=HP&q=antivirus+free+online+scan&AQ=f&OQ=&AQI=G1

    --------------------------------------------------------

    Also do to the General corruption of cleaning and repair/replace damaged/missing system files.

    Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup

    Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN

    Enter this at the command prompt - sfc/scannow

    How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
    generates in Windows Vista cbs.log
    http://support.Microsoft.com/kb/928228

    Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.

    How to run the check disk at startup in Vista
    http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html

    -----------------------------------------------------------------------

    If we find Rootkits use this thread and other suggestions. (Run UnHackMe)

    http://social.answers.Microsoft.com/forums/en-us/InternetExplorer/thread/a8f665f0-C793-441A-a5b9-54b7e1e7a5a4/

    =======================================
    =======================================

    2 configure security - get a router with a built-in hardware firewall to add to your safety.

    Check with your router manufacturer and their forums because they usually have great information.

    Better to use WPA/WPA2 security if they are available and you can hide the SSID that will help
    help others to see the network (note on some routers more hide the SSID)
    causes of connection problems and if they find out the name he is more useful).

    Wireless network general recommendations of security for individuals
    http://theillustratednetwork.MVPs.org/LAN/SoHoWirelessSecurity.html

    Introduction to wireless network security
    http://netsecurity.about.com/od/Hackertools/a/aa072004b.htm

    10 tips for Wireless Home Network Security
    http://compnetworking.about.com/od/wirelesssecurity/TP/wifisecurity.htm

    Securing your wireless network
    http://www.practicallynetworked.com/support/wireless_secure.htm

    How to secure your router Linksys Wireless - similar can be used for other routers
    http://www.pctipguys.com/index.php?option=com_content&task=view&ID=57&Itemid=36

    What are the different wireless network security methods?
    http://windowshelp.Microsoft.com/Windows/en-us/help/b385cc8a-AF25-489e-a82e-decf6df26b681033.mspx#EZB

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • remote procedure call fail error fo vista SP2 printer installation

    I'm trying to reinstall my printer drivers and the HP software. I get the Windows Installer is not available. I have looked up lots of info on this and have tried many things but still seem to have a problem. This last time, I got the error message "the remote procedure call failed."  In services, the State of the PRC is started with Autostart upward, the RPC Locator is manual start. It is very annoying, because I can not use the HP printer. I disabled the AV and anti-spyware installation. Nothing seems to help

    Hello

    It sounds more like a problem with the installer for Windows rather than what it is with the printer itself.
    Have you tried to install other programs or equipment since the first see this message?
    If please see this thread and try again after the listed troubleshooting steps.
  • intermittent connection problem: 'the user profile Service service has no logon. The remote procedure call failed and did not execute. »

    Hello, I'm having intermittent problems with logging in my Windows 7 computer.

    Often after reboot due to applications of Windows Update or any simply restart after the holidays, I have the following message on trying to connect:

    "The service user profile Service has no logon. The remote procedure call failed and did not execute. "

    When I click 'OK', the machine disconnects and try to restart.  This can occur 2 to 5 times before _works_ .  But sometimes it happens at all.  And sometimes he _partially_ connects, but my "reminder" and the "Sidebar Gadgets' not loading not correctly and I get a different RPC error - for example, I lived once a message RPC over Skype cannot work because the remote procedure call failed.

    I'm fairly certain that it is different from the frequently reported issue 'profile of corruption', which was experienced by others.  This problem manifests itself as 'the user profile Service does not log. The user profile could not be loaded "and is reported as a blocking problem consistently reproducible which is set by the 'fixing' of the profile.

    However, the issue I feel is clearly related to an RPC problem is intermittent and not consistent - maybe one of my devices is not reset properly?  Where I can look in the logs of Windows, to provide relevant information on this subject?

    Because my computer was still under warranty, I have raised the issue of Dell and they removed the damaged system file (user account) last week.

    I hope that this will finally fix the problem (previously the error message disappear and reappear after a few weeks later.)  I'll give it a few more weeks to be sure.

  • Can not change the options in the remote procedure call

    I tried to open the remote procedure call in my Services. It is the value of Autostart and connect as a network system. However, all of these options, including the startup type, the service state, open a session on types and recovery have been grayed out so I can't change anything. I want to change my log on type, because I suspect it might be the reason for the inability of my laptop for install msi files. Is there a reason why I can't change anything in the remote procedure call? The remote procedure call Locator is thin. Any help would be greatly appreciated.

    Hi Logice,

    1. what happens when you try to install msi files? You receive an error message?

    2. did you of recent changes on the computer?

    The remote procedure call service is a very critical service of the system that you cannot change on the computer, as the editing options are disabled by design.

    MSI files are related to the Windows service install on the computer, if you receive an error associated with Windows install installing files msi on the computer I would suggest that you stop and restart the Windows service install on the computer and see if it helps.

    Manage services in Windows Vista

    http://Windows.Microsoft.com/en-us/Windows-Vista/manage-services-in-Windows-Vista-from-Windows-Vista-inside-out

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • With the system monitor position load raised by deferred procedure calls (DPC)

    After starting my E540 Thinkpad with an external monitor connected, a core is busy with (DPC) 50% deferred procedure calls and it works continuously to the clock speed of 100% (2.2 GHz). See the image below.
    After disconnect / reconnect the cable HDMI system load down close to 0% and the clock at about 40%, as it should.

    It looks like a driver problem.

    How to reproduce it:
    (1) the monitor is connected via HDMI, then turn on the Thinkpad opening shortly the Thinkpad.
    (2) after identifying, Manager tasks shows the 50% load to the base, the resource monitor shows that any load is consumed by deferred procedure calls and that the clock is always at 100%.
    (3) open the Thinkpad and unplug the HDMI cable. The load goes down to almost zero and the clock less than 50%, as it should.
    (4) plug the HDMI cable and the load remains at near zero.

    A few details:
    ThinkPad E540, i7-4702MQ, 8 GB, screen resolution 1920 x 1080
    Monitor HP LP2275w, resolution 1680 x 1050
    Win7 64-bit SP1, update Windows and ThinkVantage systemupdate

    The intel IGP is active (not Geforce 740 M).
    He dealt friezer if except the external screen is activated or the internal and externale are developed or duplicate in the Windows display settings.

    Someone else has the same problem?

    Any ideas what I can do?

    Here you can see:

    Link to photo

    Note of the moderator; image (s) converted into programming on display images in Forums

    Problem solved, with the help (here and here).

    Basically, the solution is the installation of a new graphics driver intel HD 4600 directly from intel.

  • The remote procedure call failed and did not execute

    whenever I put up-to-date Windows 7 freezes my new laptop and the computer ends by does not. Whenever I try to open my computer, documents, control panel and look for the following error message if poster to the remote procedure call failed and did not execute

    Hi aaabbbcccdddeeefffggg,

    Try the following steps:

    Type services in the start menu search box.

    In Services, scroll down to "Remote Procedure Call", and make sure that the status is "started."

    and set to automatic.

    The second 'RPC Locator' must be set to "manual".

    If the problem persists, as a workaround, you can perform online scan on your computer and check if the error message is caused due to malware or viruses.

    Now visit the link provided below for analysis online on your computer.
    http://OneCare.live.com/site/en-us/default.htm

    Later, try to install the updates and check.

    Aziz Nadeem - Microsoft Support

  • Receive "remote procedure call failed and did not execute" on several files or folders

    I get this error message when you try to open all folders ".  That is to say - 'profile by default', default, computer, administrator and three records under my name.  Also when I try to open the Control Panel, I get...: {26EE0668-A00A-44D7-9371-BEB064C98683} \0 "remote procedure call failed and did not run".

    This leaves me no way to even check the status of all.  Does anyone know why I get this message? And more important still, how can I solve this problem?

    I guess maybe I should say that I have not tried to restart my PC.  I will try that next. But, even if the issues go away, I would really like to hear what caused it.

    Thank you

    Barb Morris

    For memory than usually Service error RPC does not work, but it should always be running and takes an extra effort to stop it if something went haywire somewhere.

    If the Service or the system is not afflicted in other cases restart is a good first move.

    Your mistake could have resembled these examples from my notes:

  • "search query: = services the remote procedure call failed and did not run".

    My computer crashed two days ago and I'm finally home, but whenever I try to open a window of any folder I keep refusing. In particular the main computer folder. One of the error messages I got is the following:

    search query: = services the remote procedure call failed and did not run

    Followed by this one:

    The remote procedure call failed and did not execute.

    I opened the Task Manager and tried to access the services from there, but whenever I do, the Task Manager window freezes.

    How can I fix it, my computer is so slow running and does hardly anything and guard with all freezing orders that I try.

    Hello

    This error generally, if the system is infected with Virus and malware or system files are corrupt.

    Please, try the methods below and check if the problem persists.

    SFC scanner.

    You can read the following Microsoft article to repair corrupted using SFC tool files. Use the System File Checker tool to repair missing or corrupted system files

    Reference: http://support.Microsoft.com/kb/929833/en-us

    If the problem persists, try a run Microsoft Safety Scanner.

    http://definitionupdates.Microsoft.com/download/definitionupdates/safetyscanner/amd64/msert.exe

    The Microsoft Security Scanner is a downloadable security tool for free which allows analysis at the application and helps remove viruses, spyware and other malware. It works with your current antivirus software.

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Important: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Do try the suggestions above and let us know the results.

  • Win 7 problem: "the remote procedure call failed and did not execute."

    I logged on my account that has administrator access.  However, I just rebooted and find that I can't run from the desktop or the control panel.

    Similar problems there.  I use only a workgroup, not a domain

    Hi Bourayku,

    Please use the Microsoft Windows Forum.

    Try the following steps:

    Type services in the start menu search box.

    In Services, scroll down to "Remote Procedure Call", and make sure that the status is "started."

    and set to automatic.

    The second 'RPC Locator' must be set to "manual".

    (a) what is the error message he gets when they try to run.

    (b) are there any error messages in the dealing with RPC event viewer?

    Post back with answers

    Kind regards
    Aziz Nadeem - Microsoft Support

  • Message: The remote procedure call failed and did not execute.

    Every once in a while when I use the computer, it will completely disconnect from the internet and when I try to open Windows Explorer, I get this message (see image). He cannot do anything with the computer except save if I have a file open. A few minutes after that I get this message, the computer restarts by itself, without warning or anything, it just restarts. I found another thread here who said to do the following:

    Type services in the start menu search box.

    In Services, scroll down to "Remote Procedure Call", and make sure that the status is "started."

    and set to automatic.

    The second 'RPC Locator' must be set to "manual".

    I checked, and the settings seem to be exactly as described above, then it may be that. My computer doesn't seem to have any virus, but I had this problem for some time.

    I appreciate any help with this issue, as I am a student of architecture and use my computer at all times.

    Hello

    I imagine the inconvenience that you are experiencing right now. The steps you did to solve the problem is appreciated. Don't worry, I will help you on that.

    This problem may occur because of corrupted system files.

    I suggest you to follow the steps mentioned below and check the issue.

    Method 1
    Run the System File Checker as is a Windows utility that allows users to find corruptions in Windows system files and restore the damaged files. You can see the steps mentioned in the link below to run that.

    Method 2

    Temporarily try to disable the antivirus on the computer program and check if the problem persists. If no problem occurs, you may need to check for updates and firewall settings in the security software.
     
    Note: check that you activate your anti-virus protection on the computer back after you complete these steps. It is not recommended to disable these settings on the computer. It's just to solve the problem.

    I hope this helps. Please write to us if you need further assistance, we would be pleased to help you.

  • "The remote procedure call failed and did not execute." Tried many things, still does not work

    Hello, whenever I try to open a file, the message "the remote procedure call failed and did not execute" appears. I checked that "Remote Procedure Call" began and is on automatic, as well as the RPC Locator is the manual value. I also ran a full system scan of my Norton Antivirus, which picked up nothing.  Can someone please?

    Hello

    You can try to change RPC Locator auto and see if that fixes the problem?

    I recommend that you only perform a scan with the auditor of the filesystem, which will scan your system for missing/corrupted or damaged files and will try to correct them.

    How to run the System File Checker

    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Also, you can run the check disk to find bad sectors that may be present on your system.

    Check your hard drive for errors

    http://Windows.Microsoft.com/en-us/Windows-Vista/check-your-hard-disk-for-errors

    Thank you

    Legaede

  • Not able to connect to Windows 7-"the remote procedure call failed."

    Hello

    Windows never lets an opportunity to prevent the user. I have problems on my lappy staff & problem appeared all of a sudden.

    When I got the system starts, it of not connection & throws the error message "the remote procedure call failed." What ever I do it is not the same error.

    I tried logging in safe mode but is not connect in SafeMode survey the same error.

    Tried to restore to the last successful boot. Same mistake.

    Really frustrating.

    Looks like only option I have is to format the lappy however I have a lot of data in C:\ which are not saved.

    Any help will be much appreciated.

    Kind regards

    Vigni

    I have a lot of data in C:\ which are not saved.

    Unfortunately, it seems that you belong to the large class of PC users who choose not to back up important data, until disaster strikes. Your data is not lost, but the recovery is much more painful than to use an external backup drive. Here are a few options:

    • If it is a desktop PC: connect the hard drive to some other desktop PC, then recover your data.
    • If it is a laptop: remove the hard drive, then put it in a box for disk 2.5 "USB. You can now connect this case for some other PC and recover your data.
    • Start the computer with a bootable Ubuntu CD and its graphic interface allows you to save your files on an external storage device.

    When you are finished, you get a HDD 2.5 "USB and use it for your regular backups (e.g. weekly). You can also store an image of your new installation, you save the trouble of the reconstruction of Windows where you have another accident.

  • Remote procedure call error

    Trying to fix a laptop that was given to me. Running 64-bit Windows 7, I've restored the computer out of the box configuration. now I can't install Microsoft Security Essentials due to this error, can't run CMD as an admin because I get this error, RPC is started and set to automatic and manual.  From what I've read elsewhere, that it seems that some type of virus/malware is causing the problem, but I can't install or run any antivirus or check its web-based virus to remove it because I always get the same error.

    Hi Corey,.

    Welcome to the Microsoft community forums.

    This error occurs because the remote procedure call service does not wait for all asynchronous RPC calls be returned before the service reassigns the structure. Because of this behavior, the asynchronous RPC call access reallocated wrong address. Therefore, an access violation occurs and the RPC service hangs.

    Method 1: A supported fix is available from Microsoft to resolve this problem refer to this article:

    Accidents to service remote procedure call on a computer that is running Windows Server 2003 SP2, Windows Vista, Windows Server 2008, Windows 7 or Windows Server 2008 R2

    http://support.Microsoft.com/kb/2401588/en-us

    If the problem persists, proceed to the next method.

    Method 2: Type services in the start menu search box.

    1. In Services, scroll to "Remote Procedure Call", and make sure the State says "Started" and set to automatic.
    2. The second 'RPC Locator' must be set to "manual".

    Method 3: If the problem persists, as a solution, you can perform analysis on your computer using Microsoft Safety scanner and check if it helps:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Warning: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    I hope this helps. If you need help with Windows, let us know and will be happy to help you.

  • When you try to log on, get error - "the system event notification service has no logon. the remote procedure call failed and did not execute. »

    My netbook will not open a session because it can not find a certain file. She won't tell me the file. and when I try to go to safe mode it freezes... is there anyway I can just read another account another point? the message I get is "the system event notification service does not log. the remote procedure call failed and did not execute. "tips anyone? I care is no longer the files it contains. If I could wipe it off somehow to factory settings then would be too cool. his windows 7 starter edition


    Original title: hp netbook to log issue

    You have two options:

    • Perform a factory restore. Check the homepage of the manufacturer for instructions.
    • Start the computer with your Windows XP installation CD, and then follow the prompts. You will have to find the different drivers to match your hardware, for example a driver for SATA hard drive.

Maybe you are looking for