shiv
2009-11-24 06:50:47 UTC
Hi,
I am trying to write a query to which reports the devices used by the
database, and the amount of space on each device in sybase database.
I came across with two queries : (
http://manuals.sybase.com/onlinebooks/group-asarc/srv10024/sag/@Generic__BookTextView/31089;pt=31343
)
1. select sysdevices.name, sysusages.size / 512 from sysdevices,
sysdatabases, sysusages where sysdatabases.name = "sybsystemprocs"
and sysdatabases.dbid = sysusages.dbid and sysdevices.low <=
sysusages.size + vstart and sysdevices.high >= sysusages.size +
vstart -1
and
( http://fengnet.com/book/Backup.and.Recovery/I_0596102461_CHP_17_SECT_9.html
)
2. select sysdevices.name as DevName, sysdatabases.name as DBName,
sysusages.size/512 as Size from sysdatabases, sysusages, sysdevices
where sysdevices.name="BadDeviceName" and sysdevices.low <=
sysusages.vstart and sysdevices.high >= sysusages.vstart and
sysusages.dbid = sysdatabases.dbid
I did not get the logic of 1st query as why we need to use
"sysdevices.low <= sysusages.size + vstart" and "sysdevices.high >=
sysusages.size + vstart -1" ? Could any one confirm on this so that I
can go ahead and pick proper query?
Regards,
Shiv
I am trying to write a query to which reports the devices used by the
database, and the amount of space on each device in sybase database.
I came across with two queries : (
http://manuals.sybase.com/onlinebooks/group-asarc/srv10024/sag/@Generic__BookTextView/31089;pt=31343
)
1. select sysdevices.name, sysusages.size / 512 from sysdevices,
sysdatabases, sysusages where sysdatabases.name = "sybsystemprocs"
and sysdatabases.dbid = sysusages.dbid and sysdevices.low <=
sysusages.size + vstart and sysdevices.high >= sysusages.size +
vstart -1
and
( http://fengnet.com/book/Backup.and.Recovery/I_0596102461_CHP_17_SECT_9.html
)
2. select sysdevices.name as DevName, sysdatabases.name as DBName,
sysusages.size/512 as Size from sysdatabases, sysusages, sysdevices
where sysdevices.name="BadDeviceName" and sysdevices.low <=
sysusages.vstart and sysdevices.high >= sysusages.vstart and
sysusages.dbid = sysdatabases.dbid
I did not get the logic of 1st query as why we need to use
"sysdevices.low <= sysusages.size + vstart" and "sysdevices.high >=
sysusages.size + vstart -1" ? Could any one confirm on this so that I
can go ahead and pick proper query?
Regards,
Shiv