April 14, 2008 at 8:27 am
is this difficult to do?
for every new database that is added, then a backup job is created automatically?
take every new database 'name' from sysdatabases, and somehow pass that into
a backup script.
let this run once a day; say at 11pm, and that should cover creating a basic backup
job.
i don't know how to do this exactly... any pointers? would i need to create a cursor
for starters?
forgive me if this is a stupid question.
April 14, 2008 at 8:34 am
If you created a maintenance plan for "All User Databases", it would pick up any newly added databases.
As an alternative, I suppose you could create a trigger that created a SQL agent job.
April 14, 2008 at 8:52 am
phew... 🙂
maintenance plan... what a time saver.
thanks!
April 14, 2008 at 11:46 am
If you would like to do the same with T-SQL I have a stored procedure that could help you.
http://ola.hallengren.com/sql-server-backup.html
Ola Hallengren
April 14, 2008 at 1:56 pm
With 2005 DDL triggers you could use a Server scoped trigger on Create Database to create a job to backup that database. I have not done this, but it could be done.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 14, 2008 at 2:53 pm
Or, better yet, just write your backup job to walk through sys.databases, and backup every online user database.
Eddie Wuerch
MCM: SQL
April 14, 2008 at 3:11 pm
This is just how my backup stored procedure works. You just use it like this.
EXECUTE dbo.DatabaseBackup @databases = 'USER_DATABASES', @Directory = 'C:\Backup', @BackupType = 'FULL', @verify = 'Y', @CleanupTime = 24
http://ola.hallengren.com/Documentation.html
Ola Hallengren
April 17, 2008 at 9:46 am
cool. DDL Triggers are really handy.
i'm putting together all kinds of automation now.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply