ASM datafiles size…in bubbles

I’ve started a few days ago learning R and i’ve done some cool things on it (not that cool, really), mainly generating various type of charts with random data collected from Streams performance and my preferred is Bubble Chart.

To exemplify i’ve created a simple R script to generated bubbles from my ASM datafile size. My twitter friend Bertrand Drouvot R scripts helped me to create the JDBC connection.


cat ("Building the thin jdbc connection string....\n")
cat ("\n")

# which host ?

cat("host ?: ")
srv_host_name<-readLines(con="stdin", 1)

# which port ?

cat("port ?: ")
srv_port<-readLines(con="stdin", 1)

# which service_name ?

cat("service_name ?: ")
srv_name<-readLines(con="stdin", 1)

# system password ?

cat("system password ?: ")
system_pwd<-readLines(con="stdin", 1)

library(RJDBC)
#
# set up a JDBC connection
# configure "drv" for your env

drv <-JDBC("oracle.jdbc.driver.OracleDriver","/Volumes/DATA/oracle_client/ojdbc6.jar")

conn_string<-"jdbc:oracle:thin:@//"
conn_string<-paste(conn_string,srv_host_name,sep="")
conn_string<-paste(conn_string,":",sep="")
conn_string<-paste(conn_string,srv_port,sep="")
conn_string<-paste(conn_string,"/",sep="")
conn_string<-paste(conn_string,srv_name,sep="")

conn<-dbConnect(drv,conn_string,"system",system_pwd)

myquery<-"SELECT a.name ANAME, round(f.bytes/1024/1024, 2) FSIZE FROM v$asm_file f, v$asm_alias a WHERE f.group_number=a.group_number and f.file_number=a.file_number and f.type='DATAFILE' ORDER BY 1, 2"

data<-dbGetQuery(conn,myquery)
#

radius <- sqrt(data$FSIZE/ pi)
radius
symbols(data$FSIZE, data$FSIZE, circles=radius, inches=0.35,
        main = "ASM file size bubbles",
        fg="white", bg="red", xlab="Size", ylab="Size")
text(x=data$FSIZE, y=data$FSIZE, labels=data$ANAME, cex=0.5)

The result from this very simple example is:

ASM datafile size bubble chart

 

Hope it can be useful for you too.

About these ads

One thought on “ASM datafiles size…in bubbles

  1. Pingback: SLOB2: Testing The Effect Of Oracle Blocksize | flashdba

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s