Keeping a Database Server Healthy





0/5 (0 vote)
Actually, we think xp_cmdshell is not safe enough, and need to be enabled using surface area configuration explicitly (SQL 2005). We use xp_delete_file instead, sample code:DECLARE @l_Runtime DATETIME, @l_BackupFileName VARCHAR(256), @l_FileExists INTSET...
Actually, we think
xp_cmdshell
is not safe enough, and need to be enabled using surface area configuration explicitly (SQL 2005). We use xp_delete_file
instead, sample code:
DECLARE @l_Runtime DATETIME,
@l_BackupFileName VARCHAR(256),
@l_FileExists INT
SET @l_Runtime = GETDATE()
SET @l_BackupFileName = ...
EXEC master.dbo.xp_fileexist @l_BackupFileName, @l_FileExists OUTPUT
IF @l_FileExists = 1
BEGIN
EXECUTE master.dbo.xp_delete_file 0, @l_BackupFileName, '', @l_Runtime
END