°¢ Å×ÀÌºí »çÀÌÁ ¾Ë¼ö ÀÖ´Â ¹æ¹ý
ÀÛ¼ºÀÚ °ü¸®ÀÚ ÀÛ¼º½Ã°£ 2007-07-03 16:15:04
 

Å×ÀÌºí µ¥ÀÌÅÍÀÇ »çÀÌÁ °è»êÇØÁÖ´Â SQL
/*--------------------------------------------------------------------
------*/
/* TABLE DATA SIZE¸¦ Á¤È®È÷ °è»êÇØÁÖ´Â ½ºÅ©¸³Æ®. 
/* »ç¿ë¹ý : @TAB_SIZE [TABLE_NAME]
/*--------------------------------------------------------------------
------*/
ANALYZE TABLE &1 DELETE STATISTICS;
ANALYZE TABLE &1 COMPUTE STATISTICS;

SELECT GREATEST(4, CEIL(NUM_ROWS/
((ROUND(((1958-(INI_TRANS*23))*
((100-PCT_FREE)/100))/AVG_ROW_LEN)))) * 2048) 
TABLESIZE_KBYTES
FROM USER_TABLES
WHERE TABLE_NAME = UPPER('&1'); 


Å×À̺íÀÌ »ç¿ëÁßÀÎ ºí·Ï Å©±â¸¦ °è»êÇØÁÖ´Â SQL
/*--------------------------------------------------------------------
------*/
/* TABLEÀÌ »ç¿ëÇÏ´Â ºí·° Å©±â¸¦ ±¸ÇÏ´Â ½ºÅ©¸³Æ®...
/* »ç¿ë¹ý : 1) DBA ±ÇÇÑÀ¸·Î ·Î±×ÀÎÇÑ´Ù.
/* 2) SQL> @TAB_BLOCK [TABLE¸í]
/* NOTICE : SUM(BLOCKS)´Â »ç¿ëÇÏ´Â ºí·°ÀÇ °¹¼öÀÌ¸ç »çÀÌÁî´Â 
/* DB_BLOCK_SIZE¸¦ °öÇÏ¿© ¾òÀ» ¼ö ÀÖ´Ù.
/*--------------------------------------------------------------------
------*/
SELECT OWNER, TABLESPACE_NAME, SEGMENT_NAME, SUM(BLOCKS)
FROM DBA_EXTENTS
WHERE SEGMENT_NAME = UPPER('&1')
GROUP BY OWNER, TABLESPACE_NAME, SEGMENT_NAME
/

/* Å×ÀÌºí½ºÆäÀ̽ºº° µð½ºÅ© »ç¿ë·® º¸±â */
SELECT SUBSTRB(A.TABLESPACE_NAME, 1,16) as TABLESPACE,
TO_CHAR(A.TOTAL, '999,999,999,990') as "ÃÑ·®(¹ÙÀÌÆ®)",
TO_CHAR(B.FREE, '999,999,999,990') as "³²Àº·®(¹ÙÀÌÆ®)",
TO_CHAR(A.BLOCKS, '9,999,990') as "ÃÑºí·°",
TO_CHAR(C.BLOCKS, '9,999,990') as "»ç¿ëºí·°",
TO_CHAR(100*NVL(C.BLOCKS,0)/A.BLOCKS, '999.99') as "»ç¿ëÀ²%"
FROM (SELECT TABLESPACE_NAME,
SUM(BYTES) as TOTAL,
SUM(BLOCKS) as BLOCKS
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME
) A,
(SELECT TABLESPACE_NAME,
SUM(BYTES) as FREE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME
) B,
(SELECT TABLESPACE_NAME,
SUM(BLOCKS) as BLOCKS
FROM DBA_EXTENTS
GROUP BY TABLESPACE_NAME
) C
WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME(+)
AND A.TABLESPACE_NAME = C.TABLESPACE_NAME(+)
ORDER BY A.TABLESPACE_NAME ;


SELECT SUBSTRB(TABLESPACE_NAME,1,20) AS "Å×ÀÌºí½ºÆäÀ̽º",
SUBSTRB(FILE_NAME, 1, 26) AS "ÆÄÀϸí",
TO_CHAR(BLOCKS,'999,999,990') as " ºí·°¼ö",
TO_CHAR(BYTES/1024/1024,'99,999,999') as " Å©±â(MB)"/*,
decode(STATUS, 'AVAILABLE', '»ç¿ë', 'ÁßÁö') as "»óÅÂ"*/
FROM SYS.DBA_DATA_FILES
WHERE TABLESPACE_NAME like 'REC_%'
ORDER BY TABLESPACE_NAME, FILE_NAME ;


¸ñ·Ï | ÀÔ·Â | ¼öÁ¤ | ´äº¯ | »èÁ¦