Views
DATABASE VIEW NOTES:
select OWNER, OBJECT_NAME, to_char(CREATED,'MM/DD/YYYY HH24:MI:SS') created, status from dba_objects where OWNER not in ('SYS','SYSTEM') and OBJECT_TYPE='VIEW' order by OWNER,OBJECT_NAME
select OWNER, OBJECT_NAME, to_char(CREATED,'MM/DD/YYYY HH24:MI:SS') created, status from dba_objects where OWNER not in ('SYS','SYSTEM') and OBJECT_TYPE='VIEW' order by OWNER,OBJECT_NAME
select TABLE_OWNER, TABLE_NAME, TRIGGER_NAME, TRIGGER_TYPE, TRIGGERING_EVENT, STATUS from dba_triggers order by TABLE_NAME, TRIGGER_NAME
select OWNER, SYNONYM_NAME, TABLE_OWNER, TABLE_NAME, DB_LINK from dba_synonyms where owner not in ('SYS','SYSTEM','PUBLIC','DBSNMP') order by OWNER,SYNONYM_NAME
select OWNER, NAME, TABLE_NAME, MASTER_VIEW, MASTER_OWNER, MASTER, MASTER_LINK, CAN_USE_LOG, UPDATABLE, LAST_REFRESH, ERROR, TYPE, NEXT, REFRESH_GROUP from dba_snapshots order by OWNER,NAME
select SEQUENCE_OWNER, SEQUENCE_NAME, MIN_VALUE, MAX_VALUE, INCREMENT_BY, CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE, LAST_NUMBER from dba_sequences where SEQUENCE_OWNER not in ('SYS','SYSTEM') order by SEQUENCE_OWNER,SEQUENCE_NAME
select OWNER, NAME, TYPE from dba_source group by OWNER,NAME,TYPE order by OWNER,NAME,TYPE
select OWNER, DB_LINK, USERNAME, HOST, to_char(CREATED,'MM/DD/YYYY HH24:MI:SS') created from dba_db_links order by OWNER,DB_LINK
select LOG_USER, SCHEMA_USER schema, JOB job#, INTERVAL, to_char(NEXT_DATE,'MM/DD/YYYY HH24:MI:SS') next_execution, BROKEN, substr(WHAT,1,100) what from dba_jobs order by LOG_USER
select a.OWNER, TABLESPACE_NAME, a.CLUSTER_NAME, TABLE_NAME, TAB_COLUMN_NAME, CLU_COLUMN_NAME from dba_clusters a, dba_clu_columns b where a.CLUSTER_NAME = b.CLUSTER_NAME order by a.OWNER,TABLESPACE_NAME,a.CLUSTER_NAME,TABLE_NAME
select TABLESPACE_NAME, sum(BYTES) Total_free_space, max(BYTES) largest_free_extent from dba_free_space group by TABLESPACE_NAME
select OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME, BYTES from dba_segments where TABLESPACE_NAME = 'SYSTEM' and OWNER not in ('SYS','SYSTEM') order by OWNER, SEGMENT_NAME
select USERNAME, CREATED, PROFILE, DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE from dba_users order by USERNAME
select a.TABLESPACE_NAME, a.BYTES bytes_used, b.BYTES bytes_free, b.largest, round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used from ( select TABLESPACE_NAME, sum(BYTES) BYTES from dba_data_files group by TABLESPACE_NAME ) a, ( select TABLESPACE_NAME, sum(BYTES) BYTES , max(BYTES) largest from dba_free_space group by TABLESPACE_NAME ) b where a.TABLESPACE_NAME=b.TABLESPACE_NAME order by ((a.BYTES-b.BYTES)/a.BYTES) desc
select TABLESPACE_NAME, TOTAL_EXTENTS, EXTENTS_COALESCED, PERCENT_EXTENTS_COALESCED, TOTAL_BYTES, BYTES_COALESCED, TOTAL_BLOCKS, BLOCKS_COALESCED, PERCENT_BLOCKS_COALESCED from dba_free_space_coalesced order by TABLESPACE_NAME
select TABLESPACE_NAME, INITIAL_EXTENT, NEXT_EXTENT, MIN_EXTENTS, MAX_EXTENTS, PCT_INCREASE, STATUS, CONTENTS from dba_tablespaces order by TABLESPACE_NAME
select BANNER product_versions from v$version
select SESSIONS_MAX, SESSIONS_WARNING, SESSIONS_CURRENT, SESSIONS_HIGHWATER, USERS_MAX from v$license
select NAME, VALUE, ISDEFAULT, ISSES_MODIFIABLE, ISMODIFIED from v$parameter order by NAME
select 'Archived Log Directory' "Filename", value "Location" from v$parameter where name = 'log_archive_dest' UNION select 'Control Files' "Filename", value "Location" from v$parameter where name = 'control_files' UNION select 'Datafile' "Filename", name "Location" from v$datafile UNION select 'LogFile Member' "Filename", member "Location" from v$logfile
select FILE_NAME, d.TABLESPACE_NAME, d.BYTES datafile_size, nvl(sum(e.BYTES),0) bytes_used, round(nvl(sum(e.BYTES),0) / (d.BYTES), 4) * 100 percent_used, d.BYTES - nvl(sum(e.BYTES),0) bytes_free from DBA_EXTENTS e, DBA_DATA_FILES d where d.FILE_ID = e.FILE_ID (+) group by FILE_NAME,d.TABLESPACE_NAME, d.FILE_ID, d.BYTES, STATUS order by d.TABLESPACE_NAME,d.FILE_ID
select NAME, CREATED, LOG_MODE, CHECKPOINT_CHANGE#, ARCHIVE_CHANGE# from v$database
select OWNER, TABLE_NAME, CACHE from dba_tables where OWNER not in ('SYS','SYSTEM') and CACHE like '%Y' order by OWNER,TABLE_NAME
select OWNER, TABLE_NAME, to_char(LAST_ANALYZED,'MM/DD/YYYY HH24:MI:SS') last_analyzed from dba_tab_columns where OWNER not in ('SYS','SYSTEM') and LAST_ANALYZED is not null and COLUMN_ID=1 and (SYSDATE-LAST_ANALYZED) < 30 order by (SYSDATE-LAST_ANALYZED)
select OWNER, sum(decode(nvl(NUM_ROWS,9999), 9999,0,1)) analyzed, sum(decode(nvl(NUM_ROWS,9999), 9999,1,0)) not_analyzed, count(TABLE_NAME) total from dba_tables where OWNER not in ('SYS', 'SYSTEM') group by OWNER
select owner "Owner", segment_name "Segment Name", segment_type "Type", tablespace_name "Tablespace", extents "Ext", max_extents "Max" from dba_segments where ((max_extents - extents) <= 3) and owner not in ('SYS','SYSTEM') order by owner, segment_name
select OWNER, TABLESPACE_NAME, SEGMENT_NAME, SEGMENT_TYPE, BYTES, EXTENTS, MAX_EXTENTS, (EXTENTS/MAX_EXTENTS)*100 percentage from dba_segments where SEGMENT_TYPE in ('TABLE','INDEX') and EXTENTS > MAX_EXTENTS/2 order by (EXTENTS/MAX_EXTENTS) desc
select OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME, NEXT_EXTENT from ( select seg.OWNER, seg.SEGMENT_NAME, seg.SEGMENT_TYPE, seg.TABLESPACE_NAME, t.NEXT_EXTENT from dba_segments seg, dba_tables t where (seg.SEGMENT_TYPE = 'TABLE' and seg.SEGMENT_NAME = t.TABLE_NAME and seg.owner = t.OWNER and NOT EXISTS ( select TABLESPACE_NAME from dba_free_space free where free.TABLESPACE_NAME = t.TABLESPACE_NAME and BYTES >= t.NEXT_EXTENT)) union select seg.OWNER, seg.SEGMENT_NAME, seg.SEGMENT_TYPE, seg.TABLESPACE_NAME, c.NEXT_EXTENT from dba_segments seg, dba_clusters c where (seg.SEGMENT_TYPE = 'CLUSTER' and seg.SEGMENT_NAME = c.CLUSTER_NAME and seg.OWNER = c.OWNER and NOT EXISTS ( select TABLESPACE_NAME from dba_free_space free where free.TABLESPACE_NAME = c.TABLESPACE_NAME and BYTES >= c.NEXT_EXTENT)) union select seg.OWNER, seg.SEGMENT_NAME, seg.SEGMENT_TYPE, seg.TABLESPACE_NAME, i.NEXT_EXTENT from dba_segments seg, dba_indexes i where (seg.SEGMENT_TYPE = 'INDEX' and seg.SEGMENT_NAME = i.INDEX_NAME and seg.OWNER = i.OWNER and NOT EXISTS ( select TABLESPACE_NAME from dba_free_space free where free.TABLESPACE_NAME = i.TABLESPACE_NAME and BYTES >= i.NEXT_EXTENT)) union select seg.OWNER, seg.SEGMENT_NAME, seg.SEGMENT_TYPE, seg.TABLESPACE_NAME, r.NEXT_EXTENT from dba_segments seg, dba_rollback_segs r where (seg.SEGMENT_TYPE = 'ROLLBACK' and seg.SEGMENT_NAME = r.SEGMENT_NAME and seg.OWNER = r.OWNER and NOT EXISTS ( select TABLESPACE_NAME from dba_free_space free where free.TABLESPACE_NAME = r.TABLESPACE_NAME and BYTES >= r.NEXT_EXTENT)) ) orasnap_objext_warn order by OWNER,SEGMENT_NAME
select OWNER, COLUMN_NAME, TABLE_NAME, decode(DATA_TYPE, 'NUMBER', DATA_PRECISION, DATA_LENGTH) datatype from dba_tab_columns where (COLUMN_NAME, OWNER) in (select COLUMN_NAME, OWNER from dba_tab_columns group by COLUMN_NAME, OWNER having min(decode(DATA_TYPE, 'NUMBER', DATA_PRECISION, DATA_LENGTH)) < max(decode(DATA_TYPE, 'NUMBER', DATA_PRECISION, DATA_LENGTH)) ) and OWNER not in ('SYS', 'SYSTEM') order by COLUMN_NAME,DATA_TYPE
select acc.OWNER, acc.CONSTRAINT_NAME, acc.COLUMN_NAME, acc.POSITION, 'No Index' Problem from dba_cons_columns acc, dba_constraints ac where ac.CONSTRAINT_NAME = acc.CONSTRAINT_NAME and ac.CONSTRAINT_TYPE = 'R' and acc.OWNER not in ('SYS','SYSTEM') and not exists ( select 'TRUE' from dba_ind_columns b where b.TABLE_OWNER = acc.OWNER and b.TABLE_NAME = acc.TABLE_NAME and b.COLUMN_NAME = acc.COLUMN_NAME and b.COLUMN_POSITION = acc.POSITION) order by acc.OWNER, acc.CONSTRAINT_NAME, acc.COLUMN_NAME, acc.POSITION
select c.OWNER, c.TABLE_NAME, c.CONSTRAINT_NAME, cc.COLUMN_NAME, r.TABLE_NAME, rc.COLUMN_NAME, cc.POSITION from dba_constraints c, dba_constraints r, dba_cons_columns cc, dba_cons_columns rc where c.CONSTRAINT_TYPE = 'R' and c.OWNER not in ('SYS','SYSTEM') and c.R_OWNER = r.OWNER and c.R_CONSTRAINT_NAME = r.CONSTRAINT_NAME and c.CONSTRAINT_NAME = cc.CONSTRAINT_NAME and c.OWNER = cc.OWNER and r.CONSTRAINT_NAME = rc.CONSTRAINT_NAME and r.OWNER = rc.OWNER and cc.POSITION = rc.POSITION order by c.OWNER, c.TABLE_NAME, c.CONSTRAINT_NAME, cc.POSITION
This article is about the bug in Hive filtering option, when the partition table query stored as parquet. Big data developers will help y...