Transaction Logs and Service Stop

  • Hi!

    If the SQL Server service is manually stopped (not task killed) does that commit transactions?  Could you theoretically then take the MDF files of a database to a new server and use them to start the database up there without having to bring over the existing LDF files too?

    Thanks for your thoughts!

     

  • Check Shutdown

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • if the SQL Service is stopped, one of the things it does is puts a pointer in  thelog, to track what is committed or not committed as far as transactions go.

    when the service starts again, it will rollback any transactions not committed at that point.

     

    you can attach the mdf/ndf files without the log, but I believe you have to do it via script, I don't think there is a GUI prompt.

    the command looks something like this:

    CREATE DATABASE PROD_Copy ON
    (FILENAME = 'D:\MSSQL14.MSSQLSERVER\MSSQL\PROD.mdf')
    FOR ATTACH_REBUILD_LOG
    GO

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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