Tuesday, February 14, 2012

create corruption

sql2k sp3a
Is there a way for me to create db corruption to do some testing?
TIA, ChrisManually delete a row from sysindexes (but don't delete anything with id <
100).
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"ChrisR" <noemail@.bla.com> wrote in message
news:%23WgmjHulFHA.3316@.TK2MSFTNGP14.phx.gbl...
> sql2k sp3a
> Is there a way for me to create db corruption to do some testing?
> TIA, Chris
>|||Thanks Randal, but this doesn't return an error, which is really what I
need. (@.@.Error still = 0) Heres what I'm trying to do.
alter procedure admin_DBCCCheckDB
as
declare @.Exec varchar(256)
declare @.Error int
declare @.rc int
declare @.ServerName varchar(256)
declare @.DBName varchar(128)
declare @.Subject varchar(128)
set @.ServerName = (select @.@.ServerName)
set @.DBName = (select db_name())
SET @.Exec = 'dbcc checkdb(''' + @.DBName + ''')' + 'WITH NO_INFOMSGS'
set @.Subject = 'Database corruption in the ' +@.DBName+ ' database!!!'
EXEC (@.Exec)
SELECT @.Error = @.@.error
print @.Error
IF @.Error <> 0
exec @.rc = master.dbo.xp_smtp_sendmail
@.FROM = @.ServerName
,@.TO = 'SQLAdmins@.Bla.com'
,@.Subject = @.Subject
,@.server = N'255.255.255.255'
,@.Port = 25
"Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message
news:usgrpPulFHA.3828@.TK2MSFTNGP12.phx.gbl...
> Manually delete a row from sysindexes (but don't delete anything with id <
> 100).
> --
> Paul Randal
> Dev Lead, Microsoft SQL Server Storage Engine
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "ChrisR" <noemail@.bla.com> wrote in message
> news:%23WgmjHulFHA.3316@.TK2MSFTNGP14.phx.gbl...
>> sql2k sp3a
>> Is there a way for me to create db corruption to do some testing?
>> TIA, Chris
>|||Doh! My print statement resturns a 0.
"ChrisR" <noemail@.bla.com> wrote in message
news:OCFVydulFHA.576@.TK2MSFTNGP15.phx.gbl...
> Thanks Randal, but this doesn't return an error, which is really what I
> need. (@.@.Error still = 0) Heres what I'm trying to do.
> alter procedure admin_DBCCCheckDB
> as
> declare @.Exec varchar(256)
> declare @.Error int
> declare @.rc int
> declare @.ServerName varchar(256)
> declare @.DBName varchar(128)
> declare @.Subject varchar(128)
> set @.ServerName = (select @.@.ServerName)
> set @.DBName = (select db_name())
> SET @.Exec = 'dbcc checkdb(''' + @.DBName + ''')' + 'WITH NO_INFOMSGS'
> set @.Subject = 'Database corruption in the ' +@.DBName+ ' database!!!'
> EXEC (@.Exec)
> SELECT @.Error = @.@.error
> print @.Error
> IF @.Error <> 0
> exec @.rc = master.dbo.xp_smtp_sendmail
> @.FROM = @.ServerName
> ,@.TO = 'SQLAdmins@.Bla.com'
> ,@.Subject = @.Subject
> ,@.server = N'255.255.255.255'
> ,@.Port = 25
>
>
> "Paul S Randal [MS]" <prandal@.online.microsoft.com> wrote in message
> news:usgrpPulFHA.3828@.TK2MSFTNGP12.phx.gbl...
>> Manually delete a row from sysindexes (but don't delete anything with id
>> < 100).
>> --
>> Paul Randal
>> Dev Lead, Microsoft SQL Server Storage Engine
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> "ChrisR" <noemail@.bla.com> wrote in message
>> news:%23WgmjHulFHA.3316@.TK2MSFTNGP14.phx.gbl...
>> sql2k sp3a
>> Is there a way for me to create db corruption to do some testing?
>> TIA, Chris
>>
>

No comments:

Post a Comment