Implementing and maintaining an Azure SQL Database project Emanuele Zanchettin - thinkIT
About ME – Emanuele Zanchettin 10+ years of experience data architect and consultant about SQLServer and Azure SQL Database analyst and software developer using .NET coordinator of resources and IT projects Speaker about SQLServer technology CEO and co-founder thinkIT ezanchettin@thinkit.it – http://www.thinkit.it/ Please excuse me for any mistake in my English, I’m studying to improve it
Agenda Infrastructure overview Responsible choosing Project Scenarios First publication Publication of revision Backup and restore strategies Service Level Agreement (SLA)
Some features of SQL Database Basis haven’t changed … +/-
SQL Database inside – High Availability 3rd physic db 1st physic db Multiple copies redundant automatic and automatic failover, optimized availability 2nd physic db Logic Database Database 3rd physic db
Data partitioning - Scalability Database Id val Id val Id val Scale-up Vertical Partitioning Scale-out Horizontal partitioning bigger db more dbs Federation / Elastic scale (ex. app multi-tenant)
Conclusions Scale-up Vertical Partitioning All right Vertical Partitioning External foreign keys, between databases, not permitted You can not have transactions between databases Even using Microsoft Distributed Transaction Coordinator (MDTC client side) Scale-out or horizontal partitioning Embedded in Azure Schema design Developing and troubleshooting are little bit hard Elastic Scale (preview) … bye bye Federation … RIP Sep. ‘15
Other conclusions Service evolution f(x) tomorrow? today yesterday start t
Hard to believe? Try to calculate the price RIP Sep. ‘15
Service Tier / Performance Level Benchmark Transaction Rate The choice, conscious Service Tier / Performance Level DTU MAX DB Size Max Worker Threads Max Sessions Benchmark Transaction Rate Predictability Basic 5 2 GB 30 300 16.600/h (4,6/s) Good Standard/S0 10 250 GB 60 600 521/m (8,5/s) Better Standard/S1 20 90 900 934/m (15,6/s) Standard/S2 50 120 1.200 2.570/m (42,8/s) Standard/S3 100 200 2.400 5.100/m (85/s) Premium/P1 500 GB 105/s Best Premium/P2 400 4.800 228/s Premium/P3 800 1.600 19.200 735/s
Evolution from Federation to Elastic Scale (hints) The Azure SQL Database Federations feature is being retired along with the Web/Business editions in September 2015 (Cit.)
Shard Map Two types of Shard Map Four types of keys Range: intervals contiguous elements List: list of values Four types of keys INT BIGINT GUID VARBINARY
Split/Merge scenario Some comands CreateShard DeleteShard CreateRangeMapping CreatePointMapping DeleteMapping UpdateMapping MarkMappingOffline MarkMappingOnline Key Shard Location 1 Database_A 3 Database_B 4 Database_C 6 ... Key Range Shard Location [1, 50) Database_A [50, 100) Database_B [100, 200) Database_C [400, 600) ...
Go … What’s your case?
Migrating existing project Azure SQL Database all on cloud on premise + cloud (hybrid)
New project Azure SQL Database all on cloud
First publishing Are you ready to do this?
Migration tools Schema and data Only data Only schema SQL Server Migration Assistant (SSMA) for Oracle, Sybase, MySQL and Access SQL Server Management Studio (SSMS) from SQL Server 2012 using .bacpac package SQL Database Migration Wizard (CodePlex) SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x) Only data bcp, SSMS, SQL Data Sync, SSIS Only schema SQL Server Data Tools from Microsoft Visual Studio 2012 / from SQL Server 2012 using .dacpac package
A migration real case Tool: Migrate Data di SQL Server Migration Assistant for MySQL Quantity: 6 tables, 9KK rows, 520MB big Time required: 26’ 30’’ using parallel upload, fiber 10Mbit/s
SQL Server Database migration DEMO SQL Server Database migration
Conclusions Features limits T-SQL limits SQL Server Utility, SQL Server PowerShell Provider, Master Data Services, Change Data Capture, Data Auditing, Data Compression, Extended Events, Extension of spatial types and methods through Common Language Runtime (CLR), External Key Management / Extensible Key Management, FILESTREAM Data, Integrated Full-Text Search, Large User-Defined Aggregates (UDAs), Large User-Defined Types (UDTs), Performance Data Collection (Data Collector), Policy-Based Management, Resource Governor, SQL Server Replication Transparent Data Encryption, Common Language Runtime (CLR) and CLR User-Defined Types, Database Mirroring, Service Broker, Table Partitioning, Typed XML and XML indexing (XML data type), Backup and Restore, Replication, Extended Stored Procedures, SQL Server Agent/Jobs T-SQL limits Common Language Runtime (CLR), Database file placement, Database mirroring, Distributed queries, Distributed transactions, Filegroup management, Global temporary tables, SQL Server configuration options, SQL Server Service Broker, System tables, Trace Flags Documentation available online Planing before starting
Update publishing And now?
Managing schema and data Managing environments of test and production Planing an undo step Changing schema and data SQL Server Management Studio (SSMS) from SQL Server 2012 using .bacpac package SQL Database Migration Wizard (CodePlex) SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x) Changing only data bcp, SSMS, SQL Data Sync, SSIS Changing only schema Microsoft Visual Studio 2012 / SSMS
A federation upload real case Tool Export of SQL Server Management Studio Quantity 3 tables, 8,6KK rows, 490MB big Time required 10’ 15’’ using parallel download/upload, fiber 10Mbit/s
changing database schema in real-time DEMO changing database schema in real-time
Conclusions DBA, Data Architect and developers do not quarrel amongst yourselves “Scaling” before reaching the limit Chosing a step-by-step publication Planing before starting
Backup and restore strategies Don’t forget it
Who does what? Azure SQL Database periodical at least 7 days “as a safe guard against catastrophic software and system failures” !!!! Backup Full weekly, Differential daily, Transaction Log avery 5’ History 7d (B), 14d (S), 35d (P) Point in Time Restore, Restoring a Deleted Database, Geo-Restore User’s error (Business Continuity) Using SQL Data Sync (backup offline/remoto) Copy Database (CREATE DATABASE [destination] AS COPY OF [source]) Import/Export Service (Azure BLOB storage needed, auto in preview) Group/Agent of synchronization Azure (SQLDataSyncAgent only x86 ) Plans before starting
Service Level Agreement (SLA) Guarantees on the service provided?
Ex. 3 x (5 minutes + 50 GB x 1024 MB/GB / 150 MB/minute) ≈17 hours SLA 99,90% (W, BU) e 99,99% (B, S, P) Monthly, calculated over a minute of inactivity >= 1 minute Limit of subscription Credit card Over quota DTU (Database Throughput Units) Upgrade / Downgrade of Service tier SLO (Service Level Objective) and “the evil formula” 3 x (5 mins + db size / 150 MB/min) Ex. 3 x (5 minutes + 50 GB x 1024 MB/GB / 150 MB/minute) ≈17 hours SLO < SLA SLO == SLA SLO > SLA (MNU)
Links Migration from federation to elastic scale azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-federation-migration/ Azure SQL Database Elastic Scale Ch9 channel9.msdn.com/Shows/Data-Exposed/Azure-SQL-Database-Elastic-Scale SQL Database Service Level Agreement (SLA) www.windowsazure.com/it-it/support/legal/sla/ SQL Database pricing www.windowsazure.com/it-it/pricing/details/sql-database/
Links SQL Server Migration Assistant (SSMA) blogs.msdn.com/b/ssma/ Guidelines and Limitations (Windows Azure SQL Database) msdn.microsoft.com/en-us/library/windowsazure/ff394102.aspx Known SQL Data Sync (Preview) Limits msdn.microsoft.com/en-us/library/jj590380.aspx Azure SQL Database Backup and Restore msdn.microsoft.com/en-us/library/azure/jj650016.aspx
Explore Everything PASS Has to Offer Free SQL Server and BI Web Events Free 1-day Training Events Regional Event This is Community Business Analytics Training Local User Groups Around the World Session Recordings PASS Newsletter Free Online Technical Training
The end thank you