DB

다른 계정 DB LINK 생성

Lawmin 2016. 2. 16. 11:32

-- 타계정 DB LINK 생성

CREATE PROCEDURE 타계정.cre_db_lnk AS

BEGIN

    EXECUTE IMMEDIATE 'CREATE DATABASE LINK 디비링크명 '

            ||'CONNECT TO 계정명 IDENTIFIED BY "암호" '

            ||'USING ''(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=아이피)(PORT=포트))(CONNECT_DATA=(SERVICE_NAME=서비스명)))''';

END cre_db_lnk;


exec 타계정.cre_db_lnk;


drop procedure 타계정.cre_db_lnk;



-- 타계정 DB LINK 삭제

CREATE PROCEDURE 타계정.cre_db_lnk AS

BEGIN

    EXECUTE IMMEDIATE 'DROP DATABASE LINK 타계정.디비링크명 ';

END cre_db_lnk;


exec 타계정.cre_db_lnk;


drop procedure 타계정.cre_db_lnk;