We’re using a simple File.Copy in C# for moving our database backups to extra locations.
However on some servers, this causes the SQL server to pretty much stop working. These servers have very limited memory, so they’re paging data out to the harddrive every so often.
Whilst we should buy more memory, this is not going to happen for a long time :-/
So I’m wondering if I can somehow limit the speed of the File.Copy operation ? (Thereby giving the SQL server some room to access the harddrive)
I could use an “old school” approach with two streams, reading and writing through a buffer, and just sleep 5 ms or so between reads. But I’d really prefer a neater solution, if such a one is available.
CopyFileEx might do what you need – it has a callback function that you could use as an artificial
slowing method(haven’t tried that for this scenario though so I am unsure about real effects – worth a try IMHO).