Trying to alter a database to enable snapshot_read_committed. The statement is not running due to the CHECKPOINT process being in the database.

How can I kick the processes into another db so I can run this command?

Thanks

link|improve this question

80% accept rate
What do you mean "default transaction isolation level"? Snapshot isolation? – gbn Sep 27 '11 at 18:11
That's it. What I've found is working is to create a table and populate it in another db. Then run some inserts and run a checkpoint command on that DB. – Sam Sep 27 '11 at 18:23
1  
I've corrected my question above. – Sam Sep 27 '11 at 18:25
feedback

1 Answer

What ended up working was this...

In another database, run this statement - it's not necessary to run the full million rows.

CREATE TABLE PageCheck
    (
      c1 INT IDENTITY ,
      c2 CHAR(5000) NOT NULL
    )

DECLARE @i INT
SET @i = 1
BEGIN TRAN
WHILE @i <= 1000000 
    BEGIN
        IF @i % 100 = 0 
            BEGIN
                COMMIT TRAN
                BEGIN TRAN
            END
        INSERT  PageCheck
                ( c2 )
        VALUES  ( '  ' )
        SET @i = @i + 1
    END
COMMIT TRAN




USE OTHER_DB
GO
CHECKPOINT
GO


USE MYDB
ALTER DATABASE MYDB
SET read_committed_snapshot ON
GO

I had tried running the checkpoint in another database, but there wasn't any work to be done, so the process didn't switch.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.