NOTE: The code is no longer available directly from this page. Following are the aspects to consider while using the script. Just point the script at an existing SQL Server Backup File, and give the new database a name, along with a target folder for the data and log files, and press F5. Where can I find SQL Server Management Studio for SQL Server 2016?

A script is returned as the result which can and should be carefully verfied before using it.

[sp_RestoreScriptGenie] Sorry, your blog cannot share posts by email. Just point the script at an existing SQL Server Backup File, and give the new database a name, along with a target folder for the data and log files, and press F5.This script is compatible with SQL Server 2005 and higher, and has been tested on a case-sensitive-collation server. ,@ToLogFolder = 'L:\SQLLogs\WriteOptimizedDrive\' Open Outlook > File > Options > Mail > Under Conversation Clean up, Uncheck When a reply modifies a message, don't move the original > Restart Outlook (it is is already unchecked, check it Restart Outlook, Uncheck it and Restart Outlook) 2. ZDiTect.com All Rights Reserved. UNDERCOVER TOOLBOX: sp_RestoreScript A Painless way to generate SQL Server database restorescripts. Many times it can be difficult to perform a Restore due to corrupted media, low disk space on the server and so on. . Restore As: The full path of the database file to be restored. DEFAULT: Current Database. Msg 1834, Level 16, State 1, Line 1 The file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Log.ldf' cannot be overwritten. , MOVE 'db_workspace_FG1' TO 'D:\SQLData\ReadOptimizedDrive\db_workspace_FG1.ndf', ;RESTORE LOG db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace_log.trn' WITH STANDBY =N'X:\Backups\Temp\db_workspace_ROLLBACK_UNDO.bak ', FILE = 5, ;RESTORE LOG db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace_log.trn' WITH STANDBY =N'X:\Backups\Temp\db_workspace_ROLLBACK_UNDO.bak ', FILE = 6 ,STOPAT = '2013-01-11 16:56:10', Scrubbing Personally Identifiable Information, SQL Server Database RESTORE WITH MOVE or not WITH MOVE, Restoring a SQL Server Database A Practical Example, Using Page Level Restore as a Disaster Recovery Procedure in SQL Server 2005, STOPBEFOREMARK for stopping at specific LSN. Explore the Best Info Now. The MOVE clause for each file to restore to a new location. This site uses Akismet to reduce spam. SQL Server Best Practice Auto Close Database Option Should Remain OFF, Steps to Connect to SQL Server When all System Administrators are Locked Out. That code will generate a statement similar to this: Have fun using this to generate restore database commands!

This is a feature rich and flexible 'SQL Restore Script Generator' procedure for use in: The inclusion of STOPAT & STANDBY parameters is significant when recovering lost data.

Whats my busiestdatabase? SQL Undercover, sp_restorescript 1.3 Released SQL Undercover, sp_RestoreScript v1.4 Its Now Compatible with Case Sensitive Collations, Accepts Wild Cards in DB Names and Fixes A bug SQL Undercover, sp_RestoreScript 1.5 Release SQL Undercover, sp_RestoreScript 1.6 Release @Credential Added For Backups In Azure BLOB Storage SQL Undercover, sp_RestoreScript 1.7 Released SQL Undercover, sp_RestoreScript 1.8 Now Released SQL Undercover, sp_RestoreScript 1.9 a dirty little bug squished!

, MOVE 'db_workspace_FG2' TO 'D:\SQLData\ReadOptimizedDrive\db_workspace_FG2.ndf' sp_RestoreScript will do all the hard work for you, itll hunt down all the backup files that you need to restore your database to a specific time and present you with a nice, simple script to run based on the parameters that you give it. Performing a Database Restore is a part of a DBA's daily life. This article explains the steps to be followed by the DBA to configure SQL Server 2012 Failover After the successfully installation of SQL Server 2016, I have realized that SQL Server Management Studio 2016 (SSMS) is missing. Python write() and writelines() functions: writing data to a file, Get information about a specific exception in Python.

Changing the path or file name in the Restore As column is equivalent to using the MOVE option in a Transact-SQL RESTORE statement. We love meeting interesting people and making new friends. This is fixed in 1.8. backup, Database, Database Administration, differential backup, full backup, log backup, Microsoft, point in time, restore, SQL, SQL Server. There are no dynamic SQL, #temporary tables or @table variables used, and the script only reads a few backup history tables in msdb. url returned a bad http response code 500, webdriver manager update specify chrome version, Unix remove duplicate lines without sorting.

