Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

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

Large auto-job-creation script for adding backups

By Oblio Leitch,

This script creates a stored proc that was intended to run from a trigger on the master..sysdatabases for each database creation. Alas. It will create three jobs for each database you apply it to. First, it'll create a job to run a full backup each Sun, at 5am (see below). Those backups will be retained for four weeks before being replaced. Next, it'll schedule a differential every night Mon-Wed, then a second for Thu-Sat. Finally, there's a trans log backup every three hours; each of which is not overwritten (eight files rotated).

You can edit the time that it's run by setting @timeOfDay, and you'll need to adjust @backupDevice to match your system. Also, there are four items you'll need to run once on your system before creation of the stored proc. The function is intended to be added to the msdb database; be sure to add permissions for 'public'.

This is my first 'professional' submission; I hope it's useful, and I appreciate any feedback/improvements.

Total article views: 366 | Views in the last 30 days: 4
 
Related Articles
FORUM

hoe to stop creating a daily database backup file

stop creating a daily database backup file

FORUM

Failing backup can't create backup

single database backup can't create file

FORUM

backup database

backup database

FORUM

Database Backup

Database Backup

FORUM

database backup

database backup

Tags
 
Contribute