 |
|
 |
|
Next: restore
|
| Author |
Message |
External

Since: Jan 09, 2008 Posts: 131
|
(Msg. 1) Posted: Tue Dec 23, 2008 3:26 am
Post subject: get the sid,serial# of my connection? Archived from groups: comp>databases>oracle>misc (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Dec 10, 2003 Posts: 57
|
(Msg. 2) Posted: Tue Dec 23, 2008 4:25 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
a écrit dans le message de U914l.8677$W06.8173@flpi148.ffdc.sbc.com...
| How can I programmatically get the SID and SERIAL# for my connection
| from a client side program?
|
| Many tia!
| Mark
|
| --
| Mark Harrison
| Pixar Animation Studios
SID can be gotten with SYS_CONTEXT('USERENV','SID')
As far as I know there is no way to get SERIAL# unless you have priviledge on V$SESSION.
Regards
Michel >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 58
|
(Msg. 3) Posted: Tue Dec 23, 2008 4:25 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
mh RemoveThis @pixar.com wrote:
> How can I programmatically get the SID and SERIAL# for my connection
> from a client side program?
With the following SQL query:
SELECT dbms_debug_jdwp.current_session_id sid,
dbms_debug_jdwp.current_session_serial serial#
FROM dual;
Yours,
Laurenz Albe >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2007 Posts: 294
|
(Msg. 4) Posted: Tue Dec 23, 2008 7:55 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 23, 3:35 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> a écrit dans le message de U914l.8677$W06.8...@flpi148.ffdc.sbc.com...
> | How can I programmatically get the SID and SERIAL# for my connection
> | from a client side program?
> |
> | Many tia!
> | Mark
> |
> | --
> | Mark Harrison
> | Pixar Animation Studios
>
> SID can be gotten with SYS_CONTEXT('USERENV','SID')
> As far as I know there is no way to get SERIAL# unless you have priviledge on V$SESSION.
>
> Regards
> Michel
I would just use:
UT1 > l
1 select username, sid, serial#
2 from v$session
3* where sid = (select sid from v$mystat where rownum = 1)
UT1 > /
USERNAME SID SERIAL#
------------------------------ ---------- ----------
MPOWEL01 57 32395
This should work back down to at least version 8.1.7.
HTH -- Mark D Powell -- >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2007 Posts: 294
|
(Msg. 5) Posted: Tue Dec 23, 2008 7:57 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 23, 3:43 am, Laurenz Albe wrote:
> m....RemoveThis@pixar.com wrote:
> > How can I programmatically get the SID and SERIAL# for my connection
> > from a client side program?
>
> With the following SQL query:
>
> SELECT dbms_debug_jdwp.current_session_id sid,
> dbms_debug_jdwp.current_session_serial serial#
> FROM dual;
>
> Yours,
> Laurenz Albe
Hey, I learned something new. thanks Laurenz.
-- Mark D Powell -- >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 10, 2003 Posts: 57
|
(Msg. 6) Posted: Tue Dec 23, 2008 11:29 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Mark D Powell" a écrit dans le message de
28e57ec0-83da-447f-b2ef-4dd181e65522 DeleteThis @v39g2000pro.googlegroups.com...
On Dec 23, 3:35 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> a écrit dans le message de U914l.8677$W06.8...@flpi148.ffdc.sbc.com...
> | How can I programmatically get the SID and SERIAL# for my connection
> | from a client side program?
> |
> | Many tia!
> | Mark
> |
> | --
> | Mark Harrison
> | Pixar Animation Studios
>
> SID can be gotten with SYS_CONTEXT('USERENV','SID')
> As far as I know there is no way to get SERIAL# unless you have priviledge on V$SESSION.
>
> Regards
> Michel
I would just use:
UT1 > l
1 select username, sid, serial#
2 from v$session
3* where sid = (select sid from v$mystat where rownum = 1)
UT1 > /
USERNAME SID SERIAL#
------------------------------ ---------- ----------
MPOWEL01 57 32395
This should work back down to at least version 8.1.7.
HTH -- Mark D Powell --
---------------------
Not everyone has access to v$session.
In this is the case, the following is most efficient.
select sid, serial#
from v$session
where sid=SYS_CONTEXT('USERENV','SID')
Regards
Michel >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 10, 2003 Posts: 57
|
(Msg. 7) Posted: Tue Dec 23, 2008 12:25 pm
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
"Mark D Powell" a écrit dans le message de
ba17939d-abab-42eb-9464-a0f7248cfa91 RemoveThis @z27g2000prd.googlegroups.com...
On Dec 23, 3:43 am, Laurenz Albe wrote:
> m... RemoveThis @pixar.com wrote:
> > How can I programmatically get the SID and SERIAL# for my connection
> > from a client side program?
>
> With the following SQL query:
>
> SELECT dbms_debug_jdwp.current_session_id sid,
> dbms_debug_jdwp.current_session_serial serial#
> FROM dual;
>
> Yours,
> Laurenz Albe
Hey, I learned something new. thanks Laurenz.
-- Mark D Powell --
-----------------------------------
So do I
Regards
Michel >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Jan 09, 2008 Posts: 131
|
(Msg. 8) Posted: Wed Dec 24, 2008 4:25 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Michel Cadot <micadot{at}altern{dot}org> wrote:
> "Mark D Powell" a ?crit dans le message de
>> Hey, I learned something new. thanks Laurenz.
> So do I
Thanks all... here's my results which are working great.
1. a shell script to kill a connection:
#!/bin/sh
# kill a specified oracle session
sid=$1; ser=$2; inst=$3
echo -n sys password:
stty -echo; read pass; stty echo
echo "alter system kill session '$sid,$ser';"|
sqlplus -SL sys/$pass@$inst as sysdba
2. a local function (this in python) to generate a call to this script.
I call this at the beginning of my test program and print the
string so I can cut and paste.
def killstring(curs):
"""return a string that will kill this db connection"""
curs.execute("""SELECT dbms_debug_jdwp.current_session_id,
dbms_debug_jdwp.current_session_serial,
sys_context('USERENV', 'INSTANCE_NAME')
FROM dual""")
(sid,serial,instance)=curs.fetchone()
s="oracle-killsession %s %s %s"%(sid,serial,instance)
return s
3. and a sample invocation
ohm ~/tst$ oracle-killsession 98 45809 tmpltest2
sys password:
System altered.
4. and from my client... hooray!!!
cx_Oracle.DatabaseError: ORA-00028: your session has been killed
Share and enjoy!
Mark
--
Mark Harrison
Pixar Animation Studios >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2007 Posts: 294
|
(Msg. 9) Posted: Wed Dec 24, 2008 8:40 am
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 24, 3:42 am, m....DeleteThis@pixar.com wrote:
> Michel Cadot <micadot{at}altern{dot}org> wrote:
> > "Mark D Powell" a ?crit dans le message de
> >> Hey, I learned something new. thanks Laurenz.
> > So do I
>
> Thanks all... here's my results which are working great.
>
> 1. a shell script to kill a connection:
>
> #!/bin/sh
> # kill a specified oracle session
>
> sid=$1; ser=$2; inst=$3
> echo -n sys password:
> stty -echo; read pass; stty echo
> echo "alter system kill session '$sid,$ser';"|
> sqlplus -SL sys/$pass@$inst as sysdba
>
> 2. a local function (this in python) to generate a call to this script.
> I call this at the beginning of my test program and print the
> string so I can cut and paste.
>
> def killstring(curs):
> """return a string that will kill this db connection"""
> curs.execute("""SELECT dbms_debug_jdwp.current_session_id,
> dbms_debug_jdwp.current_session_serial,
> sys_context('USERENV', 'INSTANCE_NAME')
> FROM dual""")
> (sid,serial,instance)=curs.fetchone()
> s="oracle-killsession %s %s %s"%(sid,serial,instance)
> return s
>
> 3. and a sample invocation
>
> ohm ~/tst$ oracle-killsession 98 45809 tmpltest2
> sys password:
> System altered.
>
> 4. and from my client... hooray!!!
>
> cx_Oracle.DatabaseError: ORA-00028: your session has been killed
>
> Share and enjoy!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios
Why not have the routine issue the kill via execute immediate rather
than have to cut and paste?
HTH -- Mark D Powell -- >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2007 Posts: 422
|
(Msg. 10) Posted: Mon Dec 29, 2008 4:26 pm
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 29, 2:02 pm, m....RemoveThis@pixar.com wrote:
> Mark D Powell wrote:
>
> > Why not have the routine issue the kill via execute immediate rather
> > than have to cut and paste?
>
> Ah, I should have explained in more detail what I'm trying to do...
> I have an application server I've written, that basically is an
> infinite loop:
>
> initialize connections
> loop forever:
> receive XML-RPC request
> send request to db
> send XML-RPC response
>
> I have some connection failure detection and recovery code
> in the loop, and I want to exercise that code, so I want to
> cause the connection to randomly fail outside of the control
> of the app server. That's also why I'm looking for other ways
> to break the connection, in order to test all the applicable
> failure modes.
>
> thanks!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios
There is always the failure of 'alter session kill' to deal with. On
unix I habitually kill the process instead. Other people have other
ideas about that (something about it being bad, aside from the danger
of killing the wrong process, but I can't remember why offhand), but
of course I'm only going to advocate what I do. In the past, I've
seen alter session kill just leave things out there forever, since it
needed to be cleaned up by smon, whereas pmon would be right on top of
things. Whether this applies to 10g, I couldn't say, I'm too busy
trying to figure out yet another config fragility that broke emctl on
one instance but not another.
I suspect there may be an issue with TCP cleanup acknowledgement with
the alter session kill, but I really don't know. I know that happens
with some non-Oracle things where the parent that spawned the Oracle
session has gone away. Or something like that.
jg
--
@home.com is bogus.
And they supposedly finally fix the stupid 'ps: cmd is not a valid
field name' in... 10.2.0.6GC >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
External

Since: Jan 09, 2008 Posts: 131
|
(Msg. 11) Posted: Mon Dec 29, 2008 5:26 pm
Post subject: Re: get the sid,serial# of my connection? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Mark D Powell wrote:
> Why not have the routine issue the kill via execute immediate rather
> than have to cut and paste?
Ah, I should have explained in more detail what I'm trying to do...
I have an application server I've written, that basically is an
infinite loop:
initialize connections
loop forever:
receive XML-RPC request
send request to db
send XML-RPC response
I have some connection failure detection and recovery code
in the loop, and I want to exercise that code, so I want to
cause the connection to randomly fail outside of the control
of the app server. That's also why I'm looking for other ways
to break the connection, in order to test all the applicable
failure modes.
thanks!
Mark
--
Mark Harrison
Pixar Animation Studios >> Stay informed about: get the sid,serial# of my connection? |
|
| Back to top |
|
 |  |
| Related Topics: | oracle plsql and http post connection - Hi, Is there anyway to make an http connection to url from an stored procedure?. I need a oracle job, who have send xml information to a http web services. any idea? Thanks
Replacing a subselect with Collections - Hi all oracle users, I have a cursor which fetches a few thousand records. Inside it I have a subselect which is used for decoding one field. CURSOR snap_crs IS SELECT decode (snap.id, 1, (select code_ptr from anag_ptr where desc_ptr =..
how to refresh a sequence - How could I refresh a sequence in Oracle using an SQL statement? I've got the problem, that the current number of a sequence is less the highest index in a table, where I want to use the sequence. Regards, Robert
Using NonUnique Index to Enforce Uniqueness - Oracle manual describes using non unique index to enforce unique constraint so that the index will not be dropped with constraint is diabled. But I dont understand why non unique index can enforce uniqueness?
Triggers and Window Service - Hi, Is there a way to create an oracle Trigger that will start a window service? I am trying to get the service away from running a timer. Running Oracle 9i and windows 2K or XP Thanks |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|