need a solution to backup if a new database is added

  • Dears,

    I have this porblem to solve:

    Each time a new database is created it has to start a job to backup this new db.

    I dont want to use tiggers.

    Thnaks,

    Hadrian

  • How about polling the sys.databases table (via a SQL Server Agent job) and checking the create_date column based on a specified time frame.

    You could then backup any databases that are return by the initial query.

  • Hadrian, do you want to backup the new database immediately after it is created? If so, why? Or do you want to add it to the list of databases to get backed up regularly as part of a daily process?

  • yes it's a sharepoint farm and they wish to immediteley and automatically the new added database should be dumped starting a backup job.

  • In that case I'd go with the suggestion from "DBA From The Cold" and look into the sys.sysdatabases table for new databases based on the crdate column with a SQL Agent job running however frequently you need it. Remember to ignore tempdb. You could also query the msdb table backupset to check for recent backups for the database.

    select MAX(backup_start_date) from [msdb].[dbo].[backupset] where database_name = 'NewDatabaseNameHere' and type='D'

  • Thanks for your ideeas,but I'm thinking more to use Eventnotifications and Service Broker to start the job immediately.

    Did you some iddeas who could be bring all together?

    Thanks again,

    Hadrian

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply