Skip to content
November 16, 2011 / doganay

HOW TO DROP PRIVATE DATABASE LINK

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Hi,

 

The only way to drop another user’s private link is that to create a procedure in that user’s schema. So that procedure

drops that private db-link:

 

undefine p_schema_name 
undefine p_link_name 
set verify off
set feedback off
accept p_schema_name prompt 'Schema Name : '
accept p_link_name prompt 'Link Name : '
set serveroutput on

create or replace procedure &&p_schema_name..sph_drop_link(link_name varchar2)
as
begin
execute immediate 'drop database link '||link_name;
dbms_output.put_line('Private link dropped.');
exception when others then 
    dbms_output.put_line('Can not drop link!');
    dbms_output.put_line(sqlerrm);
end;
/

exec &&p_schema_name..sph_drop_link('&p_link_name')

drop procedure &&p_schema_name..sph_drop_link
/

set serveroutput off
set feedback on
set verify on

 

try and pray 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: