
{"id":6978,"date":"2023-09-26T09:41:15","date_gmt":"2023-09-26T09:41:15","guid":{"rendered":"https:\/\/rax-stg-wp-aws.com\/blogs\/active-geo-replication-for-azure-sql-dbs-and-its-failover\/"},"modified":"2026-11-03T19:27:22","modified_gmt":"2026-11-03T19:27:22","slug":"active-geo-replication-for-azure-sql-dbs-and-its-failover","status":"publish","type":"blogs","link":"https:\/\/www.rackspace.com\/de\/blogs\/active-geo-replication-for-azure-sql-dbs-and-its-failover\/","title":{"rendered":"Active Geo-Replication for Azure SQL DBs and its failover"},"content":{"rendered":"<p class=\"MsoNormal\">This blog guides you through the process of setting up geo-replication for Azure SQL Database and covers the procedures for both failover and failback operations<\/p>\n<p>Geo-replication for Azure SQL Database functions similarly to the secondary replica feature in the &#8220;Always On&#8221; mode of an on-premises SQL server. It serves as a disaster recovery (DR) solution for scenarios like regional outages or extended server downtime. This feature allows you to establish a secondary copy of your Azure SQL Database in a different region. Notably, it&#8217;s possible to create up to four secondary replicas, either within the same region or in various regions.<\/p>\n<p class=\"MsoNormal\">Now, let&#8217;s delve into the steps for creating and configuring geo-replication.<\/p>\n<p class=\"MsoNormal\"><strong>Prerequisites:<\/strong><\/p>\n<ul>\n<li>Both the primary and secondary databases must be of the same tier.<\/li>\n<li>The databases should have identical compute sizes, whether in DTUs or vCores.<\/li>\n<\/ul>\n<p class=\"MsoNormal\"><strong>Create Azure SQL server and Azure SQL Database<\/strong><\/p>\n<ul>\n<li>Navigate to the Azure portal.<\/li>\n<li>Create an Azure SQL server along with a database, ensuring you select a pricing tier of Standard S0 or higher.<\/li>\n<\/ul>\n<p class=\"MsoListParagraphCxSpLast\">Upon completion, your database setup should resemble the following:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture1.png\" alt=\"Active Geo Replication Picture1\" \/><\/p>\n<p class=\"MsoNormal\"><strong>Active geo-replication<\/strong>:<\/p>\n<p class=\"MsoNormal\">To enable geo-replication, go to database under setting then click on Geo-Replication<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture2.png\" alt=\"Active Geo Replication Picture2\" \/><\/p>\n<p>Under &#8220;Geo-Replication,&#8221; select your target region, in this instance, choose &#8220;West US.&#8221; After selecting the target region, click on &#8220;Target Server,&#8221; input the server name as &#8220;sqldrdb,&#8221; and ensure you select the same pricing tier. Then click &#8220;OK.&#8221;<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture3.png\" alt=\"Active Geo Replication Picture 3\" \/><\/p>\n<p>Following these steps, the deployment of the DR server will commence. In a short while, the new DR server will be operational. You&#8217;ll then see both SQL servers displayed.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture4_0.png\" alt=\"Active Geo Replication Picture 4\" \/><\/p>\n<p class=\"MsoNormal\"><strong>Data validation:<\/strong><\/p>\n<p class=\"MsoNormal\">To verify, create a table on sqlproddb.primarydb (source database) and populate it with records using the provided scripts. Validate that there are only two records in ComputerProducts table.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture5.PNG\" alt=\"Code Picture 5 \" \/><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Now, run a select query on the destination sqldrdb.primarydb. If the records match between the source and destination databases, it confirms that every record is instantly replicated to the destination DR database.<o p=\"\"><\/o><\/span><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture7.PNG\" alt=\"Active Geo Replication Code 7\" \/><\/p>\n<p>&nbsp;<\/p>\n<p class=\"MsoNormal\"><b><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Initiating database failover:<o p=\"\"><\/o><\/span><\/b><\/p>\n<ul>\n<li class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">To initiate a failover for the Azure SQL Database:<o p=\"\"><\/o><\/span><\/li>\n<li class=\"MsoListParagraphCxSpFirst\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Navigate to the Azure portal and select the SQL database.<o p=\"\"><\/o><\/span><\/li>\n<li class=\"MsoListParagraphCxSpMiddle\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Click on &#8220;Geo-Replication,&#8221; select the secondary server, and choose &#8220;Forced Failover.&#8221;<o p=\"\"><\/o><\/span><\/li>\n<li class=\"MsoListParagraphCxSpLast\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">When prompted to confirm, click &#8220;Yes.<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture8.PNG\" alt=\"Active Geo Replication Picture 8\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture10.png\" alt=\"Active Geo Replication Picture 9\" \/><\/p>\n<p><span>Upon clicking &#8220;Yes,&#8221; the primary server &#8216;sqlproddb&#8217; will transition to a secondary role, and the secondary server &#8216;sqldrdb&#8217; will assume the primary position.<o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\"><span><o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Now, to verify accurate replication, check the database tables. Add a few more records to the current primary database, &#8216;sqldrdb.primarydb&#8217;, and compare the records before and after the new entries.<\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\"><span><o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\"><span><o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\">&nbsp;<\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>select<\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>*<\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>from<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span> ComputerProducts <\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>&#8211;Validate the table before inserting new records<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/em><\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>INSERT<\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>INTO<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span> ComputerProducts<\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>(<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>product_name<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>,<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span> price<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/em><\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>VALUES<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/em><\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>(<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>&#8216;Mouse&#8217;<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>,<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>1000<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>),<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/em><\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>(<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>&#8216;CPU&#8217;<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>,<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>25000<\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span>)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/em><\/p>\n<p><em><span><span><span><span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span><span>select<\/span><\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span><span>*<\/span><\/span><\/span><\/span> <span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span><span>from<\/span><\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span><span> ComputerProducts <\/span><\/span><\/span><\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><span><span><span>&#8211;Validate the table after inserting new records<\/span><\/span><\/span><\/span> <\/span><\/span><\/span><\/span><\/em><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture12.png\" alt=\"Active Geo Replication Picture 12\" \/><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">Run the following select query to verify the records on the DR server&#8217;s table.<o p=\"\"><\/o><\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">select<\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"> <\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\">*<\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"> <\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\">from<\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"> ComputerProducts<\/span><\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><o p=\"\"><\/o><\/span><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_article_images\/26017-body-Picture14.png\" alt=\"Active Geo Replication Picture 13\" \/><\/p>\n<p>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span lang=\"EN-IN\" xml:lang=\"EN-IN\">We found that records get replicated instantly.<o p=\"\"><\/o><\/span><\/p>\n<p><span lang=\"EN-IN\" xml:lang=\"EN-IN\">This guide detailed the process of setting up active geo-replication for Azure SQL Database. Users can establish up to four read-only secondary copies of the Azure SQL Database. If the primary database encounters issues, an automatic failover will trigger. Additionally, there&#8217;s the option to manually failover the database to another region, designating the secondary database as the primary.<\/span><span lang=\"EN-IN\" xml:lang=\"EN-IN\"><o p=\"\"><\/o><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Active Geo-Replication for Azure SQL DBs and its failover<\/p>\n","protected":false},"author":2,"featured_media":6980,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"content-type":"","nid":"26017","content_type":"blog","created_by":"10130","authored_on":"2023-09-06T09:41:15+00:00","field_article_industries":"","tag_category":"Technical","field_blog_author_text":"by Anil Kumar, MS SQL Database Administrator, Rackspace Technology","seo_description":"Explore this step-by-step guide to setting up active geo-replication for Azure SQL Database. \r\n","field_featured_image":"","insights_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/26017-insights_image-database-technical-blog-1-insights.jpg","field_partners":"","rxt_platforms":"Microsoft Azure","product":"","publisheddate":"2023-09-26T09:41:15","rxt_solutions":"Multicloud","opengraph_tag":"","x_tag":"","teaser_flag":"Technical Blog","seo_titile":"Active Geo-Replication for Azure SQL DBs | Rackspace Technology","field_topics":"","field_slug":"active geo replication azure sql database","footnotes":""},"categories":[178],"tags":[204],"class_list":["post-6978","blogs","type-blogs","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-technical"],"_links":{"self":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/6978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs"}],"about":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/types\/blogs"}],"author":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/comments?post=6978"}],"version-history":[{"count":2,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/6978\/revisions"}],"predecessor-version":[{"id":8652,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/blogs\/6978\/revisions\/8652"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media\/6980"}],"wp:attachment":[{"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/media?parent=6978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/categories?post=6978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rackspace.com\/de\/wp-json\/wp\/v2\/tags?post=6978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}