How do I detach and attach a database in SQL Server 7? The idea is to erase
the humongous log file and this is how I do it in 2000.
Hi,
It is not rquired to detach and attach the database to shrink the file.
Follow the below steps:-
1. backup the Transaction log
Backup log <dbname> to disk='d:\backup\dbname.trn'
2. If the log file really huge make the databse single user after removing
all users connected to database
sp_dboption 'dbname','sinle user',true -- for SQL 2000 you could use
ALTER DATABASE <dbname> set single_user with rollback immediate
3. Shrink the Transaction log file
DBCC SHRINKFILE('Logical_ldf_name','truncateonly'
4. After this see the log size by using
DBCC SQLPERF(LOGSPACE)
5. Now turn back the database to multi user
sp_dboption 'dbname','sinle user',false -- for SQL 2000 you could use
ALTER DATABASE <dbname> set multi_user
Thanks
Hari
MCDBA
"Sergio Florez M." <sergioflorezm@.hotmail.com> wrote in message
news:#GmetWBaEHA.4092@.TK2MSFTNGP11.phx.gbl...
> How do I detach and attach a database in SQL Server 7? The idea is to
erase
> the humongous log file and this is how I do it in 2000.
>
|||Doesn't this only truncate the file though? It really won't make much of a
difference. The reason I asked for a way to detach - attach is because this
way I can start with a brand new log file thus freeing 4GB in my hard drive.
"Hari Prasad" <hari_prasad_k@.hotmail.com> escribi en el mensaje
news:efrkEcBaEHA.4048@.TK2MSFTNGP10.phx.gbl...
> Hi,
> It is not rquired to detach and attach the database to shrink the file.
> Follow the below steps:-
> 1. backup the Transaction log
> Backup log <dbname> to disk='d:\backup\dbname.trn'
> 2. If the log file really huge make the databse single user after removing
> all users connected to database
> sp_dboption 'dbname','sinle user',true -- for SQL 2000 you could use
> ALTER DATABASE <dbname> set single_user with rollback immediate
> 3. Shrink the Transaction log file
> DBCC SHRINKFILE('Logical_ldf_name','truncateonly'
>
> 4. After this see the log size by using
> DBCC SQLPERF(LOGSPACE)
> 5. Now turn back the database to multi user
> sp_dboption 'dbname','sinle user',false -- for SQL 2000 you could use
> ALTER DATABASE <dbname> set multi_user
> Thanks
> Hari
> MCDBA
> "Sergio Florez M." <sergioflorezm@.hotmail.com> wrote in message
> news:#GmetWBaEHA.4092@.TK2MSFTNGP11.phx.gbl...
> erase
>
|||Hi,
Can you go thru this article and try shrinking the LDF file based on steps
mentioned.
http://www.support.microsoft.com/?id=256650
Thanks
Hari
MCDBA
"Sergio Florez M." <sergioflorezm@.hotmail.com> wrote in message
news:OmZtgzBaEHA.212@.TK2MSFTNGP12.phx.gbl...
> Doesn't this only truncate the file though? It really won't make much of a
> difference. The reason I asked for a way to detach - attach is because
this
> way I can start with a brand new log file thus freeing 4GB in my hard
drive.[vbcol=seagreen]
> "Hari Prasad" <hari_prasad_k@.hotmail.com> escribi en el mensaje
> news:efrkEcBaEHA.4048@.TK2MSFTNGP10.phx.gbl...
removing[vbcol=seagreen]
use
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment