RE: Shrink File?
From: Baisong Wei[MSFT] (v-baiwei_at_online.microsoft.com)
Date: 03/12/04
- Previous message: kozmocat: "MSDE 2000 SP3 Upgrade Failing on Windows 98"
- In reply to: Joshua Campbell: "Shrink File?"
- Next in thread: Joshua Campbell: "Re: Shrink File?"
- Reply: Joshua Campbell: "Re: Shrink File?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Mar 2004 02:13:32 GMT
Hi Joshua,
Thank you for using the newsgroup. It my please to help you with your
issue.
As my understanding of you problem, you have a database with a data file
(.MDF) small (28M) while the LDF huge (7G), you want to shrink the log
file. right?
Based on my experience, it is normal that your log file is much larger that
the data file. For example, when your database is in a full recovery mode
and you use bcp to insert many data into it. All the actions will be saved
in the log file.
There is some ways for you to shrink the log file size.
You can truncate only nonactive portion of the transaction log. If your
transaction log is very big and full, and you want to truncate transaction
log, try the following:
1. Make the full database backup.
2. Set the Truncate Log On Checkpoint database option and then run
CHECKPOINT command from the Query Analyzer.
3. If the transaction log was not truncated, run the DUMP TRANSACTION
command with NO_LOG parameter.
4. If the log was truncated, you can decrease the size of the log file by
using the DBCC SHRINKFILE statement.
If the transaction log was not truncated, and the database have only one
data file, detach the database by using the sp_detach_db stored procedure,
then attach only the data file by using the sp_attach_single_file_db stored
procedure. The transaction log will be recreated automatically with the
small size. This new log file will be about 500KB.
Please refer to some information in the SQL Server Books Online:
'Recovery Mode', 'DUMP TRANSACTION', 'DBCC SHRINKFILE', 'SP_DETACH_DB',
'SP_ATTATCH_SINGLE_FILE_DB'
Hope this helps. If you still have questions, please feel free to post your
message here and I am glad to help.
Thanks.
Sincerely Yours
Baisong Wei
Microsoft Online Support
----------------------------------------------------
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only. Thanks.
- Previous message: kozmocat: "MSDE 2000 SP3 Upgrade Failing on Windows 98"
- In reply to: Joshua Campbell: "Shrink File?"
- Next in thread: Joshua Campbell: "Re: Shrink File?"
- Reply: Joshua Campbell: "Re: Shrink File?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|