Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: systemstate dump; keep user connected in background
i used to do the following:
connect into the database and enter a loop in which the session sleeps on a dbms_pipe.receive_message call. if a message is received, i would unpack it and verify what the contents were. if they were 'terminate', the session would gracefully exit - otherwise another loop would be entered ... and so on ...
that concept was the basis for a couple of pl/sql daemons, as we called them. there may be better ways to do it now, but it is an idea for you nonetheless.
cheers,
casey
Barbara Baker wrote:
>I'm really liking this idea! (keeping a connection at all times)
>Since this can happen at any time, I'd like to script this. What I'm
>trying to do is connect a user in a ksh script and keep the user
>connected all day. That way I can query the database to get that
>user's pid.
>
>However, the user keeps exiting from the database.
>
>Anyone know how to keep the user connected?
>
>I'm running a script called persist.sh Must use sudo. SA's say so
> sudo su - oracle persist.sh
>
>persist.sh connects to oracle in background
> sqlplus scott/tiger @${SQL_DIR}/connect_persist.sql &
>
>but after running connect_persist.sql (which does select sysdate from
>dual) the sqlplus job exists.
>
>Again, this is Solaris 9
>
>Thanks for the tip, Egor!
>
>On 7/19/05, Egor Starostin <egorst_at_gmail.com> wrote:
>
>
>
>>If this (db hangs) happens regularly then it's better to have one idle
>>dedicated connection from sqlplus to be able to run smth like
>>"oradebug dump systemstate 10" when database is freezing. Or you can
>>attach to this process, call ksudss() and run in sqlplus 'select 1
>>from dual' (just to awake process from sleep). No matter that select
>>will not return anything -- call to ksudss() should be succesfull in
>>such case.
>>
>>
>>--
>>Egor
>>http://www.oracledba.ru/orasrp/
>>Free Oracle Session Resource Profiler
>>
>>
>>
>--
>http://www.freelists.org/webpage/oracle-l
>
>
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Jul 21 2005 - 07:23:40 CDT
![]() |
![]() |