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';