PL/SQL to run the exe with the DB settings

Hi all

I have a little problem.

I'm in the need to write that all connection, disconnection and connection fail data to the Windows application log. To do this, I already tried various solutions, but with my configuration (EE Oracle 10.2.0.4) and Windows Server 2003 R2 X 64 the only possible solution is (apparently) the following.

I create a Table with the information I need:

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

CREATE TABLE logonaudittable
(
event VARCHAR2 (15).
SID NUMBER,
series # NUMBER,
time DATE,
name VARCHAR2 (30),
osuserid VARCHAR2 (30),
MachineName VARCHAR2 (64)
)
/
--------------------------------------

I have create a trigger for the connection data, one for logging for the logon fails:

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

LOGON trigger.

Database of logonauditing AFTER logon ON CREATE OR REPLACE TRIGGER
DECLARE
MachineName VARCHAR2 (64);
osuserid VARCHAR2 (30);
v_sid NUMBER (10);
v_serial NUMBER (10);

CURSOR c1 IS
SELECT sid, serial #, osuser, machine
FROM v$ session WHERE audsid = userenv ('sessionid');
BEGIN
OPEN c1;
EXTRACT the c1 IN v_sid, v_serial, osuserid, machinename;

INSERT INTO logonaudittable VALUES ('CONNECT', v_sid, v_serial, sysdate,
user, osuserid, machinename);

CLOSE c1;
END;
/

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

Logoff trigger

CREATE OR REPLACE TRIGGER logoffauditing
BEFORE logoff ON database
DECLARE
MachineName VARCHAR2 (64);
osuserid VARCHAR2 (30);
v_sid NUMBER (10);
v_serial NUMBER (10);

CURSOR c1 IS
SELECT sid, serial #, osuser, machine
FROM v$ session WHERE audsid = userenv ('sessionid');
BEGIN
OPEN c1;
EXTRACT the c1 IN v_sid, v_serial, osuserid, machinename;

INSERT INTO logonaudittable VALUES ('LOGOUT', v_sid, v_serial, sysdate,
user, osuserid, machinename);

CLOSE c1;
END;
/

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

Logon trigger FAILS

CREATE OR REPLACE TRIGGER logonfailauditing
AFTER ON SERVERERROR database
DECLARE
MachineName VARCHAR2 (64);
osuserid VARCHAR2 (30);
v_sid NUMBER (10);
v_serial NUMBER (10);

CURSOR c1 IS
SELECT sid, serial #, osuser, machine
FROM v$ session WHERE audsid = userenv ('sessionid');
BEGIN
IF (IS_SERVERERROR (1017)) THEN
OPEN c1;
EXTRACT the c1 IN v_sid, v_serial, osuserid, machinename;
INSERT INTO logonaudittable VALUES ('FAILLOGON', v_sid, v_serial, sysdate,
user, osuserid, machinename);
CLOSE c1;
END IF;
END;
/

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

The I create a trigger that starts each time something is written on the table.
This trigger must start an EXE file which writes the last data written on the table in the Windows application log.

So I need a trigger that executes my WRITELOG. EXE file adding parameters. For example:

Run WRITELOG. Event time username sid EXE

So my program will write a journal in Windows with these data:

Event: opening of SESSION
SID: 2938473
Time: 12/12/2011 11:45:32
User name: Scott

And so on.

I already have the program that does this, I need to run the program with the right data directly from trigger or procedure performed by my trigger.

Hope that I was clear and REALLY hope that someone can help me!

Thanks to you all!

So practically I should create a job something like this:

BEGIN
() dbms_scheduler.create_job
job_name-online "CONNECTION."
job_type-online "EXECUTABLE."
job_action => ' c:\yourdirectory\FILE. LOGON EXE ' | v_sid | » '|| v_serial | » '|| to_char(sysdate,'MM/DD/YYYY') | » '|| the user | » '|| osuserid | » '|| MachineName |';
number_of_arguments-online 1
start_date => SYSTIMESTAMP,
enabled-FALSE, online
comments => ' SQL * Loader jobs Demo');
END;
/

and then I need to start this work every time that the LOGON trigger fires and it must be the trigger that inserts into the work, the arguments v_sid, v_serial, etc..

... I don't know how I can do this. What I need to create a procedure that creates jobs and the procedure is executed by the trigger? and how do you know the procedure to create the job with the data provided by the trigger. Sorry I ask much for the help, but I need this thing made in a time which is not compatible with me studying how to do it by myself. I will look at it, I want to know exactly how these things work, but now I need to speed things up a bit!

Thank you for all the valuable assistance tfor!

Tags: Database

Similar Questions

  • Impossible to open or run files .exe with windows XP media edition

    Cannot open/run with windows XP .exe files.  How can I fix it

    Looks like your Windows file associations have to dispose. This means that XP is not
    know what to do with the files by looking at the file extension (for example, .exe for executables,
    .doc for MS documents, etc.).

    If you don't have it you, something done for you - most likely malware.

    Go to this site WWW by Doug Knox:
    http://www.dougknox.com/

    On the left, click on the Win XP fixes, file Association fixed and read the instructions at the top of the page.

    Download the EXE File Association Fix on your desktop, unzip the file and apply it according to the instructions
    from the top of the page, then reboot and test.

    Run the following scans for malware, and then fix any problems:

    Download, install, update and do a full scan with these free malware detection programs:

    Malwarebytes (MMFA): http://malwarebytes.org/
    SUPERAntiSpyware: (SAS): http://www.superantispyware.com/

    They can be uninstalled later if you wish.

  • Black screen - cannot run Explorer.exe with Task Manager

    Hi guys

    I've been Googling the answer to that for the last day and nothing seemed to work.

    Basically, my portable was working fine until this morning, when I restarted. After the home screen, just a rear screen with the mouse. CTRL ALT DEL and everything still works normally. I can run programs with the Task Manager, but can not run explorer.exe. He returned in the process for about 10 seconds then disappears. I think that it is the cause of the black screen. I tried downloading an own explorer.exe and replace the explorer.exe in C:\Windows\. My computer it did not as he said I need the permission of the administrator, but of course, I am the Admin so I don't know what that's all.
    I tried to restart in Mode safe and that works very well, still, I can't replace the explorer.exe in the C:\Windows\ because I do not have the administrative authorization. I tried to change it in the Security tab of the properties, or impossible.
    I also tried to update the driver software graphics cards, checked the Shell in the registry value and made sure it's explorer.exe, used the difficulty of black of Pevx screen, used HitmanPro and Windows Malicious Software Removal Tool to scan and remove malware. I even did a scf/scannow, checked driver C a mistake (which took 3 hours!), let Windows Startup Repair to fix things, tried a system restore but failed. He says that the anti-virus (Sophos) prevented the restoration of the system, so I've temporarily disabled its access scanning on but still unable to restore to a previous (11/01). Program changes that recent such as listed in the system restore is Google + Auto BackUp who came when set Picasa to date there 3 days and a more recent version of Facebook video call I've ever used. I am now running a scan with Sophos, not too promising.
    So yes, I tried everything. I think that now, there are only three options:

    1 somehow replace the explorer.exe in C:\Windows\ with this new cool explorer.exe, which I downloaded, with the permission of the administrator
    2. try another restore of the system, but I'm sure that nothing will happen, already tried three times.
    3 reinstall Windows 7 Edition Home Premium. It will be a real pain.

    So please help me! I have courses of due on Monday and this portable do not let me what that be done. Thank you!!!

    Please ignore the other my long answer. The problem has now been resolved.

    After trying all kind of scans, drinking and sobbing, I came across TDSS Killer from Kaspersky, who managed to catch a 1 latest unique malicious software (that I was too stupid and really looked hopeless and remember the name of), it cures the problem after reboot. Now, the laptop works well like you wouldn't believe. I'm still confused but way too happy now to care. Thanks a lot for your help nevertheless!
  • Run notepad.exe with winexec

    Hello!

    I m trying to open a text file of forms. I m using d2kwutil:
    wpgm := win_api_environment.read_registry('HKEY_CLASSES_ROOT\txtfile\shell\open\command', null, FALSE); 
    wpgm := replace(wpgm, '%1', '"'||wmy_file||'"');
    win_api_shell.winexec(wpgm, WIN_API.SW_SHOWNORMAL, TRUE); 
    "HKEY_CLASSES_ROOT\txtfile\shell\open\command" has this value: '%1 notepad.exe.

    wpgm is set correctly: if I run it in command prompt it works.

    In the Windows Task Manager, I see that a notepad.exe process appears, but the window is not visible...
    Notepad does not appear.

    What is someone has a tip how to solve this problem?

    Thank you

    Forms [32-bit] Version 6.0.8.11.3
    Oracle Database 10g Release 10.2.0.3.0 - 64 bit Production

    Why not simply use the command HOST:

    host('notepad.exe c:\temp\file.txt');
    
  • After effects are "disabled" when you run the argument s AfterFX.exe

    Hey guys, was hoping that you could help me.

    Write my first script with sequels to automate some of my approach. I want the script runs at startup with certain arguments passed via the command line, so I use the command - s.

    Everything is done except for one problem, when I run AfterFX.exe with the argument - s, for example if I do this:

    "PATH_TO_ADOBE_CS6\Support Files\AfterFX.exe" s "alert ('foo')"

    It opens after effects and I get this dialog box "foo", but for some reason any after effects is 'disabled '. I mean, it of that I can't do anything, is not open any project, nothing. all options are grayed out.

    Note that if after effects is already running, and I run the command, it is not 'turn off' after effects and I got the desired result.

    I use windows and legacy CS6.

    Note: of course, I intend to do something more complex than alert ('foo') that has been used a minimalist example to show my problem.

    Figured it out. For those who find it later, all I had to do was add "app.exitAfterLaunchAndEval = false;

  • RUN the object that will not start Windows on-screen keyboard

    I use Lookout 6.5 on Windows 7 Professional. I use a button to fire a sequencer whose output starts a RUN object with a command line of the 'c:\Windows\system32\osk.exe '. Executes the RUN object, but I get a window that says "could not start on-screen keyboard. The window has only 'OK' as an option - click on OK and the window disappears. I tried the same object RUN notepad.exe with wordpad.exe, and they work very well.

    Anyone see what I'm missing?

    Thanks for your reply, Ryan.

    I have now found a solution – but first a few puzzles. I can use the Lookout RUN object successfully to start other executable files in the Windows\system32 folder - but not the osk. I can start the osk in other ways (shortcut, double-clicking the .exe from a .bat file).

    I copied the osk.exe to another folder on the hard drive and can now begin with the Lookout RUN object. I don't know why this works differently - but it does. Thank you.

  • I can't get my Windows Firewall to use the recommended settings. I tried all the fixes. I am running Windows 7 ultimate x 64 and MSE.

    I had this problem for about 2 months. It started when my Dell Inspiron 580 s have been infected. Tried for several days to system clean up but could not. I took my tech, very good and reliable man, and he was even coming. He has COMPLETELY reformatted my hard drive and we have installed a new Version of Windows 7 Ultimate 64 bit. Computer works fine. I use Microsoft Security Essentials and also check with Malwarebytes. I keep all my software up to date and check DAILY.

    I have tried everything I know, and my tech guy is sick, and I can't get Windows 7 to run the recommended settings. He always tells me to update and I do, over and over again with the same result. Help, please.

    Hello
    Follow these instructions to fix the Windows Firewall:
    Download and install repair Windows:
    When the repair of Windows opens, click on the tab to start repairs, click Start. Unselect all the boxes except for the following:
    -Reset the registry permissions
    -Reset the permissions of files
    -WMI repair
    -Repair Windows Firewall
    Then click Start. Once it is finished, restart your computer. Let me know if this helps you.
    Brian
  • Executing an .exe with a SWF file. ?

    Hey.

    I was wandering if it is possible to run an .exe with a flash swf file file. When you click on a button?

    If it is then someone would be nice enough to tell me what I have to use the code please?

    I would like to use it with the button symbol.

    Thank you

    ~ Joe

    This should be:

    Stop();

    Btn.addEventListener (MouseEvent.CLICK, f);

    function f(e:Event):void {}

    fscommand ("exec", "psxfin.exe")

    }

    p.s. Please check the useful/correct.

  • DNS query script - need a way to script to query the DNS settings of all the servers on a domain

    Hi - I was wondering if anyone new a script or a simple way to query the DNS settings of all the servers on a domain? Basically, I need to know the primary and secondary, all our servers DNS settings and that discharge into a file. Any help is very appreciated

    Thanks in advance

    Hello

    As you try to run the DNS settings on the domain, I suggest you to post the same question on the Microsoft TechNet Forums

    You can follow the link to your question:

    Windows Small Business Server: http://social.technet.microsoft.com/Forums/en/category/windowsserver/

    It will be useful.

  • Error by running Setup.exe in the installation of MS - SQL 2008

    Hello I need to install MS SQL2008 but I am unable to run setup.exe in my system.

    The error was the installation of the .NET framework 3.5 service pack 1 has failed, and SQL Server 2008 requires .NET framework3.5SP1 should be installed.
    But I installed the .NET framework 3.5SP1. How can I solve this problem...?

    Hello

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums:

    http://social.msdn.Microsoft.com/forums/en-us/sqlsetupandupgrade/threads

  • NEITHER 9481 relay are not locked when running the labview compiled exe on a computer with only installed labview execution?

    I recently bought a cDAQ-9172 with several modules.  One of the modules is a NI 9481 relay module.  I created an application using Labview and built an exe file.  If I run the exe on the computer, it was developed on the relays work properly, that is, they remain locked up until their status is changed.  If I run the same exe on a computer with only the Labview runtime installed (no software installed), the pulse relay contacts and not locked.  I'm using Labview version 7.1 for my development and execution.  Everyone knows about this problem?

    Ignore this announcement, the error stems from a difference between each computer ini-files and has nothing to do with the Labview Labview runtime vs, my bad developer.

  • MCBUILDER. EXE running rampant, competing with updates for CPU and possibly associated with an update failed chess SP2 and the backup and restore

    Running Vista Home Premium SP1 and the system has been slow and freezing. MCbuilder appear to be using 50 to 100% of CPU, and it is a process that seems no way of killing. I disabled in Services, but again, it seems to start without any particular reason and hinders attempts to install programs or updates vista hogging resources. This can be associated with a problem that has arisen since June because I am not able to perform backups or set restore points (gives the error "0 x 81000101 the creation of a shadow copy has timed out"). I tried to install SP2 in the hope that it will not solve the problem, but the failure of installation and install KB947821 doesn't seem to work either. As the restoration of the system is defective, I would be grateful for the pointers to the resolve or completely remove this mcbuilder problem.

    You have COMODO or AVG Antii-virus installed on your system?  It is known problems with these two programs and MCbuilder.exe.  I don't have Microsoft Resource Builder Cache as a service in the Services (so I can't activate or deactivate it)-you which version of Vista to help (bit, SP-number version)?  I have 32 bit Vista Business SP2. I see no way to turn it off in order to close it with the Task Manager when it is - with the exception, but who could become annoying if it happens frequently and with multiple instances.  I could find nothing useful in Knowledge Base Microsoft on it hogging resources although I've seen a few threads using Bing (which is where I came up with COMODO and AVG anti-virus conflicts).

    You can be infected by malware (which may be the origin of the program to activate and run "without reason"). While in Test Mode safe mode (press F8 during startup and select mode safe mode with networking repeatedly) to run anti-malware programs. To resolve this problem (if it is a problem) download, install, and run the following two programs: http://www.malwarebytes.org/mbam.php and http://www.safer-networking.org/en/index.html.  You can also try a free trial of Pandasoft (www.pandasoft.com).  Before you download pandasoft, uninstall all anti-virus program you currently use (because the installation and execution of two simultaneously can cause conflicts, freezes and all sorts of problems).  Once you have uninstalled your current AV program, download, install, update and scan using Pandasoft.  I think you might be amazed at how much she notes that other software missed.  Once complete, uninstall pandasoft and re - install your current AV program (unless you decide to spend that I did when I tried about 4 years ago).  You can also try the new, free Microsoft Security Essentials http://www.microsoft.com/security_essentials/default.aspx (with the same caveat that only program AV one ALONE can be installed and running on your system at any time). Restart after finishing all the scans and see if the problem has been resolved.

    Try a system restore to a point in time BEFORE the problem started (which can be a problem if it began all the way back in June - you should have posted here then when this process would probably have worked).  Here is the procedure: http://www.howtogeek.com/howto/windows-vista/using-windows-vista-system-restore/.  Don't forget to check the box to show more than 5 days of restore points (but I doubt that you will have a pretty far back and forth to the system restore may not be a viable option).  If the first attempt fails, then try an earlier point or two.  NOTE: You will need to re - install any software and updates that you have installed between now and the restore point, but you can use Windows Update for updates.

    If the system restore does not work, do a startup repair, boot from the disk Installation of Windows Vista genuine (or one that you can borrow from someone) or a recovery disc.  Here is the procedure: http://www.bleepingcomputer.com/tutorials/tutorial148.html.  You may need to change the BIOS to do first the CD drive in the boot sequence to boot from the CD.  To do this, hold the screen that tells you the key F to push to enter the menu start or start of installation.  Push it quickly. Make the changes, save your work and exit.  Put the CD in the drive and reboot.  When you are prompted, press any key to boot from the CD.

    If you do not have a floppy disk, you can make a bootable recovery disk by using http://neosmart.net/blog/2008/windows-vista-recovery-disc-download/ with burning software like: http://www.snapfiles.com/get/active-isoburner.html and, of course, a blank CD.

    If this does not work, try to start in safe mode (repeatedly hit F8 key so that the start and go in safe mode with networking).  Then we will check some of your system files:

    Go to start / all programs / accessories / command prompt and right click on command prompt, and then click Run as administrator.

    Type sfc/scannow, go and let it run.  It will scan and try to correct some of your system files.  If all goes well it will complete with no corruption, he couldn't fix it (if there is such corrouption post here or try to analyze it to find the problem or files using http://support.microsoft.com/kb/928228.  I bet there is something involving the program or associated with this program.

    If this does not work, you will need to do a repair/system upgrade using the Windows Vista Installation disc authentic (you own or that you can borrow from someone).  Here is the procedure: http://www.vistax64.com/tutorials/88236-repair-install-vista.html as well as the upgrade from an earlier version of the Windows section of the following: http://support.microsoft.com/kb/918884.  Although this will not affect your data, settings or programs, you should always back up your data before you start just be on the safe side.

    I hope one of these procedures can solve your problem (probably the SFC command or controls anti-virus).  If this isn't the case, after return and we will try something else.  Return message anyway so we know how it turns out.

    BTW, for update of the problems you are having with SP2, post on the Forum of Windows Update to: http://social.answers.microsoft.com/Forums/en-US/vistawu/threads where the people who specialize in update issues will be happy to help you with your concerns and get SP2 running on your system (perhaps despite this particular problem).  As you say, it can even solve the problem - who knows.

    Good luck!
    Lorien - a - MCSE/MCSA/network + / A +.

  • I accidentally put to run the exe with adobe PDF viewr files and can't find how to cancel it

    I was running an exe file and accidentally did something and now he's trying all the files with the adobe PDF Viewer running and I can't undo. Help, please.

    See this tutorial.

    http://www.sevenforums.com/tutorials/19449-default-file-type-associations-restore.html?filter [2] = file Folder settings

  • Run the report to PL/SQL with the branch to another page

    I have an application which, at various times, I run a PL/SQL procedure to perform an action, and then we must run a report while also navigating away from the current page. The actions are performed on a button click.

    I tried several methods, but for the life of me cannot get the system to do the two things (ie. run the report and the direction to another page). I tried to put in page 0 (to be executed after the treatment on the click of a button) a branch with a request line to print the report, followed by a branch to the other page (also to run after the treatment on the button click) - and only the branch page 0 runs in fact. Also tried a branch to the other page only, with the print in the request parameter request - but only runs the report, do not create a branch to the other page.

    I also tried to put the call to run the report in the PL/SQL code, using utl_http.start_request (url), but that came with a "Bad Request" error. Also tried to use the owa_util.redirect_url call, but also no chance.

    I'm pulling my hair out at this time, especially because I am under pressure to get the system in very short time.

    Any suggestion would be appreciated.

    You can run queries report of their URL (f? p = & APP_ID.: 0: & SESSION.: PRINT_REPORT =)

    So one approach would be to
    The button click, call a JS function which

  • 1 use the Ondemand/recall process in order to perform the processing workflow (file selection box)
  • 2 open the report in a popup (from your IR page)
  • 3 redirect leaves the IR page to another page?
    ------
    Another approach:
  • 1. IR report submits the page
  • 2. in the PLSQL block, you do the treatment
  • 3. the branch redirects to a URL that would point to the report URL.
    OR
  • 3. do you have a JS onload which runs only when demand is demand for BUTTON and opens a page that points to the report.
    ------

    Still another way is to use htp.p in PLSQL block which made the treatment of workflow
    So your code PLSQL

    BEGIN
      --Do the workflow processing here
      --End workflow processing
      htp.p('');
    END;
    
  • How do I run the exe of labview with command line

    I would like to launch an exe of labview with a command line.

    I would like to get advice how to launch the exe of Labview with give values to the control settings?

    You can view the example where x, there are controls

    There is a more detailed guide here, I reference below:

    1. first of all, you can enable it in settings:

    1. open the properties for a version of the application specification

    2. navigate to the Advanced category

    3. check the pass all arguments on-demand command line

    To pass the arguments to command line to request and access in your code follow the same steps as for LabVIEW 7.x.

