Can I do "alter system" commands thru JDBC

I have a small java program that occasionally needs to kill sessions. Can I do this through JDBC? My code is not erroring out but it is also not killing the session. I'm pretty sure I'm using the correct sid and serial# but I'll check again. And, yes, the user logged on has the appropriate privileges.
TIA
- Will

The answer is yes you can do it (and you should hesitate on posting things until you are really sure something isn't working).
Sorry for wasting your time.
- Will

Similar Messages

  • Log 'alter system ' commands

    Hi
    I am looking for a way to track alter system / alter database commands.
    Database triggers are not logging them : I do have a database trigger for DDLs tracking that works great but alter system commands are not captured by it . also trigger 'alter alter on database ' - do not log alter system or alter database
    Is there a way for me to force a command to appear in the alert log ?
    Or any other way you can think of ?
    thanks
    Orna

    Orna,
    YOu can create a database level trigger to capture ALTER statement and insert them into a user defined table. This is just one example you can define trigger at schema level as well.
    CREATE OR REPLACE TRIGGER usiuser.myaltertrg
       BEFORE ALTER
       ON DATABASE
    DECLARE
       tmpvar   NUMBER;
    BEGIN
       tmpvar   := 0;
    -- your code to insert alter statement in user defined table.
    EXCEPTION
       WHEN OTHERS
       THEN
          -- Consider logging the error and then re-raise
          RAISE;
    END myaltertrg;Regards
    Edited by: OrionNet on Dec 29, 2008 1:30 PM

  • Can I execute "Alter System Disconnect Session" in a OLE VB Script?

    Will this work? If not - How to do it?
    The speadsheet contains a list of sid's and serial#. I want to highlight a cell containing a username, then run the kill session macro on it.
    Sub Kill_Session()
    Dim KillStatement As Object
    DBPassword = "uuuu/pppppppp"
    DatabaseName = "dddd"
    Set objSession = CreateObject("OracleInProcServer.XOraSession")
    Set objdatabase = objSession.opendatabase(DatabaseName, DBPassword, 0&)
    objdatabase.Parameters.Add "SERIAL", 0, 2
    objdatabase.Parameters("SERIAL").ServerType = 1
    objdatabase.Parameters.Add "SID", 0, 2
    objdatabase.Parameters("SID").ServerType = 1
    Inputdata = ActiveCell.Value
    RowNo = ActiveCell.Row
    objdatabase.Parameters("SERIAL").Value = Worksheets("Sheet1").Cells(RowNo, 13)
    objdatabase.Parameters("SID").Value = Worksheets("Sheet1").Cells(RowNo, 12)
    Set OraSqlStmt = objdatabase.CreateSQL("ALTER SYSTEM DISCONNECT SESSION ':SID, :SERIAL' IMMEDIATE;", 0&)
    MsgBox objdatabase.Parameters("SID").Value
    MsgBox objdatabase.Parameters("SERIAL").Value
    objdatabase.Parameters.Remove ("SERIAL")
    objdatabase.Parameters.Remove ("SID")
    End Sub

    on 10gR1/10gR2, you can not use
    ALTER SYSTEM KILL SESSION ‘115,9779,@1';that start from 11gR1
    Only
    * For integer1, specify the value of the SID column.
    * For integer2, specify the value of the SERIAL# column.
    ALTER SYSTEM KILL SESSION ‘115,9779';http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_2013.htm#SQLRF00902
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_2013.htm#SQLRF00902
    You may use crontab to help ....
    Example about blocking (SID):
    select 'ALTER SYSTEM KILL SESSION ''' ||sid||','||serial#|| ''' IMMEDIATE;' from gv$session s where sid in (
    select distinct(l1.sid) from
    gv$lock l1, gv$lock l2
    where l1.block = 1 and l2.request > 0
    and l1.id1=l2.id1
    and l1.id2=l2.id2
    ) AND INST_ID = (select INSTANCE_NUMBER from v$instance )and ....
    Good Luck

  • Operating System Command in JDBC Sender

    Hello everybody,
    I'm trying to find some syntax to execute an operating system command on Windows Server 2003, but the commands don't seem to work I'm actually trying to generate a directory, now the problem is that I can't find syntax examples on how to do this I tried something like MKDIR TEST, now is the syntax of the command lines as you write them in Command Prompt, or maybe there is my error, thanks in advance.
    Regards,

    Confirmed.
    JDBC sender also support OS command.
    Refer to note 841704 if you face any issue while executing OS command in JDBC adapter.
    Note: OS Command execute when processing in database executed successfully. It is even independent on OS command Errors.
    Thanks
    Farooq
    Edited by: Farooq Farooqui on Jan 16, 2009 11:36 AM

  • Executing system command thru command line by passing it to a server

    Hello,
    I would like to know if there is any way by which I can call a system command through a java program . This system command takes parameters. If yes then how do i pass these paramaeters. This program will be called thru a sheel scripts and the parameters may vary...

    If I just look at the question in your post, I would say the answer is to call Runtime.getRuntime().exec("the system command"). But the title of the post mentioned passing it to a server; I won't attempt to answer that without knowing what it's all about.

  • Need help on submitting ALTER SYSTEM command.

    I have a report of a list of active xml threads from our EM repository, which is pulled from 4 RAC instances. I have a region with this statement:
    select a.inst_id, a.sid,a.serial#,b.instance_name, b.host_name, a.machine, a.status
    from gv$session@emrepo a, gv$instance@emrepo b
    where a.action like 'XML%'
    and a.inst_id = b.instance_number
    order by a.inst_id
    The result shows me what I want. Now I want to be able to select the XML threads that I want to kill with the alter system kill command such as:
    alter system kill session 'sid, serial#'; (where sid and serial# is pulled from above).
    Question is how can I do this, plus need to figure out to make sure I am running this against the right RAC instance. Any help is appreciated. Thanks.
    Victor

    You can link to a confirmation page and set 2 items on that page SID and SERIAL# through the URL. Then create a process on the 2nd page that fires "On Submit" with the following code:execute immediate 'alter system disconnect session '||''''||:P2_SID||','||:P2_SERIAL||''' immediate';Create a button on the 2nd page to submit the page (fire your process when request = the button request).
    As far as how this works with RAC, you're on your own on that one ;)
    Thanks,
    Tyler

  • Alter System command

    Hi all,
    I am just bit confused in the following two commands
    SQL> ALTER SYSTEM SWITCH LOGFILE;
    SQL> ALTER SYSTEM CHECKPOINT;
    So what is the main difference between the first and second cmds?
    Why seniors/books suggest to use first command instead of the second one ?

    372211, if you run manual hot backups then at the conclusion of copying the files for the last tablespace in your hot backup and issueing the "end backup" command you generally issue the ALTER SYSTEM SWITCH LOGFILE command to force all redo necessary to bring the backups to a consistent point in time during forward recovery.
    The archived redo logs and backup copies just made can be duplicated for sending off-site and provide a consistet image in the event of a diaster that results in the loss of archieved redo logs made after the backup.
    Also, to add to what was said about checkpoints - The header blocks for the database files must also be updated with the checkpoint information.
    HTH -- Mark D Powell --

  • Where can I find DBMS system commands

    Hi:
    Where can I find the references about DBMS system commands like dbms_stats.get_table_stats? Thank you very much.
    Maggie

    Hi:
    Where can I find the references about DBMS system commands like dbms_stats.get_table_stats? Thank you very much.
    Maggie See the Oracle 9i Performance Guide and Reference, chapter 3 Optimizer, subsection GENERATING STATISTICS.
    Also, I think the argument is "gather_table_stats" as opposed to "get_table_stats".
    RP.

  • COMMENTS in ALTER SYSTEM command

    I ran the query
    SQL>ALTER SYSTEM SET sga_target=216M COMMENT='Test';
    which view/table will describe the changes of sga_target and corresponding comment.
    I searched in v$system_parameter and v$parameter, but the value did not get updated.

    I did query on V$PARAMETER, V$SYSTEM_PARAMETER, V$SYSTEM_PARAMETER2 and found that the value of sga_target (148M) is updated in all the views, whereas the comment attribute is updated only in V$PARAMETER view. Also I disconnected from SQL Plus and logged in again (new session), the comment attribute has been reset to old value. As long as the value is updated in all the views, the comment attribute should also be updated in all the views.

  • Alter system reset aq_tm_processes

    Hi!
    Trying to reset aq_tm_processes. First some background:
    The aq_tm_processes parameter was first set in the pfile. We had to startup the DB using this file (tried removing it from the pfile also, not sure that worked as show parameter showed aq_tm_processes = 0).
    But as we are using streams, aq_tm_processes, should not be set.
    Well, I have done this:
    1. Took down the DB.
    2. Set the aq_tm_processes in the pfile to 2. (So I can issue the alter system command)
    3. Startup nomount from pfile.
    4. Created a new spfile form pfile.
    5. Startup DB.
    6. alter system reset aq_tm_processes scope=spfile sid='*';
    7. Restarted the DB.
    Is the aq_tm_processes now reset?
    Show parameter shows the value 0.
    alter system reset aq_tm_processes scope=spfile sid='*'
    ERROR at line 1:
    ORA-32010: cannot find entry to delete in SPFILE
    It seems that the value is reset (as the parameter can not be found in the spfile). But Im still worried. Should the value show 0 if the parameter is reset?
    Regards
    Peter

    Peter, your question is not clear. Do you want the parameter to be set to 0? Run "show parameter aq", look at the value, if it is what you want, no problem. If it is not, set it to whatever value you want. Setting aq_tm_processes to 0 or not having it in your parameter file have the same effect.

  • Please help how to run System commands and batch files thru java program

    Sir,
    I want execute OS commands like dir,cls..etc and batch files,.exe filesthru java program.
    I have tried it sofar thru Runtime.getRuntime().exec("execute.bat");
    but it is not working.anybody knows about how to run the system commands thru java please give me the code.
    thank you,
    regards,
    j.mouli

    I've seen other posts with this questions, and answers. Unfortunately I didn't pay much attention. But the basic idea is to exec command.com and pass the specifc batch or command as an argument.

  • Can we change the system date using Sql

    can we change the system date using Sql statement..
    can anyone help
    Tariq.

    There is an initialization parameter called FIXED_DATE which lets you set a fixed sysdate for testing purposes, and you can alter that date using the ALTER SYSTEM command, but as implied by the name you are setting a data/time that doesn't change. Since the normal sysdate is derived from the O/S it cannot be altered through SQL

  • System command in jsp..

    Hi all,
    how can i run this system command "echo %username%" in jsp??
    i try to do that but its givinf error like this "java.io.IOException: CreateProcess: echo %username% error=2"
    please help me how run this command or is there any other way i can get domain username into my jsp page..
    thankx in advance...

    Read the java.lang.System API: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getProperties()
    String userName = System.getProperty("user.name");Be aware that Java is serverside and this will return the server's user name. If you want to get this from the client, consider a signed applet which runs at the client side.

  • How to execute System command through Applet

    Hi all,
    How can I execute a System command through Applet.
    I have written a code Runtime.exec("ls") in my applet but it gives me
    this execption even if I certify the applet ->
    java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
         at java.security.AccessController.checkPermission(AccessController.java:399)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
         at java.lang.SecurityManager.checkExec(SecurityManager.java:802)
         at java.lang.Runtime.exec(Runtime.java:548)
         at java.lang.Runtime.exec(Runtime.java:418)
         at java.lang.Runtime.exec(Runtime.java:361)
         at java.lang.Runtime.exec(Runtime.java:325)
         at Test.init(Test.java:24)
         at sun.applet.AppletPanel.run(AppletPanel.java:344)
         at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:123)
         at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:119)
         at java.lang.Thread.run(Thread.java:484)
    Thanks,
    Manoj.

    There should be a lesson about this somewhere.
    When you visit a web page, does it ask you if you want to have an applet loaded?
    Answer: No
    So, if you visit a page, and an applet is silently loaded which can then execute commands on your computer, is this good?
    Answer: No
    So why do you want to do this?
    Is it good for anyone?
    I mean, if I want to do "ls", can't I just open a command line? Do I need an applet to do it for me?
    Either you have devious desires or your hacking together something that probably shouldn't be.
    If you want to learn start here:
    http://java.sun.com/docs/books/tutorial/security1.2/index.html
    With the article entitled:
    Quick Tour of Controlling Applets
    Ian

  • Alter system trigger - substitution

    Hello.
    By the documentation, there is restriction for trigger on alter command: "The trigger will not be fired by an ALTER DATABASE statement".
    I'm trying to use BEFORE SHUTDOWN and AFTER STARTUP triggers to database and I'd need also cover situations:
    - alter system quiesce restricted
    - alter system suspend
    - alter system enable restricted session
    - alter system unquiesce
    - alter system disable restricted session
    - alter system resume
    I'm using ALTER SYSTEM command (not ALTER DATABASE), but trigger isn't fired too. Is there any way how to catch and do some PL/SQL pre/post processing events described above?
    Thanks.

    Oracle Version ?
    if ur on 10.x.x.x.x
    Check
    sql> select space_limit/1024/1024 "Limit MB",round(space_used/1024/1024) "Used MB"
    2* from v$recovery_file_dest
    SQL> /
    Limit MB Used MB
    2048 1681
    If limit and used field equal then increase db_recovery_file_dest_size parameter size
    SQL> show parameter db_recovery_file_dest_size
    NAME TYPE VALUE
    db_recovery_file_dest_size big integer 2G
    SQL> alter system set db_recovery_file_dest_size = 3g;
    System altered.
    Also check below link.
    >>>Re: Switch logfile hangs
    [b]>>>SQL> alter system switch logfile;

Maybe you are looking for

  • How do I create a dial link from a hotspot on an image in Dreamweaver CS5?

    I understand how to create a link from text, or from an image, but I need to create a link within the image map so that clients on their cell phones can call by clicking on my chosen hotspot. Any suggestions?

  • Re: Business sytem availability in Integration builder

    Dear Techies, Iam trying out one preliminary test scenario to map between two flat files. I had defined only business system sender at starting phase and after building the mapping scenario I again gone back to the SLD and created the business system

  • Creating a button in multisim

    I am trying to find/create a button in multisim or Ultiboard.  I do not want to use a mechanical button, I am looking for a way to create a "button trace" so that it's open when the button is not pressed, and once the button is pressed it complets th

  • Java Programming: Selective Inheritance possible ?

    Hello Java pros, I am looking for help on ideas to selectively inherit public methods of a super-class. eg.I create a new class z_stack to implement the classic features of the Stack Data Structure, by 'extending' the vector class. z_stack has method

  • Forgot to add

    Sorry forgot to add that im coding in ASP classic Thanks Andy