5. 1 Script will restore to a point in time specified in @RestoreToDate

In a previous life I would routinely have to backup a database and restore it to another server.

0 Script will to last backup before the date\time specified in @RestoreToDate DEFAULT, @WithMoveDataPath In a previous tip on Disaster Recovery Procedures in SQL Server 2005 Part 1, we have seen how we can come up with a disaster recovery procedure in SQL Server 2005.

Moving VMWare Virtual Machines to Synology, How to Find Composite Primary Key Columns in SQL Server, Backup And Restore With Move Curated SQL, Issues When Using Temporary Tables in Nested Stored Procedures, Finding Cluster Log Errors with Powershell, A restore statement with the appropriate MOVE switch. He has worked in a number of different settings and is currently the technical lead at one of the largest software companies in the UK. Fill in your details below or click an icon to log in: You are commenting using your WordPress.com account. The following steps can be used to restore a database, restore data, or move a database from one console to another. DEFAULT: GETDATE(). 1 Databases will be restored WITH REPLACE Get the source code from our GitHub repository,https://github.com/SQLUndercover/UndercoverToolbox/blob/master/sp_restorescript.sql. Read about Paul Brewer's Framework (Version 2) for Database Restore Automation. Once result is retrieved you can review and change the file paths for files before starting the restore on destination server. There are other ways to increase availability of your highly critical database in SQL Server 2005.

(LogOut/ File 'AdventureWorks_Data' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf'. Learn how to eliminate data loss, cut recovery times, and reduce IT complexity. The RESTORE DATABASE command results in errors under the following conditions: The name of the database to restore already exists on the target appliance.

1. Change), You are commenting using your Twitter account.

DEFAULT: original path, @WithMoveLogPath

Inventory 11+ or Deploy 12+ with a Pro or Enterprise license is required to use this feature. indexes Could you please add split backup and restore script by including log backup/restore. Whats the first step?

Managing personally identifiable information when moving databases to unsecure environment can be challenging. Ashish Kumar Mehta is a database manager, trainer and technical author. The drive layouts between the servers are almost never the same. In addition, by using the API together with your preferred scheduling engine, you can build recurrence into the process, so that it runs daily or on demand. Tip: SQL Server database can be restored from the backup (.bak) file.But, the database restore operation may fail if the .bak file is corrupt.

Starting SQL Server 2012 Failover Cluster installation supports Local Disk to be used for TempDB Data and Log files. Connectivity Get Connection Counts by IP and Login, Connectivity Get IP Address and Port for Current Instance, Data Conversion - Check Impact of Converting from NVarchar to Varchar, Data Conversion - Convert Decimal to and from Roman Numerals, Data Conversion - Convert Decimal to Base n, Data Conversion - Convert GPS Decimal to Degree/Minute/Second (DMS) String, Data Conversion - Convert String to Proper Case, Data Conversion - Generate Random Strings, Data Conversion - Get Distance Between 2 Lat/Long Coordinates, Data Conversion - Remove Selected Characters from a String, Data Conversion - Very Fast String Splitter, Data Conversion - Very Fast String Unsplitter (CSV String Creator), Data Deduplication - Identify Items that are not Members of both Sets, Data Deduplication - Quick and Easy Deduping, Data Encryption - Implement RC4 Encryption, Data Formatting - Cleaning and Formatting Phone Numbers, Data Formatting - Dynamic Projection of Columns from a Query, Data Formatting - Enhanced String Trimmer, Data Formatting - Get List of Months or Days, Data Formatting - Output Query Results as HTML, Data Formatting - Quick and Dirty Results Graph, Data Formatting - Strip HTML Tags from a String, Data Formatting - Universal String Padder, Data Formatting Standardise PK and FK Names, Data Partitioning - Get Partition Details, Data Archiving - Hierarchical Data Deletion, Data Archiving - Dynamically Create BCP Format File, Data Archiving - Generate Data Insert Scripts Using Hex Strings to Preserve Data, Data Archiving - Hierarchical Table Listing, Data Archiving/Removal/Strucutre - Move Data from Table to File and Replace with URI, Data Searching - Search all Tables for a String, Data Searching - Search DB for all Code that References a Table, Data Type - Convert all Database Objects to UNICODE, Data Type - Get Column Names and Data Types, Data Type - Check if a String is all Digits, Data Type - Comprehensive Collation Checker, Data Validation - Common REGEX Validation Expressions, Data Validation - Validate Canadian Postal Code, Data/Database Compression - Compress all Tables and Indexes, Data/Database Compression - List Uncompressed Tables and Indexes, Data/Database Compression - Shrink DB Log File, Data/Database Size - Get Data and Log File Sizes, Data/Database Size - Get Database Size and Database Object Counts, Data/Database Size - Get Index Size and Counts, Database Code Objects (Stored Procedures, Functions and Views), Database Mirroring - Create Mirroring Alerts, Database Mirroring - Generate Mirroring Setup Scripts, Database Setup - Moving Database File Location, Date and Time - Create Master Calendar Table, Date and Time - Generating Sequential and Random Date Ranges, Date and Time - Calculate Common Date Ranges, Date and Time - Calculate Easter Sunday Date, Date and Time - Convert Milliseconds to Hours and Minutes String, Date and Time - Get Fiscal Year Ordered Month List, Date and Time - Grouping/Counting by Date, Date and Time - Time Zone Storage and Conversion, Declarative Referential Integrity - Get Foreign Key Columns, Declarative Referential Integrity - Get Primary Key Columns, Declarative Referential Integrity - Generate Commands to Create and Drop FKs, Declarative Referential Integrity - Generate Commands to Create and Drop PKs, Declarative Referential Integrity - Generate Commands to Enable/Disable FKs, Declarative Referential Integrity - Generate Commands to Enable/Disable Triggers, Declarative Referential Integrity - Show Column References, DMV Queries - Get Blocking/Blocked Processes, DMV Queries - Get Comprehensive Running Requests Summary, DMV Queries - Get CPU Utilization for Last 30 Minutes, DMV Queries - Get Currently Running Processes, DMV Queries - Get Disk IO Stats (Detail), DMV Queries - Get Top N Cache Read Queries on Server, DMV Queries - Get Top N Files With I/O Stall, DMV Queries - Get Top N Long Running Queries on Server, DMV Queries - Get Top N Objects Consuming Buffer Memory, DMV Queries - Get Top N Physical Disk Read Queries on Server, DMV Queries - General TempDB and Wait Stats, DMV Queries - Get Average Data/Index Row Size, DMV Queries - Get Comprehensive Connection Summary, DMV Queries - Get Date/Time Table Last Accessed, DMV Queries - Get Disk IO Stats (Summary), DMV Queries - Get Indication of TempDB Usage, DMV Queries - Get Poorly Utilized NonClustered Indexes, DMV Queries - Get Top N Cache Write Queries on Server, DMV Queries - Get Top N CPU Queries on Server, DMV Queries - Get Unused Indexes in a Database, File System - Delete Files Older Than N Days, File System - Check if File Exists Using TSQL, File System - Create Sub-Folder from TSQL, Indexes - Check Whether Update Statistics Required, Indexes - Generate Comands to Create/Drop all Indexes in a Database, Indexes - Generate Commands to Create/Drop Recommended Missing Indexes, Indexes - Identify Full or Partial Duplicate Indexes, List Manipulation - Reorder Items in a List, Maintenance Plan - Get Job Last Run Summary, MSDB - Convert MSDB Job Duration to Seconds, MSDB - Convert MSDB Date and Time INTEGERS to DATETIME, MSDB - Decode MSDB Job Frequency Interval, SQL Agent - Get Progress of currently running SQL Agent jobs, Performance Measurement, Analysis and Optimization, Performance - Search SQL Server Error Log Files, Performance - Get CPU Usage for Last 4 Hours, Performance - Get Database Buffer Cache Size, Performance - Get SQL Server Uptime (and SQLAgent Service Status), Performance - Kill all Orphan Processes on a SQL Server, Performance - Kill all Processes in a Database, Performance - Manage and Retrieve Information from the Default Trace, Performance - SQL Server Profiler - Scheduled Server-Side Recording and Analysis, Reports and SQL Server Reporting Services (SSRS), Report and SSRS - Get Report Cache Policy, Report and SSRS - Get Report Execution Detail, Reports and SSRS - Get Report Data Sources Details (TSQL), Reports and SSRS - Get Report Notifications Summary, Reports and SSRS - Get Report Roles by Report, Reports and SSRS - Get Report Subscriptions, Reports and SSRS - Get List of Report Folders, Reports and SSRS - Get Model Roles by Model, Reports and SSRS - Get Report Data Sources, Reports and SSRS - Get Report Data Sources Details (Stored Procedures), Reports and SSRS - Get Report Execution Summary, Reports and SSRS - Get Report Object Creation and Change Dates, Reports and SSRS - Get Report Parameter List, Reports and SSRS - Get Report Snapshot History, Auto-Create Insert Into Table TSQL Templates, Auto-Create Select from Table TSQL Templates, Auto-Create Select from TVF TSQL Templates, Auto-Create Update each Table TSQL Templates, Generate a descriptive list of SQL Agent jobs, SQL Server DBA/Developer Interview Questions, String Manipulation - Extract Parts of URL String, String Manipulation Get Count of Number of Occurrences of Character in String, String Manipulation - Add Leading Zeros to String, String Manipulation - Alternate String Splitter, String Manipulation - Alternate String Splitter (XML), String Manipulation - Extract Parts of an IPv4 Address, String Manipulation - Get Nth Item From a Delimited String List, String Manipulation - Get Occurences of Character in String. Recently for big databases thought of using split backups. To avoid this, choose a unique database name, or drop the existing database before running the restore.

