Reputation: 85
We are migrating from oracle 11g to 12c. We have a number of DB links created in 11g db but we're not sure whether they are really in use or not. Since its a production environment we cannot disable the DB links and wait for some jobs to fail. Is there any way to find out whether particular DB links are in use or not?
One of the crude way I was thinking is, writing a script to loop every 5 minutes gv$sql
and search for DB link names in a query and log it. The script will run for a few days.
Is there any other way to find out?
Upvotes: 1
Views: 499
Reputation: 372
This will search all_source
for every link that is found in all_db_links
.
begin
for c_links in (select '@'||db_link as db_link from ALL_DB_LINKS)
loop
dbms_output.put_line('search for link: '||c_links.db_link);
for c_source in (select * from all_source s
where upper(s.text) like '%'||c_links.db_link||'%')
loop
dbms_output.put_line('link '||c_links.db_link || 'is used in: ' || c_source.name);
end loop;
end loop;
end;
This could help you identify which links are referenced in procedures, functions and packages.
Upvotes: 1