DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Friday, October 17, 2014

Creating private database links without user credentials


The following process can be followed to create private database link for an user whose login credentials are unknown,

Here in this example the user "6543" password is unknown,

In order to create a private database link for "6543" we have to first create a procedure for him as SYS user and grant create database link privilege to the "6543" user and execute the procedure. This would create a database link. After that revoke the grant given to "6543" user.

CREATE PROCEDURE "6543".cre_db_lnk AS
BEGIN
    EXECUTE IMMEDIATE 'CREATE DATABASE LINK DATABASELINKNAME '
            ||'CONNECT TO username IDENTIFIED BY password '
            ||'USING ''HOST''';
END cre_db_lnk;
/

GRANT create database link TO "6543";

execute "6543".cre_db_lnk;

revoke create database link from "6543";

DROP PROCEDURE "6543".cre_db_lnk;

select * from dba_db_links where db_link='DATABASELINKNAME' and owner ='6543';

No comments: