Tuesday, March 27, 2012

DBCC SHRINKDATABASE question

Can this be run on a database that's currently active (lots of people logged
on)?
Ideally, I'd run this out of office hours when no one's connected, but we've
got a serious disk space problem and I'd like to run this now. Any
suggestions/concerns?
Many thanks
GriffA second question if I may relating to truncation.
I have two machines each with SQLServer on it.
Machine 1 has the live databases A, B, C.
Machine 2 has the live databases D, E, F.
Everynight, the databases are backed up, copied onto the other machines and
restored. This is incase we lose a machine and can then switch everyone to
the remaining machine
So, in fact, I have the following
Machine 1 has A, B, C, D', E', F'
Machine 2 has A', B', C', D, E, F.
(where ' denotes the backup copy).
As the live databases are being written to (i.e. not read only), I presume
that the best strategy is to have the following shrink DB commands.
Machine 1
I run shrinkdatabase on A, B, C with the NOTRUNCATE option to prevent the
files from having to expand too much
I run shrinkdatabase on D', E', F' without the NOTRUNCATE option because
these won't be written to as they're not live.
Machine 2
I run shrinkdatabase on D, E, F with the NOTRUNCATE option to prevent the
files from having to expand too much
I run shrinkdatabase on A', B', C' without the NOTRUNCATE option because
these won't be written to as they're not live.
Does this make sense?
Thanks in advance
Griff|||Okay, think I found this answer now on MSDN:
The database being shrunk does not have to be in single user mode; other
users can be working in the database when it is shrunk. This includes system
databases.
Thanks for your time.
Griff

No comments:

Post a Comment