sql server 2000 one of most powerful and easy to use database application. It’s nicely handle giga size data. Unfortunately the growth of the log file can be very frustrating. Sometimes there’s a certain difficulty when we want to shrink the log file, mainly because the database still running a process.
usually we can use the syntax like this on the query analyzer:
1 |
DBCC SHRINKDATABASE ([mydatabase]) |
but, often end up with an error message like this:
cannot shrink log file 2 ([mydatabase])) because all logical log files are in use
to overcome this problem , we have to force the shrink method, make sure there isn’t any active transaction.
1 |
DBCC OPENTRAN (mydatabase) |
then, the fun part:
1 2 |
BACKUP LOG [mydatabase] WITH TRUNCATE_ONLY DBCC SHRINKFILE([mydatabase_log], 100) |
done!
note:
[mydatabase_log] is your log file
100 is the size of the log file that you want
it works when i have to shrink a sharepoint portal database , because it’s eat up my server harddrive for 60 GB.