SQL Server restore from backup file.

1.Check backup file
 restore filelistonly from disk='C:\Microsoft SQL Server\Backup\xxx.bak'

Result:
LogicalName       PhysicalName
---------------  ------------------------------------------------------------------
OldDatabase_Data       d:\Program Files\Microsoft SQL Server\MSSQL$SQLA\data\xxx.mdf
OldDatabase_log    d:\Program Files\Microsoft SQL Server\MSSQL$SQLA\data\xxx_log.ldf

2. Restore to new database
RESTORE DATABASE xxxNewName
  FROM DISK = 'C:\Microsoft SQL Server\Backup\xxx.bak'
WITH MOVE 'OldDatabase_Data'
 TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\xxxNewName.mdf' ,
MOVE 'OldDatabase_log'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\xxxNewName_log.ldf',
replace;

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE