How to rebuild transaction log file in sql server 2005

  • Hi all,

    One of my colleague deleted transaction log file of database from test server. Now I have to rebuild it i tried google but could not get any solutions. The database state is now recovery_pending. I have one day old database backup of this db. How can I rebuild the transaction log file. Remember it is SQL Server 2005.

  • http://sqlinthewild.co.za/index.php/2009/06/09/deleting-the-transaction-log/

    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
  • It is test server and assume data loss is acceptable.

    You can just restart sql server services and it will automatically create new missing log file considering the file is deleted and the log file with the same name is not available at specified location.

    HTH

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • free_mascot (5/9/2011)


    You can just restart sql server services and it will automatically create new missing log file considering the file is deleted and the log file with the same name is not available at specified location.

    Not necessarily. SQL can only recreate the log if the database was cleanly shut down before the log was deleted. The fact that the DB has gone into the recovery_pending state implies that the database was not cleanly shut down and SQL cannot automatically rebuild the log.

    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
  • Hello Gila,

    Thank you for pin-pointing.

    Actually I overlook the clean shut down as I have practically done it but fortunate to have clean shut down.

    Cheers!

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

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

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