Shrink Log file for all Databases

  • Comments posted to this topic are about the item Shrink Log file for all Databases

    David Bird

  • I've tried this script, but it will only work if there are no spaces in the db_name. We have a database named Mediabin Repository and when I run this script, I'll get the following error:

    "Msg 911, Level 16, State 1, Line 1"

    "Could not locate entry in sysdatabases for database 'MediaBin'. No entry found with that name. Make sure that the name is entered correctly."

    What is the correct way to run this script when there are spaces in the database name?

  • Thanks a lot.

    The script was very helpful.

  • reddi_arjun (3/18/2013)


    Thanks a lot.

    The script was very helpful.

    PLEASE DO NOT DO THIS!!! IT IS A HORRIBLE, HORRIBLE THING TO DO ON YOUR SQL SERVER!!!

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • F. van 't Hoff (11/29/2011)


    I've tried this script, but it will only work if there are no spaces in the db_name. We have a database named Mediabin Repository and when I run this script, I'll get the following error:

    "Msg 911, Level 16, State 1, Line 1"

    "Could not locate entry in sysdatabases for database 'MediaBin'. No entry found with that name. Make sure that the name is entered correctly."

    What is the correct way to run this script when there are spaces in the database name?

    Because your database name has a space in it, you would need to put it in brackets, [Mediabin Repository].

    I also agree with Kevin. This is not something that should be done on a regular basis. I can see it as a one off due to extraordinary operations, such as a major archiving of data to another database.

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

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