Search code examples
xp-cmdshell

xp_cmdshell error with remote DB connection


I have two VM servers (A&B) loaded with SQL server. I have connected to the remote SQL server on B from server A (node of a clustered SQL server). Can I rename a file on server B using xp_cmdshell over the DB connection?

I am getting the below error message when i try this command exec xp_cmdshell 'RENAME S:\Test\test.txt test1.txt'

Msg 121, Level 20, State 0, Line 0 A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 – The semaphore timeout period has expired.)

Thanks in advance, Joe


Solution

  • Let me answer to my own question and It may useful to someone else too. The issue was not related to SQL server and it was related to network. The server B has different default gateway than server A. Also the server A was using dynamic IP and server B was using static IP. I could rename the file using xp_cmdshell after fixing the above 2 things.

    -Joe