Redirect SQL connection without changing connection string - sql-server

We have a single SQL server hosting 2 instances. One instance just cannot be upgraded do to legacy software. A separate project is addressing that but is over a year away. The second instance can be upgraded, but there are thousands of Excel workbooks pointing to it for reporting purposes. So in short neither connection string can be changed at this time.
Is it possible to redirect a connection from one instance to another on a second server while keeping the connection strings the same?
I need a connection from SqlServer\Instance1 to stay on that instance while SqlServer\Instance2 goes to SqlServer2\Instance2
Creative solutions may work but need to be rock solid and maintenance light.

I believe what you may be looking for has something to do with tunnels. SQL server configuration manager > SQL Native XX.X Configuration. Here, you can specify alias for instances.
Go nuts!
Please keep in mind that you might need to get your network admin involved if both DNS name are being used at the same time. A local DHCP entry can help you come up with a proof of concept. This tunnel works for instances.

Related

SQL Server connection middleware?

I have an application that cannot be modified that connects to a SQL Server database using a hardcoded connection string with windows authentication.
I need to move the database to another server but as I cannot modify the hardcoded connection string - I am looking for something to act as a local connection that will then relay the query to the remote database and return the result back to the app.
The only other way I can see to do this is to upgrade from SQL Server Express and use database replication but that will be expensive option for what I need.
Can anyone suggest any software to do this or recommend an alternative method?
Thanks
Update:
The connection string also uses Windows authentication which will not work on the remote server.
If your workstations don't need access to the old server, you could perhaps solve this with DNS, using a cname record to point the old server name to the new. If you can't do this organization wide, you might be able to use entries in the hosts file on the impacted workstations.
I just saw this in the comments:
the database server is the same machine where the app runs (ie, 'localhost')
In that case, you want to figure out what the connection string is using, and the hosts entry should be able to accomplish this.
In old server you can define linked server, pointing it to new one and create queries to link to remote tables; you can use different credentials for it. You may get some performance problems (esp update statements may slow down).

Moving SQL Server from one datacenter to another datacenter

I am working on to find some workaround for moving SQL Server 2005/2008 instances from one data center to another data center without changing database configuration settingĀ at application end because application team is not sure what all places server name and database name is hardcoded. I know this is bad practice but application is developed by third party and we don't have control on application code.
So challenge here is to keep the server name and database name and IP is same.
Note : OS is not supporting for Image Backup so this option is ruled out.
Please let me know your thought.
Thanks,
Venkat.

When connecting to SQL Server what are the values for the datasource?

Basically I'm developing a website using ASP.NET MVC4, when creating a model, I need to establish a connection to the database first
When I selected the database name 7CH3LM1 (default in the drop down list), it said:
cannot connect to the database
but when I wrote like 7CH3LM1\SQLEXPRESS, it let me through
That reminded me of a question: what's the real difference behind that? what's the meaning of 7CH3LM1 and what's the point adding the SQLEXPRESS?
Any ideas are very welcomed!
7CH3LM1 is your machine name, and it helps identify the instance of SQL Server you're connecting to. In this case, you are connecting to a named instance of SQL Server running Express Edition, and its instance name is SQLEXPRESS. A machine can run multiple instances of SQL Server concurrently, and it can have one default instance and 0, 1 or multiple named instances. To connect to the default instance, you would use 7CH3LM1, and to connect to a named instance, you would use 7CH3LM1\<instance name>, as you have with 7CH3LM1\SQLEXPRESS.
I typically rename my machines to something a little more memorable and meaningful, as that can make things much easier, but that's just me.
An instance of SQL Server can contain many databases. You can specify the database in your connection string as well (recommended), or you can rely on your login's default database to define initial context (not recommended, since that database could be offline, single user, detached, etc. - which will affect your ability to log in).
Ultimately, your software will need both an instance and a database in order to read / write data.
You're talking about an INSTANCE name. Multiple instances of SQL servers can exist on the same machine. If you do not specify the instance, you will connect to the DEFAULT instance of SQL server on the machine (which may or may not exist.) When you do specify one (after the "\"), it's known as a NAMED instance.
You can read more about instances, here: msdn.microsoft.com/en-us/library/hh231298.aspx
In summary, syntax for selection of instance on MSSQL servers is expressed as
SERVERNAME\INSTANCENAME
or for the DEFAULT instance:
SERVERNAME
And, personally, I think the docs for SQL 2000 are much easier to read about DEFAULT vs. NAMED instances. You can find them here: http://msdn.microsoft.com/en-us/library/aa174516(v=sql.80).aspx

App fabric without SQL Server whatsoever

I got VPS with limited memory and my WCF service is hosted using AppFabric.
Since memory is limited and I am not using SQL server for anything other than AppFabric prerequisite im thinking about uninstalling SQL Server. (instance can eat up to 200mb memory at times). I am not using any DB related features of AppFabric like dashboard or caching. I like IIS extensions and simplicity for WCF service manipulations however, and I am thinking those do not require Sql Server actually.
I am unable to just try it out so wonder if someone has such experience, or can predict result of uninstalling SQL server on appfabric behaviour.
Instead of uninstalling SQL Server you could just stop the SQL Server process. Set the process to manual startup.
That way if you need SQL Server in the future you can just start the process.
As #Shiraz Bhajiji illudes to if you are using SQLServer as the configuration store, you will need to reconfigure it to use file based configuration instead, it sounds like you are only using a single AppFabric instance, but if you are or needed to use multiple instances the config file would need to be accessible to all instances.
Again it isn't necessarily relevant to you, but if you have multiple app fabric instances, the sql server configuration option is a much more robust approach. With the file based approach, if you configure things incorrectly one app fabric node going down can take down the entire cluster. The SQLServer approach does represent a single point of failure however, if you are using clustering etc you can easily mitigate this. Again I appreciate I'm getting a little off topic here.

Redirecting Database Queries to another Server

I have to move a production SQL Server database onto another server soon, and I'm keen to catch any little programs which have been written by hard coding the server name into them. I have only recently inherited the system, and there seem to be a lot of Excel files scattered around connecting in using ODBC connections.
My initial thought was to find something that redirected any SQL server requests for a particular database to the new server, but I'm not aware of any such beastie. Anyone know if such a thing exists?
Ideally, it should redirect at server level and log the source so that I can go and change it to point to the new one.
If the server name is hard coded, why not give the new server the same hostname? If it's listed in DNS set the TTL to a very low value now (2 minutes) and then when the changeover happens the downtime of moving the actual database files across will help smooth over the transition.
Alternatively you can be evil, turn the other server off and force people to fix their apps when stuff breaks - which method you choose is down to your sysadmin style.
The SQL Server Client Network library supports aliases and redirects, see How to: Create a Server Alias for Use by a Client (SQL Server Configuration Manager). The alias is global for the client machine though, meaning all applications on the client host machine will obey the alias redirect.

Resources