copy a database within SQL Server Express?

前端 未结 13 2639
眼角桃花
眼角桃花 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: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!

提交回复
热议问题