- 论坛徽章:
- 0
|
你的 版本 及 設定可能有問題
我的方式是
$dbh = DBI->connect("DBI:Oracle:$oracle_env{'sid'}","$oracle_env{'username'}","$oracle_env{'password'}");
$sql = qq{
select c.tablespace_name,round(a.bytes/1048576) Megs_Alloc,round(b.bytes/1048576) Megs_Free,round((a.bytes-b.bytes)/1048576) Megs_Used
from (select tablespace_name,sum(a.bytes) bytes,min(a.bytes) minbytes,max(a.bytes) maxbytes
from sys.dba_data_files a
group by tablespace_name) a,(select a.tablespace_name,nvl(sum(b.bytes),0) bytes
from sys.dba_data_files a,sys.dba_free_space b
where a.tablespace_name = b.tablespace_name (+) and a.file_id = b.file_id (+)
group by a.tablespace_name) b,sys.dba_tablespaces c,(select tablespace_name,count(distinct segment_name) num_segs,count(extent_id) num_exts
from sys.dba_extents
group by tablespace_name) d
where a.tablespace_name = b.tablespace_name(+) and a.tablespace_name = c.tablespace_name and a.tablespace_name = d.tablespace_name(+)
order by c.tablespace_name
};
eval{
$sth = $dbh->prepare( $sql );
$sth->execute();
$sth->bind_columns(\$GetTablespaceName,\$GetMegaAlloc,\$GetMegaFree,\$GetMegaUse);
while( $sth->fetch() ) {
push(@Tablespace_Temp,"$GetTablespaceName,$GetMegaUse,$GetMegaFree,$GetMegaAlloc\n");
}
$sth->finish();
$dbh->disconnect();
};
ppm> query dbd
Querying target 1 (ActivePerl 5.8.4.810)
1. DBD-Oracle9 [1.16]
ppm> query dbi
Querying target 1 (ActivePerl 5.8.4.810)
1. DBI [1.45]9i Client
還有你要check 你的 tnsnames.ora 有沒有 設定對
[ 本帖最后由 ieting 于 2006-6-18 16:47 编辑 ] |
|