Unix Technical Forum

managing open database links?

This is a discussion on managing open database links? within the Oracle Database forums, part of the Database Server Software category; --> <flame retardant> i'm in the process of researching this but have not found anything yet, so any pointers would ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-25-2008, 03:49 AM
Mark C. Stock
 
Posts: n/a
Default managing open database links?

<flame retardant>
i'm in the process of researching this but have not found anything yet, so
any pointers would be helpful
this is immediately applicable to R9.2
</flame retardant>

is there any way to detect all outgoing open database links (not just those
established by the current session)?

is there any way to detect all incoming open database links?

is there any direct or indirect way to close \outgoing or incoming database
links other than the outgoing links established by the current session?

++ mcs



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-25-2008, 03:49 AM
stevedhoward@gmail.com
 
Posts: n/a
Default Re: managing open database links?

I don't know of any way to do this in Oracle inherently, other than
checking the MACHINE column in v$session. Not perfect, but one other
way I can think of is to find the SQL being executed. It usually has
something like A1.table_name in the statement.

Also, if you are on Unix/Linux, the following just worked for me...

ps -ef | grep $(lsof -i | grep your_remote_host | awk '{print $2}')

That will produce a list of all connections originating from the remote
database server. Ugly, but it may produce some better ideas.

Of course, none of these ideas can be verified as database link
connections, but just network and/or instance session connections.

Regards,

Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2008, 03:49 AM
stevedhoward@gmail.com
 
Posts: n/a
Default Re: managing open database links?

Here is another way...

localhostracle:localhost:/home/oracle>lsof -i | grep remotehost
oracle 22216 oracle 13u IPv4 809174380 TCP
localhost:56367->remotehost:2484 (ESTABLISHED)
localhostracle:localhost:/home/oracle>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 18 16:27:29 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning and Data Mining options

SQL> select sid,serial#,schemaname,osuser from v$session where paddr
in(select addr from v$process where spid=22216);

SID SERIAL# SCHEMANAME OSUSER
---------- ---------- ------------------------------
------------------------------
525 302 HOWARDS oracle

Elapsed: 00:00:00.04
SQL>

This takes all outgoing connections to the remote host in which you are
interested, gets each PID, and checks for that PID in v$process. Since
that session is connected to the instance on the local host, you know
that it is a database link connection to the remote host (it could be a
JDBC connection from within the local instance well, I guess).

Regards,

Steve

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-25-2008, 03:49 AM
NetComrade
 
Posts: n/a
Default Re: managing open database links?

On Tue, 18 Apr 2006 15:20:04 -0400, "Mark C. Stock" <mcstockX@Xenquery
..com> wrote:

><flame retardant>
>i'm in the process of researching this but have not found anything yet, so
>any pointers would be helpful
>this is immediately applicable to R9.2
></flame retardant>
>
>is there any way to detect all outgoing open database links (not just those
>established by the current session)?
>
>is there any way to detect all incoming open database links?
>
>is there any direct or indirect way to close \outgoing or incoming database
>links other than the outgoing links established by the current session?


We modified our application to do
select '<some_database_identifier>' from dual
on initial connection
to make our lives easier with identifying where really SQL is running
from

........
We run Oracle 9.2.0.6 on RH4 AMD
we are currently looking for a DBA
remove NSPAM to email
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-25-2008, 03:50 AM
Mark C. Stock
 
Posts: n/a
Default Re: managing open database links?


<stevedhoward@gmail.com> wrote in message
news:1145391862.571176.28620@i39g2000cwa.googlegro ups.com...
:I don't know of any way to do this in Oracle inherently, other than
: checking the MACHINE column in v$session. Not perfect, but one other
: way I can think of is to find the SQL being executed. It usually has
: something like A1.table_name in the statement.
:
: Also, if you are on Unix/Linux, the following just worked for me...
:
: ps -ef | grep $(lsof -i | grep your_remote_host | awk '{print $2}')
:
: That will produce a list of all connections originating from the remote
: database server. Ugly, but it may produce some better ideas.
:
: Of course, none of these ideas can be verified as database link
: connections, but just network and/or instance session connections.
:
: Regards,
:
: Steve
:

thanks; machine works -- but only if you know what machines you're looking
for. anybody with TNS access could install XE or another desktop-suitable
version of oracle and set up database links as well. and you can't just grab
all machines but the host because there could be client-server sessions out
there.

but i think the following will probably do it for all incoming db link
connections:

select *
from v$session
where upper(program) like 'ORACLE%'
and username is not null

the assumption is that all sessions for incoming db links will be from an
oracle executable of some sort -- 'ORACLE.EXE' or something like
'oracle@somehostname (TNS V1-V3)'. so will the background processes, but the
background processes do not have a username

++ mcs


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-25-2008, 03:54 AM
yong321@yahoo.com
 
Posts: n/a
Default Re: managing open database links?

Mark C. Stock wrote:
>
> but i think the following will probably do it for all incoming db link
> connections:
>
> select *
> from v$session
> where upper(program) like 'ORACLE%'
> and username is not null
>
> the assumption is that all sessions for incoming db links will be from an
> oracle executable of some sort -- 'ORACLE.EXE' or something like
> 'oracle@somehostname (TNS V1-V3)'. so will the background processes, but the
> background processes do not have a username
>
> ++ mcs


That's very smart! You could also say type = 'USER' in place of
username is not null, and possibly put @ in the like string
'ORACLE%@%'.

For outgoing sessions, how about checking for DX locks?

select sid from v$lock where type = 'DX'

You see this whenever there's a distributed transaction lock, including
a distributed query. It goes away when the session rollbacks or
commits.

Yong Huang

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-25-2008, 03:54 AM
Mark C. Stock
 
Posts: n/a
Default Re: managing open database links?


<yong321@yahoo.com> wrote in message
news:1145556797.556896.221660@v46g2000cwv.googlegr oups.com...
: Mark C. Stock wrote:
: >
: > but i think the following will probably do it for all incoming db link
: > connections:
: >
: > select *
: > from v$session
: > where upper(program) like 'ORACLE%'
: > and username is not null
: >
: > the assumption is that all sessions for incoming db links will be from
an
: > oracle executable of some sort -- 'ORACLE.EXE' or something like
: > 'oracle@somehostname (TNS V1-V3)'. so will the background processes, but
the
: > background processes do not have a username
: >
: > ++ mcs
:
: That's very smart! You could also say type = 'USER' in place of
: username is not null, and possibly put @ in the like string
: 'ORACLE%@%'.
:
: For outgoing sessions, how about checking for DX locks?
:
: select sid from v$lock where type = 'DX'
:
: You see this whenever there's a distributed transaction lock, including
: a distributed query. It goes away when the session rollbacks or
: commits.
:
: Yong Huang
:

i thought about the '@' but that does not show up for db link originating
from windows (specific chase is Oracle XE)

i'll take another look at v$lock -- i didn't think i saw anything there
before for a simple @dblink query

thanks.

++ mcs


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:43 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com