Changing Database Name But need to Alias the Old Name, Possible?

  • I administer a SQL2008 server, the server is being handed over to another dept to manage, they are moving over all the databases and maintaining all roles etc. Once the migration is done the old server will retired, the new server will be renamed and given the same IP address as the old replacing it.

    The new server owners want to rename one of the databases. This will require a "lot" of work fixing applications that connect to this DB.

    If they rename this DB, is there a way one could create an alias with the old DB name and redirect that to the DB that was renamed , in effect having this new DB be accessible with the new name and the old (aliased) name? This should be done on the SQL server itself, we dont want to have to edit config files and hunt down every where the DB name was hard coded.

    No looking for a server alias or linked server, but a DB name alias.

    thanks!

  • EthanZ (2/5/2013)


    I administer a SQL2008 server, the server is being handed over to another dept to manage, they are moving over all the databases and maintaining all roles etc. Once the migration is done the old server will retired, the new server will be renamed and given the same IP address as the old replacing it.

    The new server owners want to rename one of the databases. This will require a "lot" of work fixing applications that connect to this DB.

    If they rename this DB, is there a way one could create an alias with the old DB name and redirect that to the DB that was renamed , in effect having this new DB be accessible with the new name and the old (aliased) name? This should be done on the SQL server itself, we dont want to have to edit config files and hunt down every where the DB name was hard coded.

    No looking for a server alias or linked server, but a DB name alias.

    thanks!

    I don't think that could be done at the DB level. Why would they want to change the name anyways?

    Do they hate developers that much????

    Alias, DNS, Linked server is about all I can think of and that's all server stuff...

    I'd like to know if it's possible as well... might come in handy one day.

    ---------------------------------------------------------------
    Mike Hahn - MCSomething someday:-)
    Right way to ask for help!!
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    I post so I can see my avatar :hehe:
    I want a personal webpage 😎
    I want to win the lotto 😀
    I want a gf like Tiffa :w00t: Oh wait I'm married!:-D

  • My recommendation to them would be to not change the db name. If it must be changed, hunt down the connection strings and make the appropriate changes.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Hmm, you could create a db with the new name, and create synonyms pointing back to the old db.

    But synonyms can only be used for these types of objects:

    Assembly (CLR) Stored Procedure

    Assembly (CLR) Table-valued Function

    Assembly (CLR) Scalar Function

    Assembly Aggregate (CLR) Aggregate Functions

    Replication-filter-procedure

    Extended Stored Procedure

    SQL Scalar Function

    SQL Table-valued Function

    SQL Inline-table-valued Function

    SQL Stored Procedure

    View

    Table (User-defined)

    USE new_db_name

    CREATE SYNONYM dbo.table_name_1

    FOR old_db_name.dbo.table_name_1

    ...

    CREATE SYNONYM dbo.proc_name_1

    FOR old_db_name.dbo.proc_name_1

    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 4 posts - 1 through 3 (of 3 total)

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