-Grant the user required privilege to the user
GRANT create database link,create procedure TO <private_user>;
-create the procedure in the user(private_user) account
CREATE PROCEDURE private_user.cre_db_lnk AS
BEGIN
EXECUTE IMMEDIATE 'CREATE DATABASE LINK PRIVATE_LINK '
||'CONNECT TO private_user IDENTIFIED BY private_user '
||'USING ''(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test.honeymoney.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hello.honeymoney.com)))''';
END cre_db_lnk;
/
---Execute the procedure
exec private_user.cre_db_lnk
--Revoke the privilege from the user and drop the procedure
REVOKE create database link FROM private_user;
DROP PROCEDURE private_user.cre_db_lnk;
No comments:
Post a Comment