Azure SQL managed instances - azure

If we opt Azure SQL managed instances in DEV,QA and PROD environment .
Will Microsoft take care the DB maintenance in terms of index rebuild or reorganize periodically etc. ?

Azure does not automatically rebuild your indexes. You need to maintain the SQL indexes.
There is a blog article on how you can automate these tasks here: https://geeks.ms/davidjrh/2015/10/08/rebuilding-sql-database-indexes-using-azure-automation/

Please read this thread on StackOverflow to know on what scenarios Microsoft recommends to rebuild indexes. See the answer provided by Connor Cunningham (Microsoft).
My personal experience is to do that daily to make sure the CPU, memory and storage space of the database is the lowest, and you don't need to assign more resources to the database. Use Ola Hallengren maintence scripts available here on GitHub.

Related

Azure Single Database GeneralPurpose Edition in Terraform

So I need to create a Single Database in Azure through Terraform.
The requirements are 8vCores/3TB.
What should be the edition that I should be passing in resource parameter "azurerm_sql_database"-->"edition"?
The documentation at https://www.terraform.io/docs/providers/azurerm/r/sql_database.html
says -- Valid values are: Basic, Standard, Premium, or DataWarehouse.
But when I create a similar database through portal, and query the DB, it says edition is 'GeneralPurpose'.
SQL Azure recently introduced a second set of choices which you can think of as a parallel (but more powerful) business model. Basic/Standard/Premium still work, but you now have additional choices. The new model supports separation of compute/memory from storage/iops more formally. It exposes General Purpose and Business Critical + exposing each generation of CPU (gen 4 vs. gen 5). As a rough starting point, you should think of standard as being close to general purpose and business critical is close to premium.
SQL DW is a somewhat different offer that is based on the PDW/APS scale-out appliance model (run as a service). So, while 3TB will fit on a single node in current generation 5 HW, if you want to run a DW SQL DW is a great choice if you think you will grow further, need scale-out processing, etc. You should not think about going between SQL DW and without app changes - in fact, you can't change between those two sets once you pick one.
You can read more about the new business model here:
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-service-tiers-vcore
This week a new option (Hyperscale) was announced as well which gives scale-out storage within SQL DB
not sure why you are looking at terraform.io rather than here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-single-databases-manage#azure-cli-manage-logical-servers-and-databases and here: https://learn.microsoft.com/en-us/cli/azure/sql/db?view=azure-cli-latest#az-sql-db-create

what type of azure resource should i use for hosting many database

I have a project where i need to host many Databases, (500 and up)
and i am trying to find what is the best option to manage everything considering all the options this days and the price.
in the past i would have a virtual server that has SQL-SERVER on it, and i would create the database on my own, and that is all.
but today
i host my current project on AZURE, a simple web server, with SQL server, with one database.
and i do not know what Resource to choose from AZURE
is it the SQL Ware House? or do i need to get a Virtual Machine?
or any other option?
i read all the information i found online, but its mostly confused me.
i hope some one could help me, i would like to know from your experience
thank you in advanced
It all very much depends on size and load of databases. You have 3 options - you can get a VM yourself and have a SQL server there. You are pretty much in control of what is happening and you can host as many DBs as you want. However you'll be in charge of backups, updates and maintenance. But this is a pretty much fixed price.
Another option is to get SQL Server from Azure - you don't need to think much about backups, encryption, updates and other boring stuff and you can get. You can have up to 5000DBs per server, but you can choose size and performance tier of your databases. However that can be expensive, as you are charged per DB.
Third option is to have Elastic Pool - this is basically a pile of DBs that are sharing the same resource. Can be useful if you have a lot of small DBs with small load. This will work out cheaper than just paying per DB on your scale. However might not work if you have very uneven load on some DBs - they can consume all the DTUs and will starve the rest of your DBs from processing power.
So it is up to you what you want to do based on your conditions. Personally I would not go with a VM - too much hassle. I would recommend considering (based on DBs load) a combination of Elastic Pool and a stand-alone DBs.

SQL Azure and Indexes

is that true that SQL Azure rebuilds / reorganizes index automatically?
We have a database on Sql Azure and experiencing performance degradation and I suppose this is a urban-legend.
Can you help me?
Thanks,
Marco
SQL Azure does not rebuild indexes automatically while the statistics are updated automatically.
If you have a specific reason to force the rebuild it, you have to directly issue the command.
This nice post helps you create a script to dynamically rebuild all indexes in a SQL Azure db.
Sql Azure offers few nice amenities with it, as follows:
Intelligent Performance
Performance overview
Performance recommendations
Query Performance Insight
Automatic tuning
Keep an eye on the statistics, You can also allow azure to automatically tune your database indexes, add, remove them to tune database performance.
Hope it helps.

aspnet_regsql and deployment to Azure

