Solved

SQL Server 2012 backups

Posted on 2015-01-27
5
87 Views
Last Modified: 2015-01-28
I am running a backup nightly but it saves multiple positions for each night. The size of the bak is now 121 GB. Can I  limit it to 5 last  instances?
 
Here is the script:

BACKUP DATABASE databasename
TO DISK = 'D:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\databasename.bak'
 
Thank You
0
Comment
Question by:jem1662
5 Comments
 
LVL 24

Assisted Solution

by:Mohammed Khawaja
Mohammed Khawaja earned 167 total points
ID: 40573921
What I recommend for you to do is add -init to your script and it will overwrite.  If you are backing up the backups each night then you just need the last one.  By any chance if you want to keep just the last five then I suggest you change it to keep the last seven by running a batch file once a week to rename the file to something else.
0
 

Author Comment

by:jem1662
ID: 40573933
Thank You.  I will try it.
0
 
LVL 45

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 166 total points
ID: 40574678
What I recommend for you to do is add -init to your script and it will overwrite
Be careful with this recommendation. If you do that you'll only have the last backup and you can't recover nothing before that day.

What you should do is a complete backup plan, i.e. backing up the databases and move old backup files to a safe place (another media in another location) so you can free space and keep old backups in the case you need them in the future.

Also, why are you having a single file to backup all databases? Recommendation is one file per database.

Please review your backup plan.
0
 
LVL 29

Accepted Solution

by:
Rich Weissler earned 167 total points
ID: 40575044
Concur with Vitor Montalvão.  While considering changing to your backup implementation, I can say that the Maintenance Plans built by the wizard will follow this recommendation.  If the Maintenance Plan capabilities in SQL is not to your liking, you can also look at Ola Hallengren's solution.

Consider also what would happen if the hard disk volumes were to become unavailable.  Are your backups to disk then backed up to tape, or to alternate storage?
0
 

Author Closing Comment

by:jem1662
ID: 40575060
Thank You all for the input.  We do one file per database.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now