Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2001
    Location
    chennai
    Posts
    21

    Unanswered: Use MDF and LDF files

    hii
    follow this

    1)stop sql server
    2) take a copy of the two MDF and LDF files and NDF files if any.
    3) Change the Name of the files
    eg db2_data.mdf and db2_log.mdf
    4)copy these in the data folderof MSSQL
    5) start the SQL Server
    6) from your query analyser
    run sp_attach_db (please find the parameters in the Books online) procedure (if u have sql2000 u can do this from the enterprise manager)
    7) in query anlayser go to db2 database , query the sysusers and drop all the users using sp_dropuser
    8) recreate the users using Enterprise manage or other wise

    other way
    is detaching and attaching in a new name.
    K.Ramakrishnan
    Chennai

  2. #2
    Join Date
    May 2002
    Posts
    299
    Why are you even considering that *unsafe* route. A simple "backup database <dbname> to disk='c:\tmp.bak'" will do the backup. Then a simple "restore database <newdbname> from disk='c:\tmp.bak' with move 'newlogicalname' to 'c:\xyz.mdf',
    move 'newlogicallogname' to 'c:\xyz.ldf'" will restore it.
    --
    -oj
    http://www.rac4sql.net

  3. #3
    Join Date
    Dec 2003
    Location
    Adelaide, South Australia
    Posts
    2

    Wink Correct Syntax

    Perhaps you should get the Syntax correct:

    restore database MyNewDB from disk='d:\MyDb.bak' with recovery, move 'MyDb_Data' to 'c:\MyNewDB.mdf', move 'MyDb_Log' to 'c:\MyNewDB.ldf'

    Note: Use the following to discover files in backup.

    RESTORE FILELISTONLY from disk='d:\MyDb.bak'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •