I am writing a database space tracking setup. I can get
data file space figures eventually (with my variant of
sp_spaceused), but finding the log file space used - such
as DBCC SQLPERF(LOGSPACE) shows, and also Enterprise
Manager, how do I get that preferably with some simple SQL
query ?
TIAJim
CREATE TABLE Test
(
[Database Name] VARCHAR(50),
[Log Size] REAL,
[Log Space Used] REAL,
Status TINYINT
)
INSERT INTO Test EXEC ('DBCC SQLPERF(LOGSPACE)')
GO
SELECT * FROM Test WHERE .........
GO
Drop table Test
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message
news:1f5c01c44874$e1165580$3a01280a@.phx.gbl...
> I am writing a database space tracking setup. I can get
> data file space figures eventually (with my variant of
> sp_spaceused), but finding the log file space used - such
> as DBCC SQLPERF(LOGSPACE) shows, and also Enterprise
> Manager, how do I get that preferably with some simple SQL
> query ?
> TIA|||Hi,
Try the below query, This query will work even if we have multiple
transaction log files.
select sum(maxsize * 8.0/1024.0) AS MAX_SIZE ,sum(size * 8.0/1024.0) AS
CURRENT_SIZE
from sysfiles a where groupid = 0
Thanks
Hari
MCDBA
"Jim Trowbridge" <jtrowbridge@.adelaidebank.com.au> wrote in message
news:1f5c01c44874$e1165580$3a01280a@.phx.gbl...
> I am writing a database space tracking setup. I can get
> data file space figures eventually (with my variant of
> sp_spaceused), but finding the log file space used - such
> as DBCC SQLPERF(LOGSPACE) shows, and also Enterprise
> Manager, how do I get that preferably with some simple SQL
> query ?
> TIA
No comments:
Post a Comment