Monday, 30 November 2009

Restore




R E S T O R E

Tuesday, December 01, 2009

Method 1:-

RESTORE DATABASE NewDatabaseName

FROM DISK='D:\YourBackupfilename.bak'

WITH MOVE'LOgicalName of the SOurceDatafile' TO 'D:\NewDatabase.mdf',

MOVE 'Logicalname of sourcelogfile' TO'D:\NewDatabase_log.ldf'

Method 2:-

RESTORE DATABASE ntest_new FROM DISK = 'C:\temp\test.bak'

WITH

MOVE 'test' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\ntest_new.mdf' ,

MOVE 'test_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\ntest_new_log.ldf'

Method 3:-

Retrive the Logical file name of the database from backup.
RESTORE FILELISTONLY
FROM DISK = 'D:BackUpYourBaackUpFile.bak'
GO

Method 4:-

RESTORE DATABASE YourDB
FROM DISK = 'D:BackUpYourBaackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName'
TO 'D:DataYourLDFFile.mdf'

Method 5:-

RESTORE DATABASE Employee_Data_TSQL
FROM DISK='d:\Employee_Data.bak'
WITH
MOVE 'Employee_Data' TO 'D:\TSQL\Employee_Data.mdf',
MOVE 'Employee_Data_log' TO 'D:\TSQL\Employee_Data_log.ldf'

Method 6:-

RESTORE DATABASE Employee_Data_TSQL
FROM DISK='d:\Employee_Data.bak'
WITH
MOVE 'Employee_Data' TO 'D:\TSQL\Employee_Data.mdf',
MOVE 'Employee_Data_log' TO 'D:\TSQL\Employee_Data_log.ldf'
, STATS=10


No comments:

Post a Comment