July 29, 2013 at 11:13 pm
I want to know that can we shrink database file with EMPTYFILE option while currently accepting data or we just need to do some other thing to shrink database file with EMPTYFILE option..
July 30, 2013 at 3:15 am
NO.. Because will never allow this operation, it leads to data loss.
Confirm whether your is database is partitioned or not. If database is partition we can empty the file while shrinking the db.
July 30, 2013 at 4:27 am
writearjun53 (7/29/2013)
I want to know that can we shrink database file with EMPTYFILE option while currently accepting data or we just need to do some other thing to shrink database file with EMPTYFILE option..
Sure you can, there's nothing about that option that requires any portion of the database to be read only or quiesced to do a shrinkfile.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 30, 2013 at 4:28 am
saran.dharsh (7/30/2013)
NO.. Because will never allow this operation, it leads to data loss.
Err.. what? Shrinking a database doesn't lose data.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 30, 2013 at 6:41 am
@gilamonster..Thanks for your reply, Now i just need to confirm that what option we should use for shrink database file with EMPTYFILE option?
1. Shirnk database file with EMPTYFILE option while currently data accepting
2. first we change database mode from multiple user mode to single user mode then shirnk database file.
Which one is the best way to do this activity 1 or 2 ?
July 30, 2013 at 6:49 am
There is no requirement that a DB be in single user mode or quiesced to do a shrink file.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 30, 2013 at 6:50 am
When you specify the EMPTYFILE clause to DBCC SHRINKFILE the database engine stops writing new data into the file and all existing data is moved out.
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
July 30, 2013 at 6:53 am
Thanks all of you for clearing my doubts
July 30, 2013 at 3:58 pm
GilaMonster (7/30/2013)
There is no requirement that a DB be in single user mode or quiesced to do a shrink file.
That's true but it makes it a heck of a lot easier to "rebuild" the log file (change the VLFs) by shrinking it to 0 and regrowing it. Of course, you either have to do a full or diff backup to get back to Point-in-time backups if they were being taken.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 30, 2013 at 4:30 pm
Jeff Moden (7/30/2013)
GilaMonster (7/30/2013)
There is no requirement that a DB be in single user mode or quiesced to do a shrink file.That's true but it makes it a heck of a lot easier to "rebuild" the log file (change the VLFs) by shrinking it to 0 and regrowing it.
Which is kinda unrelated to the OP's question on shrinking a data file
Of course, you either have to do a full or diff backup to get back to Point-in-time backups if they were being taken.
Err, no. Shrinks on the log file don't break the log chain.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 30, 2013 at 6:08 pm
GilaMonster (7/30/2013)
Jeff Moden (7/30/2013)
GilaMonster (7/30/2013)
There is no requirement that a DB be in single user mode or quiesced to do a shrink file.That's true but it makes it a heck of a lot easier to "rebuild" the log file (change the VLFs) by shrinking it to 0 and regrowing it.
Which is kinda unrelated to the OP's question on shrinking a data file
Of course, you either have to do a full or diff backup to get back to Point-in-time backups if they were being taken.
Err, no. Shrinks on the log file don't break the log chain.
Ok, I'm embarrassed. For some reason I looked at "single user mode" and saw the word "simple" as in "simple recovery mode". My apologies for the interuption.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply