import groovy.sql.Sql sql = Sql.newInstance( "jdbc:oracle:thin:@localhost:1521:orcl", "system", "manager", "oracle.jdbc.driver.OracleDriver") query = ''' select name, physical_reads, -- physical reads統計 db_block_gets, -- database blocks gotten統計 consistent_gets, -- consistent gets統計 (1-(physical_reads/(db_block_gets + consistent_gets)))*100 as hit_ratio from v$buffer_pool_statistics ''' // バッファキャッシュヒット率を表示 println "name, physical_reads, db_block_gets, consistent_gets, hit_ratio" sql.eachRow(query){ println "${it.name}, ${it.physical_reads}, ${it.db_block_gets}, " + "${it.consistent_gets}, ${it.hit_ratio}}" }
動作環境
groovy 1.8.4, JDK6 Update29, Oracle11g R2
0 件のコメント:
コメントを投稿