[Oracle] Oracle 조사 쿼리
## 유저정보 (유저생성순으로 맨아래 일반 사용계정만 확인/시스템 및 나머지 옵션 계정은 제외)
select username, created, account_status
from dba_users
order by 2;
## DATA SIZE(GB) 확인 (조건절 owner에 일반 사용자계정 입력)
-- 테이블
select sum(bytes)/power(2,30) "GB"
from dba_segments
where owner in ('username')
and segment_type like 'TABLE%';
-- LOB
select sum(bytes)/power(2,30) "GB"
from dba_segments
where owner in (' username ')
and segment_type like 'LOB%';
-- 인덱스
select sum(bytes)/power(2,30) "GB"
from dba_segments
where owner in (' username ')
and segment_type like 'INDEX%';
## 인덱스 수 확인(타입이 NORMAL = BTREE)
select index_type, count(*)
from dba_indexes
where owner in (' username ')
group by index_type
order by 1;
## 오브젝트 갯수(PL/SQL, VIEW, DB*LINK 등등..)
col owner for a15
col object_type for a15
select object_type, count(*)
from dba_objects
where owner in (' username ')
group by object_type
order by 1,2;