SQL RESTORE Database

Source: Internet
Author: User
Tags microsoft sql server mssql

1. View the logical file name (logical file name) and physical path (operation system file name) of the Northwind database files in SQL Server 2000:
Use nothwindgoselect name, filename, * from Dbo.sysfiles
Name            filename--------------  ------------------------------------------------------------------ Northwind       d:/program files/microsoft sql Server/mssql$sqla/data/northwnd.mdfnorthwind_log   d:/program files /microsoft SQL Server/mssql$sqla/data/northwnd.ldf
2. Backing up a SQL Server 2000.Northwind database
Backup Database Northwind to disk = ' C:/northwind.bak '
3. Restore the Northwind database in SQL Server 2005 Instance.
Use Mastergorestore database Northwind from disk = ' C:/northwind.bak '


4. Correct method for restoring the Northwind database in SQL Server 2005: Restore with Move.

The data files in SQL Server 2005 are located in the following directory: D:/microsoft SQL server/mssql.1/mssql/data/

Restore DATABASE northwind From disk = ' C:/northwind.bak ' with Move ' Northwind ' to     ' D:/microsoft SQL Server/mssql.1/ms Sql/data/northwind.mdf '    , move ' northwind_log ' to ' D:/microsoft SQL Server/mssql.1/mssql/data/northwind.ldf '

The Northwind database is restored successfully in SQL Server 2005.

Note that when you restore Northwind in SQL Server 2005, you do not need to first create a Northwind database with the same name, but restore directly.

Another problem is if the customer gives you a Northwind.bak backup file that lets you restore on your own machine. So how do you determine the logical file name in with move? One approach is to ask the customer for access, and the second is to use SQL Server restore filelistonly to view it.

5. Use the SQL Server restore FILELISTONLY command to view the logical file name

You can get a lot of information from the SQL Server restore FILELISTONLY command results, only LogicalName and PhysicalName are listed below.

Restore filelistonly from disk= ' C:/northwind.bak '
LogicalName       physicalname---------------  -------------------------------------------------------------- ----Northwind        d:/program files/microsoft SQL server/mssql$sqla/data/northwnd.mdfnorthwind_log    D:/program Files/microsoft SQL Server/mssql$sqla/data/northwnd.ldf


Reprint: http://blog.csdn.net/fax5201314/article/details/38865151

SQL RESTORE Database

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.