0

I'm in the process of migrating a database server, both the new and the old server are on the same network.

Now I want to test the application that uses this database server on my machine which is also on this network. I don't want to turn the old database server off as its still being used by other people but I would like my machine to think it doesn't exist.

Can I just edit my hosts file to achieve this?

Update : My machine is running Windows 7 and the servers are running Windows Server 2008

Basically I want my machine to think that \\OldServername doesnt exist any more and not be able to access it. This should let me see what problems the application has without having to turn the old server off.

Gavin
  • 253
  • 1
  • 2
  • 8

3 Answers3

1

Well you don't mention much in the way of details but yes that should work.

Chopper3
  • 100,240
  • 9
  • 106
  • 238
0

Adding this line to my hosts file (c:\Windows\System32\drivers\etc\hosts) seems to solve the problem

127.0.0.1   sqlServer1

Then to enable the server again just add a # to the beginning of the line

#127.0.0.1  sqlServer1
Gavin
  • 253
  • 1
  • 2
  • 8
  • This is not really a very good solution, because you're not making it think that the server doesn't exist, you're making it think that the server is the same as your current server. There's an important difference. – Mark Henderson Aug 12 '11 at 08:52
  • In this case it does exactly what I needed. If the app tries to connect to the old SQL Server it wont find it and will fail, highlighting any issues. What would you say is the correct solution then? – Gavin Aug 12 '11 at 08:55
  • The biggest issue was for example, both servers use an SQL Default Instance, when it goes to connect to the old service, it will find the new one instead, but think it's the old one. The correct solution is to use a firewall to block all traffic to/from the IP address of the remote server. Sorry, if I'd seen this questionback when you asked it, I would have answered as such. – Mark Henderson Aug 12 '11 at 09:00
-1

Try to add a false route to this host with this command :

route add 192.168.52.5 mask 255.255.255.255 10.99.99.99

(192.168.52.5 = The Server IP, 10.99.99.99 = An IP that don't exists on your network)

Kedare
  • 1,766
  • 4
  • 20
  • 36
  • The command ran ok but it still seems to find the old server. Does it matter that the application accesses the server by servername rather than IP? – Gavin Aug 08 '11 at 14:34
  • 4
    Windows is not going to use the routing table when connecting to the server because the server is on the same subnet, therefore there's no need to query the routing table. Windows is going to ARP for the MAC address of the server. – joeqwerty Aug 08 '11 at 15:35