简体   繁体   中英

Oracle 11g DB link usage

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM