脚踏实地、勇往直前!
全部博文(1005)
分类: Python/Ruby
2013-01-10 20:03:40
$db_user = "hxl";
$db_pass = "hxl";
$db_sid = "hxl";
$dbconn=oci_connect($db_user,$db_pass,"(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =172.18.2.15)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = hxl)))");
//$sql = "select EMPno,Ename from scott.emp";
$sql="select
t.statedate statedate,
t.instance_name,
t.tablespace_name,
to_char(t.total_size_gb,'FM9999990.0099') total_size_gb,
to_char(t.used_size_gb,'FM9999990.0099') used_size_gb,
to_char(t.total_size_gb - t.used_size_gb,'FM9999990.0099') free_size,
to_char(t.usage_pct,'FM9999990.0099') usage_pct
from tb_tablespace_usage_info t
where t.statedate = to_char(sysdate, 'yyyymmdd')
and t.type_id in ('1', '2')
order by t.usage_pct desc";
$oci_rs = oci_parse($dbconn,$sql);
oci_execute($oci_rs,OCI_DEFAULT);
//while($row=oci_fetch_array($oci_rs,OCI_ASSOC)) {
// print_r($row);
//}
print " print " print " print " print " print " print " print " while( OCIFetchInto($oci_rs, &$result_array)) { print " print " print " print " print " print " print " print " print " } print "";
";统计时间 ";
实例名称 ";
表空间名称 ";
总空间大小(GB) ";
使用空间(GB) ";
剩余空间(GB) ";
使用率 ";
";
";$result_array[0] ";
$result_array[1] ";
$result_array[2] ";
$result_array[3] ";
$result_array[4] ";
$result_array[5] ";
$result_array[6] ";
?>
展现效果如下:
-- The End --