May 14, 2018 at 7:40 am
We had one of our database server which was moved to AWS couple of months ago. Old server was prod5 and the server in AWS is prod5t. What happens is I connect to prod5t but when I run select @@SERVERNAME, it shows me prod5 and not prod5t. Prod5 hasn't been decommissioned yet so it is still running but there is no activity. Will I have to change the server name? Am I not connecting to prod5t?
May 14, 2018 at 8:10 am
NewBornDBA2017 - Monday, May 14, 2018 7:40 AMWe had one of our database server which was moved to AWS couple of months ago. Old server was prod5 and the server in AWS is prod5t. What happens is I connect to prod5t but when I run select @@SERVERNAME, it shows me prod5 and not prod5t. Prod5 hasn't been decommissioned yet so it is still running but there is no activity. Will I have to change the server name? Am I not connecting to prod5t?
Check what the server name property which would be the network name of the server:
SELECT SERVERPROPERTY('ServerName')
You can query one of the DMVs to see if you are connected - take a quick look at sys.dm_exec_sessions or sys.dm_exec_connections
Sue
May 14, 2018 at 8:25 am
Sue_H - Monday, May 14, 2018 8:10 AMCheck what the server name property which would be the network name of the server:SELECT SERVERPROPERTY('ServerName')
SELECT SERVERPROPERTY('ServerName') shows prod5t. So just curious is to why select @@servername shows prod5?
May 14, 2018 at 9:59 am
NewBornDBA2017 - Monday, May 14, 2018 8:25 AMSue_H - Monday, May 14, 2018 8:10 AMCheck what the server name property which would be the network name of the server:SELECT SERVERPROPERTY('ServerName')
SELECT SERVERPROPERTY('ServerName') shows prod5t. So just curious is to why select @@servername shows prod5?
It's seen as the old server name by SQL Server. You should be able to see the old name in sys.servers as well: SELECT name
FROM sys.servers
WHERE server_id = 0
To rename it, you would just need to execute: sp_dropserver 'old_name'
go
sp_addserver 'new_name', 'local'
go
Make sure to add 'local' at the end when changing to the new name.
Sue
May 14, 2018 at 10:08 am
Sue_H - Monday, May 14, 2018 9:59 AMTo rename it, you would just need to execute:
sp_dropserver 'old_name'
go
sp_addserver 'new_name', 'local'
goMake sure to add 'local' at the end when changing to the new name.
Sue
Do I have to restart SQL Server services?
May 14, 2018 at 10:28 am
NewBornDBA2017 - Monday, May 14, 2018 10:08 AMSue_H - Monday, May 14, 2018 9:59 AMTo rename it, you would just need to execute:
sp_dropserver 'old_name'
go
sp_addserver 'new_name', 'local'
goMake sure to add 'local' at the end when changing to the new name.
Sue
Do I have to restart SQL Server services?
Yup. All should be fine after that.
Sue
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply