-- The script for check Object creation DDL before Migration
SET trimspool ON
SET heading off;
SET feedback off;
SET linesize 300
SET echo off;
SET pages 10000;
SET long 90000;
COL DDL FORMAT A10000
execute DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS',false);
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',false);
-- 1. È®ÀÎ
---------------------tablespace------------------------------------------------
select dbms_metadata.get_ddl('TABLESPACE',tablespace_name)||';'
from dba_tablespaces
where tablespace_name not in ('SYSTEM','SYSAUX','UNDOTBS1','TEMP','USERS');
===============================================================================
---------------------user------------------------------------------------------
select dbms_metadata.get_ddl('USER',username)||';'
from dba_users
where username not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','APPQOSSYS','DIP','ORACLE_OCM');
===============================================================================
---------------------role------------------------------------------------------
select dbms_metadata.get_granted_ddl('ROLE_GRANT', username)||';'
from dba_users
where username not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','APPQOSSYS','DIP','ORACLE_OCM')
AND username IN (SELECT grantee FROM dba_role_privs);
select privilege
from dba_sys_privs
where grantee='SQLAB_USER';
===============================================================================1
---------------------priv------------------------------------------------------
select dbms_metadata.get_granted_ddl('SYSTEM_GRANT', username)||';'
from dba_users
where username not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','APPQOSSYS','DIP','ORACLE_OCM')
AND username IN (SELECT grantee FROM dba_sys_privs);
select dbms_metadata.get_granted_ddl('OBJECT_GRANT', username)||';'
from dba_users
where username not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','APPQOSSYS','DIP','ORACLE_OCM')
AND username IN (SELECT grantee FROM dba_tab_privs);
===============================================================================
---------------------table------------------------------------------------------
conn username/passwd
select dbms_metadata.get_ddl('TABLE', table_name)||';'
from user_tables;
===============================================================================
---------------------index------------------------------------------------------
conn username/passwd
select dbms_metadata.get_ddl('INDEX', index_name)||';'
from dba_indexes
where index_name='PK_ETB120' and owner='MISUSER'
select dbms_metadata.get_ddl('INDEX',u.index_name, 'MISUSER') ||';'
from dba_indexes u where index_name like 'PK_ETB120%';
===============================================================================
---------------------synonym---------------------------------------------------
select 'create public synonym ' || synonym_name || ' for ' || table_owner || '.' || table_name || ';'
from dba_synonyms
where owner = 'PUBLIC'
and table_owner not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','GSMADMIN_INTERNAL','SYSBACKUP','GSMUSER','AUDSYS','ORACLE_OCM','OJVMSYS');
conn username/passwd
select 'create synonym ' || synonym_name || ' for ' || table_owner || '.' || table_name || ';'
from user_synonyms
where table_owner not in (
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','GSMADMIN_INTERNAL','SYSBACKUP','GSMUSER','AUDSYS','ORACLE_OCM','OJVMSYS');
===============================================================================
---------------------invalid---------------------------------------------------
select owner, object_name, object_type, status from dba_objects where status='INVALID';
===============================================================================
temp tablespace »çÀÌÁî ´Ã·ÁÁÖ±â
alter tablespace temp add tempfile '°æ·Î' size 10g autoextend on;
====================================================================================
DB link
set long 1000
set pages 500
set lines 500
col owner for a20
col db_link for a40
select * from dba_db_links;
select dbms_metadata.get_ddl('DB_LINK', a.db_link, a.owner) from dba_db_links a;
===================================================================================
---------------------object---------------------------------------------------
set line 200
set long 2000
set pagesize 2000
col ow for a20
select owner ow,
sum(decode(object_type,'TABLE', 1, 0)) ta ,
sum(decode(object_type,'INDEX', 1, 0)) ind ,
sum(decode(object_type,'SYNONYM', 1, 0)) sy ,
sum(decode(object_type,'SEQUENCE', 1, 0)) se ,
sum(decode(object_type,'VIEW', 1, 0)) ve ,
sum(decode(object_type,'CLUSTER', 1, 0)) clu
from dba_objects
group by owner
having owner not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS','GSMADMIN_INTERNAL','SYSBACKUP','GSMUSER','AUDSYS','ORACLE_OCM','OJVMSYS');
col dbl format 999,999 heading 'Database|Links'
col pkg format 999,999 heading 'Packages'
col pkb format 999,999 heading 'Package|Bodies'
col pro format 999,999 heading 'Procedures'
col fun format 999,999 heading 'Functions'
set verify off
compute sum of dbl on report
compute sum of ow on report
compute sum of pkg on report
compute sum of pkb on report
compute sum of pro on report
compute sum of fun on report
break on report
select owner ow,
sum(decode(object_type,'DATABASE LINK', 1, 0)) dbl,
sum(decode(object_type,'PACKAGE', 1, 0)) pkg,
sum(decode(object_type,'PACKAGE BODY', 1, 0)) pkb,
sum(decode(object_type,'PROCEDURE', 1, 0)) pro,
sum(decode(object_type,'FUNCTION',1,0)) fun
from dba_objects
group by owner
having owner not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT','EXFSYS''GSMADMIN_INTERNAL','SYSBACKUP','GSMUSER','APPQOSSYS','AUDSYS','ORACLE_OCM','OJVMSYS');
datapump full
-- ½ÃÀÛ : 14:59:45
-- ³¡ : 15:00:51
exp/imp
-- ½ÃÀÛ : 15:02:00
'Oracle' 카테고리의 다른 글
[Oracle] INS-32826 the software home is already registered in the central inventory (0) | 2021.07.20 |
---|---|
[Oracle] 데이터베이스 버전 별 JDK / JDBC (0) | 2021.07.01 |
[Oracle] window 환경에서 한글 깨짐 (client NLS_LANG 설정) (0) | 2021.04.26 |
[Oracle] ORA-48128: opening of a symbolic link is disallowed (0) | 2021.04.26 |
[Oracle] ORA-39352: Wrong number of TRANSPORT_DATAFILES (0) | 2021.04.26 |