Finding which user has opened a table
Posted in 2009
Topics: General Discussion
I have a question about finding which sessions are using a particular
table in case where the table is accessed by synonyms of another
instance.
The case is the following:
I have two instances, and I have created a synonym in instance b for
table a
For example:
In database_a@instance_a:
create table table_a (...
);
In database_b@instance_b:
create synonym syn1 on database_a@instance_a:table_a;
In database "a" I need to know which sessions are using the table_a.
With this information, I find the process id (pid)
It's simple to know which sessions are using the table_a if this
sessions are in the same instance.
But sometimes, I get only sessions which pids belong to oninit
processes
Is it possible to know which users are using the table in such
circumstances ?
Thanks in advance
Hello Roger, Off the top of my head try on instance_a (in the sysmaster database) SELECT "table_a", session_id, session_name FROM syssessions, sysexplain WHERE (do the join here) AND sql_statment LIKE "%table_a %". Do the same for "syn1". Then do both SQL's for instance_b. Forgive me for my mispelling of the table names and column names because I am writing this pseudo code at home. Plus you will have to run this over and over again all day long because it will only show you a current snapshot of what is going on. -L.S.