Search

Wednesday, June 22, 2016

Getting description of all tables in the database

set feedback off
set verify off
set echo off
prompt This script is to get description of all tables excluding some schemas.
set termout off
set pages 500
set heading off
set linesize 150
spool table_definition.sql
select 'spool table_def_output.log;' from dual;
select 'DESC ' || A.OWNER ||'.'||A.TABLE_NAME DESC_SCRIPT from dba_tables a where
OWNER NOT IN ('SYS','SYSTEM','SYSMAN','MGMT_VIEW','TSMSYS','WMSYS','EXP_DBA','OUTLN','ORACLE_OCM','DBSNMP', 'MDSYS','EXFSYS', 'CTXSYS', 'OLAPSYS');
select 'exit;' from dual;
set termout on
prompt Running Script now to get description
set termout off
@table_definition.sql;
exit