PDA, Web, Desktop, GIS, Field Mapping, KML, UTM, Education, Cartoon

Mobile GIS Delphi Sql Server OpenSocial ASP.Net/C# Google KML RSS
Showing posts with label backup database. Show all posts
Showing posts with label backup database. Show all posts

Feb 28, 2008

restore database with backup and transection logs

USE master
GO
-- First determine the number and names of the files in the backup.
RESTORE FILELISTONLY
FROM disk = 'C:\yourfolder\yourdbbackupfile.BAK'
RESTORE DATABASE yourdatabasename
FROM disk = 'C:\yourfolder\yourdbbackupfile.BAK'
WITH NORECOVERY,
-- change location
MOVE 'xxx_Data' TO 'C:\newfolder\newfile.MDF',
MOVE 'xxx_Log' TO 'C:\newfolder\newfile.LDF'
GO

RESTORE LOG yourdatabasename
FROM disk = 'C:\yourfolder\logfile1.TRN'
FROM disk = 'C:\yourfolder\logfile2.TRN'
WITH NORECOVERY
GO


-- WITH NORECOVERY need attach database, or WITH RECOVERY then dont need attach.