> Stored procedure in database A uses DB links to database B. In which DB are > the SQLs in the SP parsed? The following test uses database A (10g and then 9.2), and database B (9.0). Table YONGTAB is created in both A and B databases: create table yongtab (a number); The link and stored procedure are created in A only: create database link yonglnk connect to usr identified by paswd using 'databaseb'; create or replace procedure yongproc as begin insert into yongtab values (1); insert into yongtab@yonglnk values (2); end; / where yonglnk is the link from A to B. Before executing yongproc in A, running this query select sql_text from v$sql where lower(sql_text) like '%yong%' and lower(sql_text) not like '%v$sql%' in A shows: create table yongtab (a number) when A is 10g. It shows no rows if A is 9i. Running the query in B shows no rows. After executing this procedure in A exec yongproc running the above query against v$sql in A shows: BEGIN yongproc; END; INSERT INTO YONGTAB VALUES (1) create table yongtab (a number) INSERT INTO YONGTAB@YONGLNK VALUES (2) when A is 10g. When A is 9i, it's missing the "create table" line and the INSERT lines are shown all lower-case except the first word INSERT. Running the query in B shows: INSERT INTO "YONGTAB" ("A") VALUES (2) SELECT * FROM "YONGTAB" Conclusions: 1. The SQLs in the procedure are parsed in both A and B if the SQLs use DB links. In the remote database, the SQL statement is rewritten leaving the @dblink part off. 2. 10g v$sql contains DDL but 9i v$sql does not record some DDLs (create table, drop table). Make sure to flush shared pool between tests. If the SQL remains in v$sql after flushing, it may be because your cursor is held in null mode by the session (not that they're kept; v$db_object_cache.kept says 'NO'). Just do something trivial like describe sometable, to break the breakable parse lock (see the bottom part of KeptObjCan'tBeFlushed.txt) ______________ Another test, not quite relevant to the issue here. In B, create table mytab (a number); create or replace procedure myproc as begin insert into mytab values (10); end; / In A (9.2, not 10g), exec myproc@mylnk where mylnk is the link pointing to B Then, v$sql in B shows "INSERT into mytab values (10)" In A, it has "BEGIN myproc@mylnk; END;"