question

Fatherjack avatar image
Fatherjack asked

Does mirroring prevent log file shrinks?

I have a database that is mirrored and has a lot of VLFs so I want to shrink and resize the logfile to reduce this. Being a cautious DBA I wasnt sure how the mirroring might affect (or be affected by) this process so I have taken a trivial database on a test server and mirrored it. I am now trying to execute DBCC SHRINKFILE and I'm getting a weird error. USE [AUTOINDEXRECS] GO SELECT name , [df].[type_desc] FROM [sys].[database_files] AS df go DBCC SHRINKFILE (N'AUTOINDEXRECS_log' , 0, TRUNCATEONLY) GO give results of: name type_desc ----------------- ----------- AUTOINDEXRECS ROWS AUTOINDEXRECS_log LOG > (2 row(s) affected) > Msg 8985, Level 16, State 1, Line 1 > Could not locate file `AUTOINDEXRECS_log` for database 'AUTOINDEXRECS' in `sys.database_files`. The file either does not exist, or was dropped.
mirroringshrink-log-file
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fatherjack avatar image Fatherjack ♦♦ commented ·
As @Kev Riley correctly points out, BOL says that the TRUNCATEONLY parameter is only effective on Data Files. However, if I substitute TRUNCATEONLY with an integer larger that the minimum size the log requires the error remains the same.
0 Likes 0 ·

1 Answer

·
Kev Riley avatar image
Kev Riley answered
From [BOL][1] > TRUNCATEONLY is applicable only to data files [1]: http://msdn.microsoft.com/en-us/library/ms189493.aspx
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
HA! To be fair I hadn't ACTUALLY tried running it, I was away from SQL for a while (shudder). Ran it fine on a non-mirrored db.... so you win :(
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.