<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld" 
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:head headType="result" />
<jsp:directive.include file="/jsp/custom/result_info.jsp" />
<og:comment
	system   = "GE:エンジンサンプル"
	pgid     = "GE1004"
	title    = "DB検索"
	date     = "2007/12/12"
	author   = "K.HASEGAWA"
	text     = "ZZZZ"
	version  = "001"
/>

<og:query command="{@command}" debug="{@debug}" dbid="{@DBID}" >
	<jsp:text>
		select distinct
			df.TABLESPACE_NAME,
			df.FILE_NAME,
			round(df.USER_BYTES/(1024*1024))								"TOTAL(MB)",
			round(((df.USER_BYTES) - COALESCE(fs.FREE_EXTENTS,0))/(1024*1024),1)	"USED(MB)",
			round(COALESCE(fs.FREE_EXTENTS,0)/(1024*1024),1)						"FREE(MB)",
			round((COALESCE(fs.FREE_EXTENTS,0)/df.USER_BYTES)*100,1)				"FREE(%)",
			round(df.USER_BYTES/(1024*1024)*2)								NEW_MB,
			df.AUTOEXTENSIBLE												AUTO,
			case when round((COALESCE(fs.FREE_EXTENTS,0)/df.USER_BYTES)*100,1) &lt; 30 AND df.AUTOEXTENSIBLE = 'NO'
				then '1' ELSE '0' end FLAG
		from
			(select
				TABLESPACE_NAME,
				FILE_NAME,
				FILE_ID,
				AUTOEXTENSIBLE,
				sum(USER_BYTES) USER_BYTES
			from
				DBA_DATA_FILES
			group by TABLESPACE_NAME,FILE_NAME,FILE_ID,AUTOEXTENSIBLE
			) df,
			(select
				TABLESPACE_NAME,
				FILE_ID,
				sum(BYTES) FREE_EXTENTS
			from
				DBA_FREE_SPACE
			group by TABLESPACE_NAME,FILE_ID
			) fs
		where
			df.TABLESPACE_NAME = fs.TABLESPACE_NAME(+)
		and	df.FILE_ID         = fs.FILE_ID(+)
		and df.TABLESPACE_NAME like '{@OBJECT_NAME}%'
		order by TABLESPACE_NAME
	</jsp:text>
</og:query>

<og:viewLink command="{@command}">
	<og:link column="NEW_MB" href="resizeDB.jsp" target="SUB_WIND" onLink="[AUTO]" markList="NO"
		keys="command,FILE_NAME,NEW_MB" vals="NEW,[FILE_NAME],[NEW_MB]" />
</og:viewLink>

<og:viewMarker command="{@command}">
	<og:columnMarker column="FREE(%)" onMark="[FLAG]" markList="1" >
		<span style="background-color:#ccff00">[FREE(%)]</span>
	</og:columnMarker>
</og:viewMarker>

<og:view
	viewFormType = "HTMLTable"
	command    = "{@command}"
	writable   = "false"
	noDisplay  = "FLAG"
	startNo    = "{@startNo}"
	pageSize   = "{@pageSize}"
/>

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
