There are many threads on this here. Most of them not at all helpful and some of them wrong. Thus a fresh post.
This post regards SQL Server 2008 (10.0.5841)
- The PUBLISHER database primary log file which is currently of 3 blocks and not extendable,must be moved as the LUN is going away.
- The database has several TB of data and a large number of push transactional replications as well as a couple of bi-directional replications.
- While the primary log file is active, it is almost never (if ever) used due to its small fixed size.
- We are in the 20,000 TPS range at peak (according to perfmon). This is a non-trivial installation.
This means that
- backup/restore is not even a remotely viable option (it never is in the real world)
- downtime minimization is critical - measured in minutes or less.
- dismantling and recreating the replications is doable, but I have to say, I have zero trust in the script writer to generate accurate scripts. Many of these replications were originally set up in older versions of SQL Server and have come along for the
ride as upgrades have occurred. I consider scripting everything and dismantling the whole lot pretty high risk. In any case, I do not want to have to reinitialize any replications as this takes, effectively, an eternity.
Possible solution:
The only option I can think of is to wind down everything, such that there are zero outstanding uncommitted transactions and detach the database, delete the offending log file and reattach using the CREATE DATABASE xyz ATTACH_REBUILD_LOG option.
This should, if I have understood things correctly, cause SQL Server to recreate the default log file in the same directory as the .mdf file. I am not sure what will happen to the secondary log file which is not moving anywhere at this point.
The hard bit is insuring that every transaction in the active log files have been replicated before shutdown. This is probably doable. I do not know how to manually flush any left over transactions to replication. I expect if I shut down all "real" activity and wait for a certain amount of time, eventually all the replications will show "No replicated transactions are available" and then I would be good to go.
Hillary, if you happen to be there, comments appreciated.