This script will generate a "RESTORE DATABASE" command with the correct "MOVE" clause, etc. 0 Database wont be restored WITH REPLACE DEFAULT, @NoRecovery If the database being restored does not exist, the user must have CREATE DATABASE permissions to be able to execute RESTORE. The metadata in the msdb database keeps track of all the backup information associated with a database. Especially if the scripts make my life easier. Since the restore statement already had the appropriate MOVE switch provided, I didnt have to manually compose the statement. Change), You are commenting using your Facebook account.

How to Fix PowerShell Execution Policy Error in Windows Server, How to Restore a Full Backup of Database in SQL Server, How to Restore a Full Database Backup in SQL Server Using TSQL Scripts, How to Restore an SQL Server Database Using SSMS, How to Restore an SQL Server Database Using T-SQL Script, How to Restore Full Database Backup in SQL Server, Overwrite the existing database (WITH REPLACE), Permissions Required to Restore Database Backup in SQL Server, Restore a Full Database Backup Using SQL Server Management Studio, RESTORE DATABASE FROM DISK WITH MOVE REPLACE, How to Configure TempDB on Local Disk in SQL Server 2012/2014 Failover Cluster to Improve Performance. Use WITH MOVE to identify a valid location for the file. Any DB without FULL backup will not generate error but will be skipped in result. Use WITH MOVE to identify a valid location for the file. To generate a script to restore all user databases, to the most current point in time possible, from the default backup locations, to the existing data and log file locations - run the procedure with no parameters.

EXECUTE [dbo]. He holds an engineering degree in computer science and industry standard certifications from Microsoft including MCITP Database Administrator 2005/2008, MCDBA SQL Server 2000 and MCTS .NET Framework 2.0 Web Applications. EcmaScript 2022 is officially released, what are the new features?

Change). If the LogsOnly restore option has been selected, this is the date of the first log to be restored. Restoring a database backup from one server to another, or from one database to another on the same machine, often requires MOVE TO commands. ,@StopAt = '2013-01-11 16:56:10' External Temp Tables Preventing Plan Reuse in StoredProcedures.

[sp_RestoreScriptGenie]

Adrian has over 5 years of experience working with SQL server and loves all things SQL, Adrian currently works as a Database Administrator for one of the UKs Largest Software Companies, Create a website or blog at WordPress.com. Disclaimer The sample scripts are not supported under any Microsoft standard support program or service.

Options for LiteSpeed and other 3rd party backups possible. , MOVE 'db_workspace_FG2' TO 'x:\data\db_workspace_FG2.ndf'

