how to shrink database
Posted on 2013-01-30
I have 100gb SQL 2005 database FULL RECOVER MODE and trying to shrink data size by purging some records.
1. I have to DB live and test. Test database is a copy of live data restored to different file names. however logical name is the same for both.
BACKUP LOG TEST WITH TRUNCATE_ONLY
DBCC SHRINKFILE( Test_log Data, 2)
log files are getting truncated
when I do QUERY ON MY TEST DB
delete from my_table
truncate MY TABLE
DBCC SHRINKFILE(LIVE_DATA, 3)
What is the safe and proper way to shrink DB