Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

sql agent JOB to Backup Database and Maintain Backup Files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Prabhat - 30 Jun 2008 20:25 GMT
Hi friends,

How can I create ONE SQL Agent JOB That will 2 activities: (Using SQL
2005)

1) Backup a specified Database (Full Backup) and store the backup file
in a Specified FOLDER.
2) Manage the Backup Files in the FOLDER, ie. Delete the files that
are 5 week OLD.

I want to schedule the JOB to run every Sunday.

I am able to do this using the SQL Server Maintenance Plan and that
creates a Job. But that JOB refers to the maintenance plan package.
Which I dont want to be depended on.

Please suggest.
TheRealRobbie - 01 Jul 2008 08:18 GMT
Hi Prabhat,

Can you explain some more?
Why are you hesitant to use the SSIS maintenance plan?

It should be possible to achieve similar functionality using t-sql backup
commands and using "XP_" stored procedures, but why would you want that??

Regards, Rob

> Hi friends,
>
[quoted text clipped - 13 lines]
>
> Please suggest.
Prabhat - 01 Jul 2008 19:04 GMT
On Jul 1, 12:18 pm, TheRealRobbie
<TheRealRob...@discussions.microsoft.com> wrote:
> Hi Prabhat,
>
[quoted text clipped - 25 lines]
>
> - Show quoted text -

I want the TASKs (both backup and delete old files) to be in ONE place
in a Agent JOB so that I can schedule those.... Also If the TASK will
be in SQL query within a JOB (without reference to package) that will
be easy to manage too (instead of managin the package and JOB, manage
ONLY JOB which has all). Hope I am making it clear :)

Thanks
John Bell - 02 Jul 2008 07:33 GMT
> Hi friends,
>
[quoted text clipped - 13 lines]
>
> Please suggest.

Hi

You can quite easily put the backup command in a job step, if you want to
tailor it to include a date/time in the file name you can use the EXEC
command and create the command by concatentating a string.

For the file deletion you can use the COM filesystem object and use sp_OA*
procedures.

John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.