use Nothwind
go
select name, filename, * from dbo.sysfiles
name filename -------------- ------------------------------------------------------------------ Northwind d:/program files/microsoft sql server/mssql$sqla/data/northwnd.mdf Northwind_log d:/program files/microsoft sql server/mssql$sqla/data/northwnd.ldf
backup database Northwind to disk = 'c:/Northwind.bak'
use master go restore database Northwind from disk = 'c:/Northwind.bak'
SQL Server 2005 中數據文件所在目錄爲:d:/microsoft sql server/mssql.1/mssql/data/sql
restore database Northwind from disk = 'c:/Northwind.bak' with move 'Northwind' to 'd:/microsoft sql server/mssql.1/mssql/data/Northwind.mdf' ,move 'Northwind_log' to 'd:/microsoft sql server/mssql.1/mssql/data/Northwind.ldf'
Northwind 數據庫在 SQL Server 2005 中順利還原。數據庫
注意,在 SQL Server 2005 中還原 Northwind 的時候,並不須要首先建立一個同名的 Northwind 數據庫,而是直接進行 restore。spa
另外的一個問題是,若是客戶給你一個 Northwind.bak 備份文件,讓你在本身的機器上 restore。那麼如何來肯定 with move 中的邏輯文件名呢?一個方法是向客戶諮詢獲取,二是使用 SQL Server restore filelistonly 來查看。.net
從 SQL Server restore filelistonly 命令結果中能夠獲取不少信息,下面僅列出 LogicalName and PhysicalName。rest
restore filelistonly from disk='c:/Northwind.bak'
LogicalName PhysicalName --------------- ------------------------------------------------------------------ Northwind d:/Program Files/Microsoft SQL Server/MSSQL$SQLA/data/northwnd.mdf Northwind_log d:/Program Files/Microsoft SQL Server/MSSQL$SQLA/data/northwnd.ldf
轉載:http://blog.csdn.net/fax5201314/article/details/38865151
修改Sa密碼
ALTER LOGIN sa ENABLE;
ALTER LOGIN sa WITH PASSWORD = '123';