Maybe you are looking for

  • ITunes store does not connect and then does not close help please

    OK, so pretty much whenever I try to enter the Apple store that I get a little pop-up that says it can not connect to the Itunes store, I have to check my connection and try again, but whenever I close this box it appears immediately back to the poin

  • Song in iTunes Store search limits results to 100

    I had difficulties, looking for songs to the iTunes store. When I want to search by title of song (as opposed to the artist), the results are limited to 100. I saw a previous answer on this forum here - the answer was to click on the artist name and

  • Satellite Pro A210-SP6811 cannot install XP - it stop installing

    I have a Toshiba Satellite Pro A210-SP6811 with AMD M690V chipset and I am trying to install Windows XP SP3, but during the first part of the installation it stop by itself. I tried to install Windows 7 and everythings fine. Any ideas? Thank you

  • Re: Satellite A300-1 does not work with charger

    I need help with my a300-1id .sudenly started disconecting it self.I have already tested memory, hard drive and the charger every time that I turn it on with the charger after 5 min, that she falls down. If I only have the batery no problem at all. S

  • a table of images only the last image shows the index

    Hello world I try to index a table of images and all, but the last item gives me the error: "not an image." Here is a picture of the vi. The first loop load images and stores them in an indexed auto tunnel. Each diagnosis that I fell on this loop sho