3

I have an Azure SQL Managed Instance that is set up with geo-replication. I have a database on this MI that I want to swap out with another database by renaming them:

ALTER DATABASE mydb MODIFY NAME = mydb_old; 
ALTER DATABASE mydb_new MODIFY NAME = mydb;

When I run this, I get an error error:

The operation cannot be performed since the database 'mydb' is in a replication relationship.

What do I need to do to allow me to rename the databases?

np_6
  • 514
  • 1
  • 6
  • 19
Brad Crandell
  • 850
  • 1
  • 8
  • 22

2 Answers2

4

Yes, database rename does not work if Geo-replication is enabled. The same behavior is in Azure SQL Database - Singleton, so generally RENAME and Geo-replication don't work together in Azure SQL.

Could you file this in SQL DB feedback forum highlighting that rename should be supported if Geo-replication is setup on database/instance so people could vote for this: https://feedback.azure.com/forums/217321-sql-database

Jovan MSFT
  • 13,232
  • 4
  • 40
  • 55
0

I got this same problem today and as mentioned in the approved answer, you can't rename an Azure database if the Geo-replication is enabled.

In order to rename my database, I ended up deleting my failover group and then stopped my replication. Further details are below.

PS: I have got a script to regenerate the replications again, so deletion is not a problem for my case.

enter image description here

enter image description here

enter image description here

Nurhak Kaya
  • 1,470
  • 1
  • 18
  • 20