|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Deleting filesHello there
On every week by Enterprise manager i: 1. Detatch the database 2. delete the log file 3. reattaching it again I would like to do this by code. Is there a way to do that? Roy Goldhammer wrote:
> Hello there Yes. Don't. Regularly detaching and deleting the log in an operational> > On every week by Enterprise manager i: > 1. Detatch the database > 2. delete the log file > 3. reattaching it again > > I would like to do this by code. > > Is there a way to do that? system is certainly foolish, unnecessary and/or dangerous. Firstly, set the correct recovery model - that means "Simple Recovery" if you don't require log backups. Secondly, ensure you implement the right tran log backups if you do need them. Finally, set the log file to the right size, turn off autogrow and LEAVE IT ALONE. More info: http://support.microsoft.com/?id=110139 http://support.microsoft.com/?id=317375 http://support.microsoft.com/?id=315512 http://www.karaszi.com/SQLServer/info_dont_shrink.asp -- David Portas SQL Server MVP -- Hi
Why? What you are doing is unsupported and very dangerous. In some cases, you will not be able to re-attach the database again and kiss your DB goodbye. Rather put your database into the appropriate recovery mode, and backup the log if it is not in simple mode. Regards -------------------------------- Mike Epprecht, Microsoft SQL Server MVP Zurich, Switzerland IM: m***@epprecht.net MVP Program: http://www.microsoft.com/mvp Blog: http://www.msmvps.com/epprecht/ Show quote "Roy Goldhammer" <r**@hotmail.com> wrote in message news:OnjYA8GCGHA.4076@TK2MSFTNGP14.phx.gbl... > Hello there > > On every week by Enterprise manager i: > 1. Detatch the database > 2. delete the log file > 3. reattaching it again > > I would like to do this by code. > > Is there a way to do that? > > I agree with David and Mike. Don't do this. It will bite you in the
backside. Show quote "Roy Goldhammer" <r**@hotmail.com> wrote in message news:OnjYA8GCGHA.4076@TK2MSFTNGP14.phx.gbl... > Hello there > > On every week by Enterprise manager i: > 1. Detatch the database > 2. delete the log file > 3. reattaching it again > > I would like to do this by code. > > Is there a way to do that? > > |
|||||||||||||||||||||||