Shrinking TransactionLog file size

  • I m using Sql server 2000, i want to shrink the log file size for this i write the below following stmts:

    --sp_helpfile

    use dbname

    Go

    Alter database dbname set recovery simple

    Go

    Checkpoint

    Go

    DBCC Shrinkfile (dbname _log', truncateonly)

    Go

    Alter database dbname set recovery full

    But QA gives so many errors:

    Line 1: Incorrect syntax near '-'.  (Alter database dbname set recovery simple)

    Server: Msg 195, Level 15, State 1, Line 1

    'Recovery' is not a recognized SET statement. (Alter database dbname  set recovery simple)

    Server: Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near '-'.(Alter database dbname  set recovery simple)

    plz tell me how do i shrink my log file and how i reomove the abv error. plz reply me asap.

    Thanx in advance.

  • Don't know about the first or last. The error says there's a syntax error near '-', but there are no dashes in what you've posted.

    There's also a syntax error in your shrinkfile. You have a space in the middle of the filename in dbcc shrink file. (and a missing ')

    I would not suggest that as a way to shrink the log, becuase you're breaking the recoverability chain of your db by setting it to simple (that's assuming you have log backups)

    Back the log up, then you should be able to shrink the file.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Since you don't give us the actual statement and you mask the database name, I'm guessing your database name has a dash in it like this: My-DB. If so, you need to put square brackets around it. [My-DB].

    -SQLBill

Viewing 3 posts - 1 through 3 (of 3 total)

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