How to corrupt a db

  • Spongemagnet, the term code injection spring to mind plus add the code from MarkusB!

  • Hi BrandonGalderisi,

    quote:


    This didn't work for me.... any suggestions?


    it seems to work only on SQL7, not SQL2k. Something's changed with FirstIAM?

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I ran it on SQL2K it it did work for me. Although the database seemed to be ok in EM, as soon as you run a SELECT on the table in question you get an error.

    By the way DBCC CHECKALLOC can fix the database again.

    [font="Verdana"]Markus Bohse[/font]

  • Hi MarkusB,

    quote:


    I ran it on SQL2K it it did work for me. Although the database seemed to be ok in EM, as soon as you run a SELECT on the table in question you get an error.

    By the way DBCC CHECKALLOC can fix the database again.


    I'll try again. Thanks for anticipating the answer to the not yet asked follow-up question.

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Here is something that works for me on SQL 6.5 and 2000 (I didn't test it with 7.0):

    Jon

    -----------------------

    use TestCorrupt

    go

    /*******************************************************************************

    *

    * Create a test table

    *

    ********************************************************+**********************/

    create table junk

    (

    col1 int,

    col2 char(1),

    col3 varchar(50),

    col4 datetime

    )

    create index Junk_IDX1 on Junk

    (col1)

    go

    /*******************************************************************************

    *

    * Allow updates to the system tables

    *

    ********************************************************+**********************/

    sp_configure 'allow updates', 1

    go

    reconfigure with override

    go

    /*******************************************************************************

    *

    * Make an orphan out of the index by deleting the table which it

    * references

    *

    ********************************************************+**********************/

    select * from sysobjects where name = 'junk'

    delete from sysobjects where name = 'junk'

    go

    /*******************************************************************************

    *

    * Disallow updates to the system tables

    *

    ********************************************************+**********************/

    sp_configure 'allow updates', 0

    go

    reconfigure with override

    go

    /*******************************************************************************

    *

    * Display the corruption

    *

    ********************************************************+**********************/

    dbcc checkcatalog(TestCorrupt)

    go

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply