Download October 10, 2015

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Commitment ordering wikipedia , lookup

DBase wikipedia , lookup

Serializability wikipedia , lookup

IMDb wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Tandem Computers wikipedia , lookup

Functional Database Model wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Ingres (database) wikipedia , lookup

Team Foundation Server wikipedia , lookup

Concurrency control wikipedia , lookup

Btrieve wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

ContactPoint wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

PL/SQL wikipedia , lookup

Transcript
Implementing and maintaining
an Azure SQL Database project
Emanuele Zanchettin
@_thinkIT_
thinkit.it – [email protected]
an evergreen session
October 10, 2015
#sqlsat454
Sponsors
October 10, 2015
#sqlsat454
Speaker info – 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 and Azure SQL Database technologies
 CEO and co-founder thinkIT
Certificated company ISO 9001:2008 (Quality)
and ISO/IEC 20000-1:2011 (IT Services)
 [email protected] – http://www.thinkit.it/
October 10, 2015
#sqlsat454
About you
After a great lunch, time for a long sleep .. ???
Are you awake? 
 Try to raise your hand
 Try to clap your hands
How many people are using … (raise your hand)




SQL Server?
Azure SQL Database?
SS Management Studio?
MS Visual Studio?
October 10, 2015
#sqlsat454
Agenda
•
•
•
•
•
•
•
Infrastructure overview
Responsible choosing
Project Scenarios
First publication
Publication of revision
Backup and restore strategies
Service Level Agreement (SLA) and Objective (SLO)
October 10, 2015
#sqlsat454
Some features of SQL Database
Basis haven’t changed … +/-
October 10, 2015
#sqlsat454
SQLDatabase inside – High Availability
st physic db
31rd
2nd physic db
Logic
Database
Database
3rd physic db
Multiple copies redundant automatic and automatic failover, optimized availability
October 10, 2015
#sqlsat454
Data partitioning - Scalability
Database
Id
val
Id
Id
Scale-up
Vertical
Partitioning
bigger db
more dbs
October 10, 2015
val
val
Scale-out
Horizontal partitioning
Elastic scale (ex. app multi-tenant)
#sqlsat454
Conclusions
Scale-up
 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  … was Federation …
October 10, 2015
#sqlsat454
Other conclusions
 Service evolution
f(x)
tomorrow?
today
2 days ago
6 months ago
t
start
October 10, 2015
#sqlsat454
Hard to belive?
Try to calculate the price
October 10, 2015
#sqlsat454
The choice, conscious
Service
Tier
Performance Common App
Level
Pattern
Basic
Basic
Small DB, SQL
opp
Standard
S0
S1
S2
S3
Wrkgp/cloud
app, multiple
concurrent
operations
P1
P2
P4
P6
Mission Critical,
High volume,
Many
concurrent
Users
Premium
P11
October 10, 2015
Performance
Business
Continuity
Max
DB
Size
Transaction
Perf.
Objective
2
GB
Reliability /
Hr.
DB Copy +
7
5
Manual
Days
Export
Reliability /
Min.
10
DB Copy +
20
14
Manual
50 Days
Export
100
250
GB
500
GB
1TB
Reliability /
sec.
DTU
PITR
DR / GEORep
125
250
35
Active Geo500
1000 Days replication
1750
#sqlsat454
Save money at every cost
 First benchmark: B vs S0, 1kk rows
B 5DTU
S0 10DTU
SQL Server Execution Times
SQL Server Execution Times
CPU time = 672 ms
elapsed time = 511505 ms. (8’ 3”)
CPU time = 891 ms
elapsed time = 260066 ms. (4’ 20”)
(1000000 row(s) affected)
(1000000 row(s) affected)
October 10, 2015
#sqlsat454
Save money at every cost
 Last benchmark: B vs S0, 20kk rows
B 5DTU
The service has encountered an
error processing your request.
Please retry again. Error code 9002.
the transaction log becomes full
October 10, 2015
S0 10DTU
SQL Server Execution Times
CPU time = 169625 ms
elapsed time = 17847310 ms. (4h 57’)
(20000000 row(s) affected)
#sqlsat454
Save money at every cost
 Last benchmark: B, 5*4kk rows
B 5DTU
SQL Server Execution Times
elapsed time = 4892725 ms. (1h 21’)
elapsed time = 4894096 ms. (1h 21’)
elapsed time = 4895032 ms. (1h 21’)
elapsed time = 4923000 ms. (1h 21’)
(5h 26’)
(20000000 row(s) affected)
CPU time = 4078 ms,
CPU time = 3719 ms,
CPU time = 4234 ms,
CPU time = 5578 ms,
October 10, 2015
S0 was
4h 57’
#sqlsat454
Evolution from Federation to Elastic Scale
The Azure SQL Database Federations feature is being retired along
with the Web/Business editions in September 2015 (Cit.)
October 10, 2015
#sqlsat454
Shard Map
 Two types of Shard Map
 Range: intervals contiguous elements
 List: list of values
• Four types of keys
 INT
 BIGINT
 GUID
 VARBINARY
October 10, 2015
#sqlsat454
Split/Merge scenario
• Some comands
– CreateShard 
– DeleteShard
– CreateRangeMapping
– CreatePointMapping
– DeleteMapping
– UpdateMapping
– MarkMappingOffline
– MarkMappingOnline
Key
1
3
4
6
...
October 10, 2015
Shard Location
Database_A
Database_B
Database_C
Database_B
...
Key Range
[1, 50)
[50, 100)
[100, 200)
[400, 600)
...
Shard Location
Database_A
Database_B
Database_C
Database_C
...
#sqlsat454
Easy to understand
Scale up/down
Vertical: Scale-up or scale-down
Horizontal: Scale-out or scale-in
Premium
Premium
Standard
Basic
Standard
Basic
Basic
Basic
Basic
Basic
Scale out/in
October 10, 2015
#sqlsat454
Go …
What’s your case?
October 10, 2015
#sqlsat454
Migrating existing project
all on cloud
October 10, 2015
on premise + cloud (hybrid)
#sqlsat454
New project
all on cloud
October 10, 2015
#sqlsat454
Upgrading project V2 > V12
SQL
V2
SQL
easy*
V12
*
October 10, 2015
Upgrading this server to the latest SQL Database Update is permanent and
irreversible. To confirm the upgrade, type the name of the server ‘pluto' below. The
duration of upgrade ranges from several hours to days depending on the size, edition
and number of databases in the server. During this time all databases on this server
will remain online but server and database management actions will be restricted.
This release does not currently support some features that may be used by your
application. Please review the list carefully before continuing with the upgrade.
#sqlsat454
Privacy Policy
In Italy is called Law 196/2003
“Sensitive Personal Information” means personal
information that reveals race, ethnic origin, sexual
orientation, political opinions, religious or
philosophical beliefs, trade union membership or
that concerns an individual’s health.
Authorization needed
October 10, 2015
#sqlsat454
First publishing
Are you ready to do this?
October 10, 2015
#sqlsat454
Migration tools
 Schema and data
SQL Server Migration Assistant (SSMA)

from Oracle, Sybase, MySQL and Access
SQL Server Management Studio (SSMS)

from SQL Server 2012 using .bacpac package  2014+ 
SQL Database Migration Wizard (CodePlex)

SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x), SQL Server 2014 (v5x)
 Only data

bcp, SSMS, SQL Data Sync, SSIS
 Only schema
SQL Server Data Tools


from Microsoft Visual Studio 2012  VS2013 
from SQL Server 2012 using .dacpac package  2014+ 
October 10, 2015
#sqlsat454
A migration real case
• Tool: Migrate Data di SQL Server Migration Assistant for
MySQL
• Quantity: 6 tables, 9KK rows, 520MB size
• Times: 26’ 30’’ parallel upload, fiber 10Mbit/s
October 10, 2015
#sqlsat454
DEMO
SQL Server
Database
migration
October 10, 2015
#sqlsat454
Conclusions

Features limits (Updated: March 27, 2015)
Collation of system objects, Connection related (Endpoint statements, ORIGINAL_DB_NAME. Windows
authentication is not available for logins or contained database users), Cross
database queries, cross database ownership chaining, TRUSTWORTHY setting, Data Collector, Database
Diagrams, Database Mail, DATABASEPROPERTY (use DATABASEPROPERTYEX instead), Distributed
transactions, EXECUTE AS logins, Encryption: extensible key management, Eventing (events, event notifications,
query notifications), Features related to database file (placement, size, and database files which are
automatically managed by Microsoft Azure), Features that relate to high availability which is
managed through your Microsoft Azure account (backup, restore, AlwaysOn, database mirroring, log shipping,
recovery modes), Features that rely upon the log reader (Replication, Change Data Capture), Features that
rely upon the SQL Server Agent or the MSDB database (jobs, alerts, operators, Policy-Based
Management, database mail, central management servers), FILESTREAM, Functions (fn_get_sql,
fn_virtualfilestats, fn_virtualservernodes), Global temporary tables, Hardware related server settings (memory,
worker threads, CPU affinity, trace flags, etc. Use service levels instead.), HAS_DBACCESS, KILL STATS JOB,
Linked servers (OPENQUERY, OPENROWSET, OPENDATASOURCE, BULK INSERT, 3 and 4 part names),
Master/target servers, Resource governor, Semantic search, Server credentials, Sever-level items (Server roles,
IS_SRVROLEMEMBER, sys.login_token. Server level permissions are not available though some are replaced by
database-level permissions. Some server-level DMV's are not available though some are replaced by databaselevel DMV's), Serverless express (localdb, user instance), Service broker, SET
REMOTE_PROC_TRANSACTIONS, SHUTDOWN, sp_addmessage, sp_configure options and
RECONFIGURE, SQL Server audit (use SQL Database auditing instead), SQL Server Profiler, SQL Server trace,
Trace flags, Transact-SQL debugging, Triggers (Server-scoped or logon triggers), USE statement

Documentation available online 
October 10, 2015
#sqlsat454
Update publishing
And now?
October 10, 2015
#sqlsat454
Managing schema and data
 Managing environments of test and production
 Plan an undo step
 Changing schema and data
SQL Server Management Studio (SSMS)

from SQL Server 2012 using .bacpac package  2014+ 
SQL Database Migration Wizard (CodePlex)

SQL Server 2008 R2 SP1 (v3x), SQL Server 2012 (v4x) , SQL Server 2014 (v5x)
 Changing only data

bcp, SSMS, SQL Data Sync, SSIS
 Changing only schema


Microsoft Visual Studio 2012
SQL Server Management Studio
October 10, 2015
#sqlsat454
An elastic scale upload real case
• Tool:
Custom Console Program .NET fw 4.5 with Task Parallel Library (TPL)
• Elastic Scale roles
Int key
Range value [1-6) [6-12) [12-18) [18-24)
4 databases B
• Quantity:
was
3 tables, 8,6KK
rows, 490MB size
26’ 30’’
• Times:
8’ 34’’, fiber 10Mbit/s
October 10, 2015
#sqlsat454
DEMO
Have fun
with
Elastic Scale
October 10, 2015
#sqlsat454
Conclusions
 DBA, Data Architect and developers, do not
quarrel amongst yourselves 
 “Scaling” before reaching the limit
 Chosing a step-by-step publication
 Plans before starting 
October 10, 2015
#sqlsat454
Backup and restore strategies
Don’t forget it!
October 10, 2015
#sqlsat454
Who does what?
 SQL Azure 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 
October 10, 2015
#sqlsat454
Service Level Agreement (SLA)
Guarantees on the service provided?
October 10, 2015
#sqlsat454
SLA
 99,99% (B, S, P)






Monthly, calculated over a minute of inactivity >= 1 minute
Limit of subscription
Credit card without money
Over quota
DTU (Database Throughput Units)
Upgrade / Downgrade of Service tier
October 10, 2015
#sqlsat454
Service Level Objective (SLO)
Guarantees on your service provided?
October 10, 2015
#sqlsat454
SLO
 “the evil formula” on changing Service tier
3 x (5 minutes + database size / 150 MB/minute)
Ex. 3 x (5 minutes + 50 GB x 1024 MB/GB / 150 MB/minute)
≈ 17 hours
SLO < SLA  SLO == SLA  SLO > SLA  (MNU)
October 10, 2015
#sqlsat454
Links
 Migration from federation to elastic scale
azure.microsoft.com/en-us/documentation/articles/sqldatabase-elastic-scale-federation-migration/
 Azure SQL Database Elastic Scale Ch9
channel9.msdn.com/Shows/Data-Exposed/Azure-SQLDatabase-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/
October 10, 2015
#sqlsat454
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
October 10, 2015
#sqlsat454
Q&A
 Questions?
October 10, 2015
#sqlsat454
#sqlsat454
You can clap your hands now and don’t forget to put your feedback
at http://speakerscore.com/454IMASDB
THANKS!
October 10, 2015
#sqlsat454