Execute the following script in Query Editor to create a table as size log and deploy the insert script into SQL Server Agent for daily, weekly, etc. execution. Disk drive free space can be obtained by sys.xp_fixeddrives and xp_cmdshell commands.
create table DBFileSize(
DBFileSizeID int identity(1,1) primary key,
[Date] datetime default (getdate()),
Name varchar(30),
FileID int,
FileName varchar(100),
FileGroup varchar(50),
FileSize varchar(20),
MaxSize varchar(20),
Growth varchar(20),
Usage varchar(15)
)
go
insert DBFileSize(Name, FileID, FileName, FileGroup, FileSize, MaxSize, Growth, Usage)
exec sp_helpfile
go
select * from DBFileSize
go
Drop table DBFileSize
GO
No comments:
Post a Comment