Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

T-Log Backup/Restore with Date & Time

By S. Kusen,

Recently, I have been moving a lot of VLDB's onto new SQL Server environments. One method (of many) is to restore the full backup to the new system, and then incrementally restore log backups in sequence.

One way to lessen confusion would be to name the log backups to include the date and time to prevent overwriting the files, and hopefully make it less confusing as you proceed with the DB move, which is what this script tries to accomplish.

What I have been doing for my recent migrations is backup the log every 4 hours, and as I get closer to the maintenance window, I'll lower the frequency down to 1 hour, and then down to 15 minutes; I restore each log on the new system as they are backed up. Using the backup script provided, it will dynamically update the file names as you change the schedule of the SQL Server Agent job. At the time of the cutover, the last 15 minute log backup is quick to restore.

There are obviously ways to automate these scripts even more, but this method has helped me out a lot recently.

To start using this, make sure you've set the database to FULL recovery model and have already taken a full database backup after changing the recovery model, and then restored that backup to your new host.

To use, change the path of the location for your backups, and change YourDBNameHere to the name of your database to backup the log.

 

As always, thanks for checking out my scripts.

 

Cheers,

Steve

Total article views: 1300 | Views in the last 30 days: 5
 
Related Articles
SCRIPT

Backup & Restoration Script

This script provides very useful information about database backup and restoration.

SCRIPT

Script to Restore Entire database from a directory

Script to restore the entire databases from the backup directory just by passing the backup director...

FORUM

Script to restore red gate backups automatically from a folder.

Restore of red gate backup files using a SQL Script

FORUM

How to change table owner when restoring database?

Changing table owner during restoring database

SCRIPT

Restore All Backups

SCRIPT TO RESTORE BACKUP FOR ALL DATABASES, PLACED IN FOLDER CALLED ORIGIN_FOLDER, WITH THE INITIAL...

Tags
backup / restore    
log    
restore    
restores    
transactions    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones