%3CLINGO-SUB%20id%3D%22lingo-sub-1623866%22%20slang%3D%22en-US%22%3EDatabase%20copy%20preview%20on%20Azure%20SQL%20Database%20Hyperscale%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1623866%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fdatabase-copy%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDatabase%20copy%3C%2FA%3E%20provides%20a%20way%20to%20create%20a%20transactionally%20consistent%20snapshot%20of%20the%20source%20database%20as%20a%20new%20database%20on%20the%20same%20server%20or%20different%20server.%20It%20also%20enables%20copy%20across%20regions%2C%20subscriptions%2C%20and%20Azure%20tenants%20using%20the%20same%20or%20different%20service%20level%20objective.%3C%2FP%3E%0A%3CP%3EOn%20Azure%20SQL%20Hyperscale%20the%20time%20taken%20by%20database%20copy%20depends%20on%20the%20source%20and%20destination%20chosen%20for%20the%20copy%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20the%20destination%20is%20the%20same%20region%20as%20the%20source%2C%20then%20the%20copy%20is%20created%20from%20snapshots%20of%20blobs%20created%20by%20database%20backups.%20This%20kind%20of%20copy%20is%20a%20fast%20operation%20regardless%20of%20database%20size.%3C%2FLI%3E%0A%3CLI%3EIf%20the%20destination%20region%20for%20the%20copy%20is%20different%20from%20the%20source%20region%2C%20the%20copy%20is%20a%20size%20of%20data%20operation.%20Page%20server%20blobs%20are%20copied%20in%20parallel%2C%20so%20the%20copy%20time%20is%20not%20directly%20proportional%20to%20the%20size%20of%20data%2C%20yet%20it%20is%20a%20potentially%20long%20running%20size%20of%20data%20operation.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EBelow%20are%20some%20sample%20durations%20for%20database%20copy%20in%20Hyperscale%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22166%22%3E%3CP%3EDatabase%20size%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22160%22%3E%3CP%3ESource%20region%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22162%22%3E%3CP%3EDestination%20region%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22126%22%3E%3CP%3EElapsed%20time%20(mins)%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22166%22%3E%3CP%3E1TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22160%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22162%22%3E%3CP%3ECentral%20US%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22126%22%3E%3CP%3E12%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22166%22%3E%3CP%3E1%20TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22160%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22162%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22126%22%3E%3CP%3E180%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22166%22%3E%3CP%3E7.2TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22160%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22162%22%3E%3CP%3ECentral%20US%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22126%22%3E%3CP%3E269%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22166%22%3E%3CP%3E7.2TB%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22160%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22162%22%3E%3CP%3EWest%20US%202%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22126%22%3E%3CP%3E13%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1271376334%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%20id%3D%22toc-hId--1264916681%22%3ECreating%20a%20Database%20Copy%3C%2FH2%3E%0A%3CP%3EDatabase%20copy%20can%20be%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-sql%2Fdatabase%2Fdatabase-copy%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecreated%20started%3C%2FA%3E%20with%20PowerShell%2C%20Azure%20CLI%2C%20REST%20API%2C%20or%20T-SQL.%20Cross%20subscription%20and%20cross%20tenant%20copy%20is%20only%20supported%20using%20T-SQL.%20If%20you%20do%20not%20specify%20a%20service%20objective%20for%20the%20target%20database%2C%20the%20default%20service%20objective%20and%20configurations%20are%20used%2C%20which%20is%20HS_Gen5_2%20with%201%20additional%20replica%20which%20can%20be%20used%20for%20reads.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--580814860%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%20id%3D%22toc-hId--574355207%22%3EAzure%20CLI%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eaz%20sql%20db%20copy%20--resource-group%20%22sourceRG%22%20--server%20sourceServer%20--name%20%22sourceDB%22%20--dest-resource-group%20destDB%20--dest-server%20destServer%20--dest-name%20destDB%20--service-objective%20HS_Gen5_2%20--read-replicas%200%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1906697973%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%20id%3D%22toc-hId-1913157626%22%3EPowerShell%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ENew-AzSqlDatabaseCopy%20-ResourceGroupName%20%22sourceRG%22%20-ServerName%20sourceServer%20%26nbsp%3B%60-DatabaseName%20%22sourceDB%22%20%60%0A-CopyResourceGroupName%20%22destinationRG%22%20-CopyServerName%20destServer%20-CopyDatabaseName%20%22destDB%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-99243510%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%20id%3D%22toc-hId-105703163%22%3ETSQL%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ECREATE%20DATABASE%20Database2%20AS%20COPY%20OF%20SourceServer.Database1%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1708210953%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%20id%3D%22toc-hId--1701751300%22%3EPortal%3C%2FH3%3E%0A%3CP%3EAnother%20way%20to%20copy%20the%20database%20is%20via%20the%20Azure%20portal.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capture.JPG%22%20style%3D%22width%3A%20965px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F220139i96588AE3B3406BC9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Capture.JPG%22%20alt%3D%22Portal%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EPortal%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1718714057%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%20id%3D%22toc-hId--1712254404%22%3EMonitoring%20database%20copy%3A%3C%2FH2%3E%0A%3CP%3EIn%20the%20master%20database%3A%3C%2FP%3E%0A%3CP%3Eselect%20*%20from%20sys.dm_operation_status%3C%2FP%3E%0A%3CP%3EGO%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorDenzil%20Ribeiro_2%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Picture1.png%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F220132i85147A4F5231488E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Picture1.png%22%20alt%3D%22sys.dm_operation_status%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Esys.dm_operation_status%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENote%3A%20the%20progress%20status%20values%20are%20limited%20to%200%2F50%2F100%25.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-768798776%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%20id%3D%22toc-hId-775258429%22%3ECurrent%20preview%20Limitations%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Frelational-databases%2Fsystem-dynamic-management-views%2Fsys-dm-database-copies-azure-sql-database%3Fview%3Dazuresqldb-current%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Esys.dm_database_copies%20%3C%2FA%3E%26nbsp%3Bdoes%20not%20currently%20track%20progress%20of%20database%20copy%2C%20this%20will%20be%20addressed%20before%20GA.%3C%2FLI%3E%0A%3CLI%3ECurrently%20portal%20target%20database%20allows%20choice%20of%20elastic%20pool%20but%20the%20copy%20will%20fail%20as%20Hyperscale%20does%20not%20support%20Elastic%20pools%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1623866%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fdatabase%2Fdatabase-copy%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDatabase%20copy%3C%2FA%3E%20provides%20a%20way%20to%20create%20a%20transactionally%20consistent%20snapshot%20of%20the%20source%20database%20as%20a%20new%20database%20on%20the%20same%20server%20or%20different%20server.%20On%20Hyperscale%20within%20the%20same%20region%20this%20copy%20is%20a%20fast%20operation%20regardless%20of%20database%20size.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1623866%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1694779%22%20slang%3D%22en-US%22%3ERe%3A%20Database%20copy%20preview%20on%20Azure%20SQL%20Database%20Hyperscale%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1694779%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Denzil%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAre%20you%20sure%20that%201%20TB%20from%20West%20US%202%20to%20West%20US%202%20takes%20180%20minutes%3F%20Because%20that%20is%20slower%20than%20a%20database%20copy%20to%20a%20different%20region.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%20Johannes%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1694966%22%20slang%3D%22en-US%22%3ERe%3A%20Database%20copy%20preview%20on%20Azure%20SQL%20Database%20Hyperscale%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1694966%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20catching%20that%2C%20I%20mistakenly%20flipped%20the%20rows%2C%20that%20was%20the%20cross%20region%20copy.%20In%20region%20WestUS2%20-%20WestUS%20took%2012%20mins%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1695099%22%20slang%3D%22en-US%22%3ERe%3A%20Database%20copy%20preview%20on%20Azure%20SQL%20Database%20Hyperscale%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1695099%22%20slang%3D%22en-US%22%3E%3CP%3ENow%20it%20makes%20more%20sense%20%3B)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImpressive%20to%20see%20that%20between%201%20TB%20and%207.2%20TB%20within%20the%20same%20region%20there%20is%20a%20very%20minor%20difference.%20That%20scales%20nicely.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20copy%20within%20the%20same%20region%20is%20the%20same%20as%20a%20backup%20operation%2C%20except%20that%20the%20backup%20selection%20can%20be%20historical%20and%20the%20copy%20is%20from%20the%20actual%20state%20of%20the%20database%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1699746%22%20slang%3D%22en-US%22%3ERe%3A%20Database%20copy%20preview%20on%20Azure%20SQL%20Database%20Hyperscale%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1699746%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F218602%22%20target%3D%22_blank%22%3E%40Denzil%20Ribeiro%3C%2FA%3E%26nbsp%3BIs%20the%20Data%20Sync%20on%20the%20Roadmap%20for%20the%20Hyperscale%3F%20When%20is%20it%20planned%20for%20the%20preview%3F%3CBR%20%2F%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Database copy provides a way to create a transactionally consistent snapshot of the source database as a new database on the same server or different server. It also enables copy across regions, subscriptions, and Azure tenants using the same or different service level objective.

On Azure SQL Hyperscale the time taken by database copy depends on the source and destination chosen for the copy

  • If the destination is the same region as the source, then the copy is created from snapshots of blobs created by database backups. This kind of copy is a fast operation regardless of database size.
  • If the destination region for the copy is different from the source region, the copy is a size of data operation. Page server blobs are copied in parallel, so the copy time is not directly proportional to the size of data, yet it is a potentially long running size of data operation.

Below are some sample durations for database copy in Hyperscale:

 

Database size

Source region

Destination region

Elapsed time (mins)

1TB

West US 2

Central US

180

1 TB

West US 2

West US 2

12

7.2TB

West US 2

Central US

269

7.2TB

West US 2

West US 2

13

 

Creating a Database Copy

Database copy can be created started with PowerShell, Azure CLI, REST API, or T-SQL. Cross subscription and cross tenant copy is only supported using T-SQL. If you do not specify a service objective for the target database, the default service objective and configurations are used, which is HS_Gen5_2 with 1 additional replica which can be used for reads.

 

Azure CLI

 

 

az sql db copy --resource-group "sourceRG" --server sourceServer --name "sourceDB" --dest-resource-group destDB --dest-server destServer --dest-name destDB --service-objective HS_Gen5_2 --read-replicas 0

 

 

PowerShell

 

 

New-AzSqlDatabaseCopy -ResourceGroupName "sourceRG" -ServerName sourceServer  `-DatabaseName "sourceDB" `
-CopyResourceGroupName "destinationRG" -CopyServerName destServer -CopyDatabaseName "destDB"

 

 

TSQL

 

 

CREATE DATABASE Database2 AS COPY OF SourceServer.Database1;

 

 

Portal

Another way to copy the database is via the Azure portal.

PortalPortal

Monitoring database copy:

In the master database:

select * from sys.dm_operation_status

GO

 

sys.dm_operation_statussys.dm_operation_status

Note: the progress status values are limited to 0/50/100%.

Current preview Limitations

  • sys.dm_database_copies  does not currently track progress of database copy, this will be addressed before GA.
  • Currently portal target database allows choice of elastic pool but the copy will fail as Hyperscale does not support Elastic pools
5 Comments
Senior Member

Hi Denzil,

 

Are you sure that 1 TB from West US 2 to West US 2 takes 180 minutes? Because that is slower than a database copy to a different region.

 

Regards, Johannes

Microsoft

Thanks for catching that, I mistakenly flipped the rows, that was the cross region copy. In region WestUS2 - WestUS took 12 mins

Senior Member

Now it makes more sense ;)

 

Impressive to see that between 1 TB and 7.2 TB within the same region there is a very minor difference. That scales nicely.

 

A copy within the same region is the same as a backup operation, except that the backup selection can be historical and the copy is from the actual state of the database?

Occasional Visitor

@Denzil Ribeiro Is the Data Sync on the Roadmap for the Hyperscale? When is it planned for the preview?
Thanks!

Occasional Visitor

Finally, "Coming soon" button was there long. Anyway, this is great, makes creating dev copies now much easier. Thanks!