Learning: how to restore the backed up Bak to a new database

Source: Internet
Author: User

1,Code:

UseMaster

restore database database name from disk = 'C:/dbname. bak' with replace

 Or:

 Restore and modify the database path:

 RestoreDatabaseDatabase Name 

FromDisk='C:/dbname. Bak'

with move 'test' to 'C: "Program Files" Microsoft SQL Server "MSSQL" data "test. MDF ' ,

Move'Test _ Log'To'C: "Program Files" Microsoft SQL Server "MSSQL" data "'Test_log.LDF'

 

2,Enterprise Manager: 

 Operations in Enterprise Manager:

Enterprise Manager -- right-click " database " -- all tasks -- restore a database

--"Restore to database"Enter the restored Database Name 

-- Restore Selection " Slave Device "-- Select a device -- Add -- Add your backup file -- OK , Return to the database restoration page.  

-- options -- set " move to physical file name " to the file name of your data file

--If the database to be restored already exists,Select"Force restore on existing database"-

-OK

ArticleSource: http://topic.csdn.net/t/20031217/17/2574348.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.