Rename databases part of AlwaysOn Group

  • Hi Experts,

    I have few databases which are part of Alwayson Group, Can I rename the database?

    Thanks.

  • Databases that are under availability group can not be renamed directly.
    To rename database you can do following -
    1- Remove database from Availability group
    2- Rename database
    3- Take Full and T-log backup of database
    4- Restore database on secondary replicas
    5- Add renamed database to Availability group

    -----------------
    Aditya Rathour
    SQL DBA

    Not Everything that is faced can be changed,
    but nothing can be changed until it is faced.

  • Hi,

    I know this is an old thread, but I was interested as renaming the physical file names was something I was looking to do, but hoping without having to perform a full backup and restore of a multi-TB database.

    I found that, after removing the DB from the AG, I could

    1. update the filename in SQL;
    2. take DB offline and rename the physical file
    3. Online the DB, and re-add to the AG.
    4. Perform a failover to the secondary, once databases are synchronised.
    5. Take the db out of the AG again
    6. Perform the same rename steps
    7. Add the db back to the AG.

    Obviously, given that the DB is being taken offline a couple of times, this should be done at a time when there is minimal, or no, demand for db access, so no data changes should be occurring.  There should be little need to perform a full backup, and hopefully not even a TLog backup, given the databases should be jsut about synchronised.

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

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