This script was fantastic i am using from long time . 'Output is chunked into 4,000 char pieces - look for errant line endings! 1-Last file will be restored with NORECOVERY, leaving the database in restoring state Migrating databases using a 'one time' log shipping technique to minimize downtime, Recoverying lost data by stepping through in STANDBY mode. @RestoreAsName See @PointInTime for usage of @RestoreToDate. Please, no more generating database restore statements by hand!.

This articlel outlines one approach which can be used to Restore the backup of the Production Database a test environment.

With this flexible and extendable solution for scrubbing it, you can save yourself some time and effort.

If you dont have a backup, nothing else matters.

In this article you have seen the steps to restore a database from its full backup. A DBA may need to perform a Restore due to various reasons such as recovery, refreshing a database for testing purpose etc.

Over the last few years, he has also developed and delivered many successful projects in database infrastructure; data warehouse and business intelligence; database migration; and upgrade projects for companies such as Hewlett-Packard, Microsoft, Cognizant and Centrica PLC, UK. WITH MOVE Path to move data files to. , MOVE 'db_workspace_FG1' TO 'x:\data\db_workspace_FG1.ndf'

SQLServerCentral, SQL Server login default database and failedlogins, BlitzFileStats custom module available for InspectorV2, Opening your SQL Backup Folder usingPowershell. This post is part of our series on Database Recovery. ; RESTORE DATABASE db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace.bak' WITH REPLACE, FILE = 6,CHECKSUM,NORECOVERY, STATS=10, MOVE 'db_workspace' TO 'x:\data\db_workspace.mdf', MOVE 'db_workspace_log' TO 'x:\data\db_workspace_log.ldf'

Setting the result to text will help to select all the scripts in one go. I've found this procedure useful in a number of situations such as: http://www.sqlservercentral.com/blogs/robert_davis/2013/01/04/day-3-of-31-days-of-disaster-recovery-determining-files-to-restore-database/ - Guidance on LSN checks included in Version 1.02. http://www.sqlservercentral.com/articles/Backups/93224/ - The article "Importance of Validating Backups" that prompted development of the procedure. Now, not every environment is the same. Following is the script to generate restore statements of multiple databases for their last full backups.

He is constantly shuffling files on his development servers due to space constraints, which in turn breaks the automated restore scripts because the MOVE clauses are invalidated. document.write(d.getFullYear())

He has more than a decade of IT experience in database administration, performance tuning, database development and technical training on Microsoft SQL Server from SQL Server 2000 to SQL Server 2014.

If the database exists, RESTORE permissions default to members of the sysadmin and dbcreator fixed server roles and the owner (dbo) of the database (for the FROM DATABASE_SNAPSHOT option, the database always exists). RESTORE DATABASE db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace.bak' WITH REPLACE, FILE = 4,CHECKSUM,NORECOVERY, STATS=10, MOVE 'db_workspace' TO 'x:\data\db_workspace.mdf', MOVE 'db_workspace_log' TO 'x:\data\db_workspace_log.ldf' Interoperability Database Settings and Restoring. Please visit our GitHub repo from the link above. The procedure is effectively a single SQL query involving repeated calls to a Common Table Expression (CTE). Copy the database backup file you created in Step 2. Connectivity - Unable to Connect - SQL Server or Network Problem? To specify a new restore file, click the text box and edit the suggested path and file name. Which Processes are waiting on aSpinlock? document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ); After working in the motor trade for over 11 years Adrian decided to give it all up to persue a dream of working in I.T.

Restore script there is not able to generate scripts for multiple databases in a single execution. SQL Undercover, sp_RestoreScript 1.9 a dirty little bug squished! -- save each DB script to a separate file using the file name at the top of the section, --**** Define and set parameter values ***, ,@CompatabilityLevel = '130' -- for SQL Server 2016, INSERT @RestoreDatabaseList (DatabaseID, DatabaseName, RecoveryModel), SELECT database_id, name, Recovery_Model_Desc, WHERE name NOT IN ('master','model','tempdb','msdb','reportserver','reportservertempdb', 'distribution'), INSERT @DataFileList (DBFileType, DBFileName), WHERE DB_NAME(database_id) = @DatabaseName, INSERT @RestoreDatabaseResults (ResultText) SELECT '', INSERT @RestoreDatabaseResults (ResultText) SELECT '--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', INSERT @RestoreDatabaseResults (ResultText) SELECT '--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ START SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', INSERT @RestoreDatabaseResults (ResultText) SELECT '-- Save as file name: 050.

