Shrinkdatabase job running via the SQL Server Agent

  • We run via the Enterprise Manager (sql server 2000) a Shrinkdatabase job via the SQL Server Agent with the following statements:

    DBCC Shrinkdatabase  (xxx, 20)

    DBCC Shrinkdatabase  (tempdb, 10)

    The last couple of days I frequently got the following failed-message:

    Executed as user: xxx. Could not adjust the space allocation for file 'xxx'.

    [SQLSTATE 42000] (Error 3140)  DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    [SQLSTATE 01000] (Error 2528)  Associated statement is not prepared [SQLSTATE HY007]

    (Error 0)  Cannot shrink log file 2 (templog) because requested size (7256KB)

    is larger than the start of the last logical log file. [SQLSTATE 01000]

    (Message 9007)  DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    (Message 0).  The step failed.

    Can someone explain to me what's the problem we currently have?

  • Go to BOL, Shrinking the Transaction Log:

    mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Books\architec.chm::/8_ar_da2_1uzr.htm

    Change your DBCC statement to:

    DBCC SHRINKDATABASE (tempdb, 10) WITH NO_INFOMSGS

    Andy

  • Hi Andy,

    What's the intention of the command "WITH NO_INFOMSGS", because I tried to find out via the SQL Server Books Online what this command means but with NO result.

    Please provide me with some explanations.

    Kind regards,

    Irma

  • Search this website for 'shrink transaction log' ... there are some interesting threads. The 'WITH' thing does not have to do with your problem. It determinese whether ot not messages are displayed). Transaction logs are 'circular' files so to speak and you cannot shrink them beyond their initial allocation or as far down the chain as have been allocated. Sometimes shrinking a transactino log is a repetitive process (hence the suggestion to search this site, there are a few solutions available).

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • Irma Martis (6/22/2005)


    We run via the Enterprise Manager (sql server 2000) a Shrinkdatabase job via the SQL Server Agentwith the following statements:

    DBCC Shrinkdatabase (xxx, 20)

    DBCC Shrinkdatabase (tempdb, 10)

    The last couple of days I frequently got the following failed-message:

    Executed as user: xxx. Could not adjust the space allocation for file 'xxx'.

    [SQLSTATE 42000] (Error 3140) DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    [SQLSTATE 01000] (Error 2528) Associated statement is not prepared [SQLSTATE HY007]

    (Error 0) Cannot shrink log file 2 (templog) because requested size (7256KB)

    is larger than the start of the last logical log file. [SQLSTATE 01000]

    (Message 9007) DBCC execution completed. If DBCC printed error messages, contact your system administrator.

    (Message 0). The step failed.

    Can someone explain to me what's the problem we currently have?

  • Please note: 6 year old thread

    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

Viewing 6 posts - 1 through 5 (of 5 total)

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