need script for backup databases?

Need a script to take a backup for daily of required database and want to delete the two days backup files, after taking the third day backup....
more ▼

asked Sep 20, 2012 at 11:15 AM in Default

narendba gravatar image

580 31 40 46

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first
I'd suggest just using the Maintenance Plans. You're requirements are very simple and straight-forward, so you don't need a sophisticated script to take care of them. The Maintenance Plans will do exactly what you need with minimal work.
more ▼

answered Sep 20, 2012 at 11:54 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

(comments are locked)
10|1200 characters needed characters left

As Grant mentioned, Maintenance Plans will work just fine, however if you would prefer something codish, I would suggest checking out Ola Hallengren's Maintenance Solution. You can find the URL below.


Just another option.

Hope this helps!
more ▼

answered Sep 20, 2012 at 12:10 PM

JohnM gravatar image

6.9k 1 3 7

No arguments. Ola's scripts are great. I just find them to be like swatting flies with JDAMs if you don't have fairly sophisticated requirements. Gets the job done, but...
Sep 20, 2012 at 12:13 PM Grant Fritchey ♦♦
Use them myself... but the learning curve can be a little steep for newbies :)
Sep 20, 2012 at 12:29 PM Blackhawk-17

No arguments here. Just was throwing it out there as an option. The OP can decide what is best for their environment/skill level. ;-)

Sep 20, 2012 at 12:54 PM JohnM
That one is great but i'm poor on segrigating the script... Can anyone please post a exact script for taking the backups...
Sep 20, 2012 at 03:52 PM narendba
For those that dont know (like me) - JDAM == http://en.wikipedia.org/wiki/Joint_Direct_Attack_Munition
Sep 22, 2012 at 03:22 PM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left

Maintenance plans are good & easy to start with they are actually SSIS package, you have the right tools there to do stuffs like backup, notification, older File delete and the list goes. Also, it alllows you to generate the scripts for the plans you created.... But again scripts provides you greater flexibility, but should be error free. :-)

more ▼

answered Sep 20, 2012 at 04:08 PM

Cyborg gravatar image

10.6k 36 40 45

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Sep 20, 2012 at 11:15 AM

Seen: 474 times

Last Updated: Sep 22, 2012 at 03:22 PM