I have a database regularly backed up in a .bak file. Over time this file grows larger and larger taking up a lot spaces. I want to trim it down a little bit by getting rid of some earlier versions of backup within the .bak file. Can I do that and how?
first execute
restore headeronly from disk = 'path_name or backup_device_name'
Execiuting the above query will give you a table with column name "position"
Then check which position you want to take.And then execute the restore like the following
restore database dbname from disk = 'path_name' with file =
1 or 2 or 3 or 4 (depends which one you choose)
Interesting post. Your solution won't work. jieyin doesn't want to RESTORE any of the data at this time. He/She wants to get rid of some of the backup data.
Jieyin,
Can't do it. It's all or nothing. Here's a possible solution:
Let's say you only want to keep one months worth of backups.
-You backup daily to mybackup.bak.
-After two weeks, you rename that file (ex. mybackupold.bak). Then you will have two backup files, mybackupold.bak and mybackup.bak will be recreated with the next backup job.
-After another two weeks, you delete mybackupold.bak and rename mybackup.bak to mybackupold.bak.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.