SQL Server Performance

.mdf, .ldf and restore

Discussion in 'ALL SQL SERVER QUESTIONS' started by Antonio Benildus Muerling, May 20, 2012.

  1. Hi All,

    Thanks a lot for reaading my post.

    When I create a database, by right clicking in, an .mdf file and a .ldf file has been created in the path of MSSQL/Data.

    what is the purpose of this .mdf file and .ldf file, that would be my first question, in case if I go and delete these 2 files, what happens for the Database as a result of deleting.

    The other question would be, when I restore a complete database from elsewhere to the database server, would the newly restored database, have a .mdf and a .ldf file

    Thanks,

    AB
  2. Luis Martin Moderator

    Welcome to the forums.
    Physicals files names in SQL for default are: .mdf for data files and .ldf for log files.
    If SQL is running you can't delete those files. Now if SQL is down, then you can delete those files and, when SQL is up, your database became to suspect and unusable.
    About restore question, yes if that database was created with .mdf and .ldf names.
  3. Chililla New Member

    whenever you create a new database you always will have these two files they are know as Data files
    the MDF file is the file that contains the data in your database and the LDF file will be the log file
    all transactions (Inserts, Deletes and Updates) that you issue against the database are first recorded in the ldf file and then it goes fisically to the MDF

    if you delete one of these files you will losse the database and there will be no way to recover it unless you have a database backup

    and whenever you restore a backup you are restoring these two files basically

    is good to mention that there is another data file and its named ndf

    hope this can clarify more your questions
  4. shivashankara New Member

    How to post new thread?
  5. Luis Martin Moderator

    Go to Forums, choose ALL SERVER QUESTIONS and click on new thread (right side).
  6. shivashankara New Member

    I tried this, after hitting create thread it says please enter a valid message.
  7. Luis Martin Moderator

    After fill Title and body?
  8. shivashankara New Member

    I can see Title option but not body.
    Also i can see post a poll option.

    I tried many times this morning to post a new thread.
  9. Luis Martin Moderator

    I'll contact Administrator.
  10. shivashankara New Member

    Thanks
  11. admin Administrator

    Sorry for the hassle on this, I can't see what should be going wrong. What browser are you using?
  12. shivashankara New Member

    Using Mozilla.
  13. shivashankara New Member

    Sorry, admin i tried in internet explorer it's working now...Thank you
  14. admin Administrator

    Hmmmm, works fine for me in FireFox - I'm currently using version 10. What version are you using?

Share This Page