기본 콘텐츠로 건너뛰기

Generate DDL for synonyms


https://www.toadworld.com/platforms/oracle/w/wiki/4952.script-to-generate-ddl-for-synonyms


REM ******************************************************************
REM
REM FUNCTION: Generate DDL for synonyms. REM REM ****************************************************************** UNDEF ENTER_OWNER_NAME UNDEF ENTER_SYNONYM_NAME SET long 1000 SET serveroutput on SET verify off lines 132 DECLARE v_output CLOB := NULL; v_owner VARCHAR2 (30) := '&&ENTER_OWNER_NAME'; v_synonym_name VARCHAR2 (30) := '&&ENTER_SYNONYM_NAME'; BEGIN DBMS_OUTPUT.put_line ('DDL For Database Synonyms'); FOR tt IN (SELECT owner, synonym_name FROM dba_synonyms WHERE owner LIKE v_owner AND synonym_name LIKE v_synonym_name) LOOP SELECT DBMS_METADATA.get_ddl ('SYNONYM', tt.synonym_name, tt.owner) INTO v_output FROM DUAL; DBMS_OUTPUT.put_line (v_output); END LOOP; END; /

댓글

이 블로그의 인기 게시물

sql id 별 AWR SQL Stat History 확인

-- AWR SQL Stat History 확인 with w_sqlstat as (     select /*+ inline use_nl(a,b,c) leading(a) index(a (sql_id))*/            a.*,            to_char(b.begin_interval_time,'mm/dd hh24:mi') snap_time     from   dba_hist_sqlstat a          , dba_hist_snapshot b     where  b.dbid             = a.dbid     and    b.instance_number  = a.instance_number     and    b.snap_id          = a.snap_id     and    a.sql_id = '7s4bffkwdq1r4' --    and    a.module like 'BTmapsc090%' --    and    b.instance_number  = 1 --    and    b.dbid = 3107085369 --    and    a.snap_id >= 15817     --and    b.snap_id = 55925     --and   ...