var d = new Date() , MOVE 'db_workspace_FG2' TO 'x:\data\db_workspace_FG2.ndf' There is an invalid set of backup files in the backup directory.

Previous messages provide details. v1.3 Command datatype changed to VARCHAR(MAX) We were finding that restores consisting of a large number of backup files were exceeding the old VARCHAR(1000) datatype. Post was not sent - check your email addresses! Don't be shy, get in touch.

Instances get configured differently or things change just due to the nature of the business.

The backup device from where the full database backup will be restored.

Well here at SQL Undercover weve got the solution to all your restoration woes, the latest addition to the Undercover Toolbox, sp_RestoreScript. which attribute can be used to get the size of an array? @Database = 'db_workspace'.

In this tip we will discuss how to download and install SQL Server Management Studio for Introduction In this article, we will take a look at why it is essential to leave AUTO CLOSE database option turned OFF for a Production or a Non-Production SQL Server Database across all versions and editions of SQL Getting Sysadmin Access to SQL Server When Locked Out SQL Server Security is one of the key responsibilities of a Database Administrator. To go off hunting down the relevant full and differential backups and then figure out what transaction logs we need to play in and in what order. However, once youve []. Click here for Microsoft documentation for the RESTORE DATABASE command. Im sure weve all been there, we need to restore a database to 11:34am, four days ago. Every time a backup is taken, SQL Server records the backup activity into the SQL Server backup metadata in the msdb database. ', 'C:\Database\Data\MyDB\system\MyDatabase_system_01', 'C:\Database\Data\MyDB\fgdata01\MyDatabase_fgdata01_01', 'C:\Database\Log\MyDB\Log\MyDatabase_log_01', Scripting Database Restores Curated SQL, Log File Expansion Automation - SQL Server Science, Get Better Help with a Minimal, Complete, and Verifiable Example, or MCVE. The sample scripts are provided AS IS without warranty of any kind.

(LogOut/ @Database = 'db_workspace' Search For Restore Database Recovery.

with REPLACE, KEEP_CDC, RECOVERY, STATS =3 ', Generate restore script for last full backup of multiple databases, Beginners road map to the performance tuning and optimization, Generate VLF report for all databases on a server, List file names in a directory by cmd and file explorer, Backup restore info when msdb history is not available, xp_readerrorlog error: Invalid Parameter Type, Publications of Atif Shehzad on MSSQLTips.com, Atif Shehzad's articles published on MSSQLTips. This might be required following a media failure on the drive hosting the database data files (and assumes current backup history in MSDB), you should always take a tail log backup first if possible before starting to plan restores. We Have Everything You Are Looking For!

There are a few versions of this type of 'Generate a SQL Restore Script' available, examples: The sp_RestoreScriptGenie inclusion of STOPAT & STANDBY mode recovery options differentiate it from other scripts. ,@StopAt = '2013-01-11 16:52:40', RESTORE DATABASE db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace.bak' WITH REPLACE, FILE = 1,CHECKSUM,NORECOVERY, STATS=10, MOVE 'db_workspace' TO 'x:\data\db_workspace.mdf', MOVE 'db_workspace_log' TO 'x:\data\db_workspace_log.ldf', , MOVE 'db_workspace_FG2' TO 'x:\data\db_workspace_FG2.ndf', , MOVE 'db_workspace_FG1' TO 'x:\data\db_workspace_FG1.ndf', ;RESTORE DATABASE db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace.bak' WITH REPLACE, FILE = 2, NORECOVERY, STATS=10, MOVE 'db_workspace' TO 'x:\data\db_workspace.mdf', MOVE 'db_workspace_log' TO 'x:\data\db_workspace_log.ldf', ;RESTORE LOG db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace_log.trn' WITH NORECOVERY, FILE = 2, ;RESTORE LOG db_workspace FROM DISK = 'X:\Backups\Temp\db_workspace_log.trn' WITH NORECOVERY, FILE = 3 ,STOPAT = '2013-01-11 16:52:40', EXECUTE [dbo].