I'm pretty new to Azure and trying to work on deploying an already existing MVC 3 website (I'm late to the project).
It has membership information (where the tables should be genned from aspnet_regsql) and it links those tables to application specific tables. To get it into a working state I need to insert some form of "default data" as the code does (unfortunately) make some assumptions about what should be in the database.
No bother, I have an app that creates a default database and inserts the required data. I can then import that into Azure, this doesn't work as Azure demands clustered indexes. This is because aspnet_regsql creates some auth table keys as unclustered so I'm now left having to alter these tables as part of the process to make the primary keys clustered.
I was just wondering if aspnet_regsql had been superceded somehow due to Azure demanding clustered indexes? Am I missing a trick here or is writing a script to modify the clustering of these indexes the sensible approach?
Found the solution elsewhere here:
http://support.microsoft.com/kb/2006191/de
If you use the Universal Providers, you don't need the scripts.
Check out Hanselman's post. The Universal providers will manage the database creation if you are working with SQL Server, Compact Edition, or Windows Azure Database
There are a lot of references to updated scripts including some on my own blog that are no longer needed.

SQL Azure Profiling

I read on the MS site that SQL Azure does not support SQL Profiler. What are people using to profile queries running on this platform?
I haven't got too far playing around with SQL Azure as yet, but from what I understand there isn't anything you can use at the moment.
From MS (probably the article you read):
Because SQL Azure performs the
physical administration, any
statements and options that attempt to
directly manipulate physical resources
will be blocked, such as Resource
Governor, file group references, and
some physical server DDL statements.
It is also not possible to set server
options and SQL trace flags or use the
SQL Server Profiler or the Database
Tuning Advisor utilities.
If there were to be an alernative, I'd imagine it would require the ability to set trace flags which you can't do, hence I don't think there is an option at the moment.
Solution? I can only suggest you have a local development copy of the db so you can run profiler locally on it. I know that won't help with "live" issues/debugging/monitoring but it depends on what you need it for.
Edit:
Quote from MSDN forum:
Q: Is SQL Profiler supported in SQL
Azure?
A: We do not support SQL Profiler in
v1 of SQL Azure.
Now, you could interpret that as a hint that Profiler will be supported in future versions. I think it will be a big requirement to get a lot of people on board, using SQL Azure seriously.
Update as of 9/17/2015:
Microsoft just announced a new feature called Index Advisor:
How does Index Advisor work? Index Advisor continuously monitors your
database workload, performs the analysis and recommends new indexes
that can further improve the DB performance.
Recommendations are always kept up-to-date: As the DB workload and
schema evolves, Index Advisor will monitor the changes and adjust the
recommendations accordingly. Each recommendation comes with the
estimated impact to DB workload performance: You can use this
information to prioritize the most impactful recommendations first. In
addition, Index Advisor provides a very easy and powerful way of
creating the recommended indexes.
Creating new indexes only takes a couple of clicks. Index Advisor
measures the impact of newly created indexes and provides a report on
index impact to users. You can get started with Index Advisor and
improve your database performance with the following simple steps. It
literally takes five minutes to get accustomed with Index Advisor’s
simple and intuitive user interface. Let’s get started!
Original Answer:
SQL Azure now has some native profiling. See http://blogs.msdn.com/b/benko/archive/2012/05/19/cloudtip-14-how-do-i-get-sql-profiler-info-from-sql-azure.aspx for details.
Microsoft's stated position SQL Server Profiler is deprecated. As much as this is a bad idea, that's what they have said.
SQL Profile is already deprecated in SQL Server, and that’s part of
the reason that it doesn’t make sense to bring to SQL DB.
What this means is you are going back 20+ years in database performance monitoring and everyone is going to have to write their own perf monitoring scripts instead of having a standard factory delivered tool that's on every server you will go to. It's tantamount to deprecating "sp_help" and making every DBA write their own. Hope you know all your DMVs inside and out... INNER JOIN, OUTER JOIN, and CROSS APPLY syntax really well.
Update as of 2017/04/14:
Microsoft's Scott Guthrie today announced a lot of new features in SQLAzure(this is called sqlazure managed instance,which is currently in preview),which are expected to be present in SQLAzure in coming months..below are them
1.SQLAgent
2.SQLProfiler
3.SQLCLR
4.Service Broker
5.Logshipping,Transactional Replication
6.Native/Backup restore
7.Additional DMV's and Xevents
8.cross database querying
References:
https://youtu.be/0uT46lpjeQE?t=1415
I have tried today a new tool suggested by Microsoft that is called Azure Data Studio.
In this tool you can download an extension called Profiler and it seems to be working just as expected.
You can use Query store feature, look here for more details: http://azure.microsoft.com/blog/2015/06/08/query-store-a-flight-data-recorder-for-your-database/
The most close to SQL profiler, that I found working in Azure SQL, is SQL Workload Profiler
However note, that it’s beta version of a tool, created but a single person, and it is not too convinient to use.
SQL Azure offers following features to tune performance, profile queries in its own way, identity long running queries and much more
Intelligent Performance
Performance overview
Performance recommendations
Query Performance Insight
Automatic tuning

Resources