How do I Change The DB\Instance name

  • Lets say the db is know by its sysname. How do I change it to be sysname\instance_name in sql 2005?

  • 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()

     

     

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • 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

  • I have the same problem. I want to rename a named instance. Does anyone know how to do it ? thanks!

  • 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!

  • 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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply