Skip to the content.

Tablespace

BIGFILE과 SMALLFILE 차이

Temporary Tablespace

UNDO Tablespace


확인

SELECT * FROM DBA_DATA_FILES;

--용량별 확인
SELECT
	A.TABLESPACE_NAME,
	ROUND(CAPACITY / 1024 / 1024, 2)  AS "CAPACITY (MB)", 
	ROUND(FREE / 1024 / 1024, 2)      AS "FREE (MB)", 
	ROUND((FREE / CAPACITY * 100), 2) AS "FREE (%)" 
FROM (
	SELECT TABLESPACE_NAME, SUM(BYTES) AS CAPACITY 
	FROM   DBA_DATA_FILES GROUP BY TABLESPACE_NAME
) A
INNER JOIN (
	SELECT TABLESPACE_NAME, SUM(BYTES) as FREE 
	FROM   DBA_FREE_SPACE GROUP BY TABLESPACE_NAME
) B ON A.TABLESPACE_NAME = B.TABLESPACE_NAME
ORDER BY "FREE (MB)" DESC;


생성

--자동 확장
CREATE TABLESPACE tablespace_name DATAFILE '/AAA/BBB/CCC/tablespace_filename' SIZE size AUTOEXTEND ON NEXT size MAXSIZE UNLIMITED;

--수동 확장
CREATE TABLESPACE tablespace_name DATAFILE '/AAA/BBB/CCC/tablespace_filename' SIZE size AUTOEXTEND OFF;


추가

--자동 확장
ALTER TABLESPACE tablespace_name ADD DATAFILE '/AAA/BBB/CCC/tablespace_filename' SIZE size AUTOEXTEND ON NEXT size MAXSIZE UNLIMITED;

--수동 확장
ALTER TABLESPACE tablespace_name ADD DATAFILE '/AAA/BBB/CCC/tablespace_filename' SIZE size AUTOEXTEND OFF;


변경

ALTER TABLESPACE tablespace_name RESIZE size;

테이블 스페이스 내부 데이터 크기를 확인하여 변경


Remap


삭제

DROP TABLESPACE tablespace_name;


권한

--size만큼 사용할 수 있도록 함
ALTER USER owner_name QUOTA size ON tablespace_name;

--제한 없음
ALTER USER owner_name QUOTA UNLIMITED ON tablespace_name;

--전체 권한
GRANT UNLIMITED TABLESPACE to owner_name;


RDS에서의 Tablespace

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.Database.html


구조 설명