copy a database within SQL Server Express?

前端 未结 13 2570
眼角桃花
眼角桃花 2020-12-07 22:02

I would like to make a copy of a database I have but keep it on the same server as a test database. However, everything I have found is to use the copy database wizard (I am

相关标签:
13条回答
  • 2020-12-07 22:40

    Take these steps to make a copy of the database in SQL Express

    1. Stop SQL
    2. Copy the mdf, ldf and any other file for the db to a NEW location (make sure you get the log file)
    3. Change the name of each copied file
    4. Start SQL
    5. Right-click Database in SSMQ and select attach
    6. Make sure you change the name in the column "Attach As"
    7. Update the file location in the lower pane of "Database Details" to the location of your copied files (especially that log file)

    I was able to copy a database on my SQL Express system with this method

    alt text

    0 讨论(0)
  • 2020-12-07 22:44

    I do not believe the Express version of the manager will have the copy database feature. Have you considered copying via the backup and restore method?

    http://msdn.microsoft.com/en-us/library/ms190436.aspx

    0 讨论(0)
  • 2020-12-07 22:45

    Just be aware if you are using SQL Server Express 2012 of going to the option Files and make sure that the destination files (Restore As column) are different from the original files *.mdf and *.log

    ( I tried to put an image but need 10 reputation :p)

    0 讨论(0)
  • 2020-12-07 22:49

    I had a problem creating a copy of my database as well using SQL Express 2012. I have solved it by the backup and restore method. After making the backup I used: restore -> files and file groups

    Next step was to write a new name for the new database and set the source:

    Pointing the source file

    and finally, a overwrite the existing database with replace must be selected and set names for new files with extension mdf and ldf that are different from the existing where is: Restore as

    This method worked for me

    0 讨论(0)
  • 2020-12-07 22:54

    In SSMS 2008 you can do this:

    1. Create a backup of the database you want to copy

    2. In SSMS, right-click 'Databases' and select 'Restore Database'

    3. Select the database you wish to copy from the 'From database' drop-down list in the 'Source for restore' section

    4. Enter the name of the new database in the 'To database' field in the 'Destination for Restore' section - this cannot be the name of an existing database.

    5. Click OK

    You're done! :)

    0 讨论(0)
  • 2020-12-07 22:54

    The solution is definitely to create a backup and restore it, but ensure that you're restored copy is pointing to different .mdf and .ldf files.

    Here's how to check that using SSMS 2014 and a SQL Server 12 installation: assuming you're creating and restoring backups on your local disk.

    • Create a backup of your existing database
      • Right click the database, and choose "back up..." under "tasks."
      • (If you leave the location as the default, you don't have to hunt for the back up in the next step when you restore.)
    • Restore your backup to a NEW database:
      • Right click on databases, choose "restore database"
      • Select "device"
      • Click the ellipsis button ("...") to open the "Selct Backup devices" dialog.
      • Choose "File" as the backup media type and click the "add" button
      • Select the backup you just made, click ok (twice)
      • Now, back in the "restore database" dialog, type a new name for your destination database
      • Click "files" under "select a page" and make sure that "restore as" is pointing to .mdf and .ldf file names that do not already exist
      • Click ok!
    0 讨论(0)
提交回复
热议问题