SQLTeam.com | Weblogs | Forums

Change backup name format

sql2008

#1

Hi..
I just create maintenance backup of my database, and I want to change the format file name of the backup data file name. does anyone can help?

thx


#2

Doesn't sound like Microsoft SQL Server - some other flavour of SQL perhaps?

... or I'm going to learn something new!


#3

it is sql server..we can find it on maintenance plan ..and I have a req. to change the name..

thx


#4

We don''t use Maintenance Plans, never found them fit for purpose, so can't help, sorry.

I think I understand your question better though - you want to change the "template" that generates the filename of the backup file. Don't know if you can do that, but when I did use Maintenance Plans, many years ago, the normal way to "fix anything" was to delete the plan and make a new one ... bit of a nuisance though, but maybe that would work for you ...


#5

You cannot change how the backup task in maintenance plans names the files - that is generated by the task. If you need to specify the file name you will need to script the backup and generate it yourself.


#6

ok..thx


#7

Suggest having a look at Minion Backup, if you are looking for a tool to make backups. Maintenance Plans has, historically, been a very blunt weapon ...


#8

You can use PowerShell to perform this action once the backup completes.

https://msdn.microsoft.com/en-us/powershell/reference/5.0/microsoft.powershell.management/rename-item


#9

Although ... then the maintenance plan won't be able to find the file to delete it (after the retention period expires)


#10

Use the powershell to delete the file as well.


#11

Well ... surely the point of using the Maintenance Plans is that its all self contained, doesn't need a whole lot of testing, and is reliable version-to-version, has no surprises for other/future DBAs, and so on.

Once you start going outside that, renaming files, setting up routines to delete old files, and so on, you have built a hybrid that needs testing and looking after ...

... personally I would either stick with Maintenance Plans or use something different, rather than have to develop and maintain a hybrid.