dbTalk Databases Forums  

Server 2005 backup using 'Script Action to Job'

microsoft.public.sqlserver.server microsoft.public.sqlserver.server


Discuss Server 2005 backup using 'Script Action to Job' in the microsoft.public.sqlserver.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
wc
 
Posts: n/a

Default Server 2005 backup using 'Script Action to Job' - 10-07-2009 , 09:48 PM






Hello,
I'm using the page http://support.microsoft.com/kb/930615 tutorial to
schedule a daily backup on my database.

Backup works fine, and I'm able to restore from the backup file. However
since it is a daily backup, I prefer the backup file name as 'xxx-<date>'
instead of 'xxx'.

How can I archive that?

The command of Job is as following:
BACKUP DATABASE [xxx] TO DISK = N'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Backup\xxx' WITH NOFORMAT,
INIT, NAME = N'xxx-Full Database Backup test', SKIP, NOREWIND, NOUNLOAD,
STATS = 10
GO

Thanks in advance.

Reply With Quote
  #2  
Old   
Abba
 
Posts: n/a

Default Re: Server 2005 backup using 'Script Action to Job' - 10-08-2009 , 02:28 AM






DECLARE @cmd nvarchar (255)

SET @cmd ='
BACKUP DATABASE [xxx] TO DISK = ''C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Backup\xxx-' + convert(varchar(16), getdate(),112)+
'.bak''
WITH NOFORMAT, INIT, NAME = N''xxx-Full Database Backup test'', SKIP,
NOREWIND, NOUNLOAD, STATS = 10
'
Print @cmd
EXECUTE sp_executesql @cmd


"wc" <wc (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,
I'm using the page http://support.microsoft.com/kb/930615 tutorial to
schedule a daily backup on my database.

Backup works fine, and I'm able to restore from the backup file. However
since it is a daily backup, I prefer the backup file name as 'xxx-<date>'
instead of 'xxx'.

How can I archive that?

The command of Job is as following:
BACKUP DATABASE [xxx] TO DISK = N'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Backup\xxx' WITH NOFORMAT,
INIT, NAME = N'xxx-Full Database Backup test', SKIP, NOREWIND, NOUNLOAD,
STATS = 10
GO

Thanks in advance.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.