SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How do I Change The DB\Instance name


How do I Change The DB\Instance name

Author
Message
Greg Paul
Greg Paul
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 1
Lets say the db is know by its sysname. How do I change it to be sysname\instance_name in sql 2005?
colin.Leversuch-Roberts
colin.Leversuch-Roberts
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12521 Visits: 715

you can rename the database , but a fully qualified database is known by instancename/database name anyway.

select convert(varchar(128),serverproperty('instancename'))

select @@servername

select convert(varchar(128),serverproperty('machinename'))

e.g.

instance102

myserver\instance102

myserver

add to the database name as required e.g.

select convert(varchar(128),serverproperty('instancename'))+'_'+db_name()



The GrumpyOldDBA
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (25K reputation)

Group: Moderators
Points: 25518 Visits: 1917
Are you wanting to rename an individual database or the SQL Server itself? If the latter, are you trying to make a default instance a named instance?

K. Brian Kelley
@‌kbriankelley
wenjia.song
wenjia.song
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 9
I have the same problem. I want to rename a named instance. Does anyone know how to do it ? thanks!
Lowell
Lowell
SSC Guru
SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)SSC Guru (74K reputation)

Group: General Forum Members
Points: 74379 Visits: 40977
you cannot rename an instance, it has to be uninstalled and a new instance with the correct name needs to be created. that means backing up non-system databases, and then restoring them in the new instance.



I haven't seen a registry hack or anything that successfully changed an instance name yet.







for example, if you had SERVER\SQL2005 as an instance, and you wanted to rename the \SQL2005 for any reason, you have to uninstall the instance, and add the new one (ie SERVER\DEVELOPER



if you rename the server, it will automatically change to NEWSERVERNAME\SQL2005

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)

Group: General Forum Members
Points: 100431 Visits: 33014
Create the new instance, copy & attach all the databases, drop the old instance.



It is a pain in the tucas.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search