Azure SQL DTU level increase and decrease with powershell schedule - sql-server

We have a REPORT database in Azure.
Every morning, we need some complex sql procedures to work inside that server.
Normally DTU level of this server is 0. but only in the mornings, it needs to be updated to DTU level 3.
We are now making this manually by ourselves. But we want this to be automated via Powershell or anything.
how can we achieve this.
Can you show us the way please because we are .NET developers and don't know anything about scripting languages.
Thanks for reading and hope you can help us.

There are powershell script, azure cli and API that you can use to manage Elastic Pools.
Powershell: For more information check here
Set-AzSqlElasticPool -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -Dtu 1000 -DatabaseDtuMax 100 -DatabaseDtuMin 20
Azure Cli: Check here for more information
az sql elastic-pool update -g mygroup -s myserver -n mypool -c
API: Check here for details.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}?api-version=2017-10-01-preview

Single Azure SQL Database supports manual dynamic scalability, but not autoscale. For a more automatic experience, consider using elastic pools, which allow databases to share resources in a pool based on individual database needs. However, there are scripts that can help automate scalability for a single Azure SQL Database. For an example, see Use PowerShell to monitor and scale a single SQL Database.
Hope this helps.

Related

Azure availability set: IIS + SQL Server

Can someone please explain me what I need to do in order to make my websites available all the time using Microsoft azure.
At the moment I have just one dedicated server with IIS (running 7 websites) and SQL Server - all on one machine. Beside this I use Redis-lab as cloud service for hosting Redis cache.
I'm more or less happy how this works, but in case that something happens with server, or I need to restart it of course my website goes down which is not good of course.
So in order to make mitigate some of risks what exactly I need to do?
Am I correct in flowing thinking?
Option 1 - I need one more machine in an availability set with load balancer. This solution is not great as one server will still have an instance of SQL Server running = if that server goes down, websites on the second server will not work as the database is down
Option 2 - I need 3 more servers. 2 for IIS in a load balanced environment and 2 for SQL Server - which is super expensive solution.
Option 3 - 2 more servers. Where existing server and the new one will be for IIS (load balanced) + 3rd server with database. The database server will be write only. Both IIS severs will have an instance of ms SQL running in readonly mode => content from database server will be replicated to their databases. In this scenario if SQL Server goes down websites will still work as they will pull data from their own read only databases
Are there any other options?
Thanks
Regarding other options have you considered the option of moving the databases to Azure SQL which would give you redundancy out of the box? Similarly if you can move the websites to Azure App Service you can get the same for the sites.
Yes, you definitely need the availability set for your deployment. Please, take a look at Azure availability checklist written by Microsoft.
I would propose you to migrate your web apps to the Azure Web Apps + set up the SQL Server deployment according to the availability best practices. Migrating them to the web apps as a service will eliminate some administrative tasks and the problem of placing all of the eggs in the same basket. You can place them to the one Web Apps Pricing Plan and change that plan when needed, for example, from more powerful resources to least powerful (or from the paid one to the free one for all of your sites).
If SQL Azure is not a solution for you, and (from my point of view) the data source is more critical than frontent/.../, it is highly recommended to deploy SQL Sever according to the tutorials provided above.

Mirroring Azure SQL Database to an on-premise SQL Server

I have a database deployed on Azure SQL. Due to various requirements, my company would like to make a continuous mirror of this database to an on-premise SQL Server database. We have explored several ways to implement this, so far to no avail.
The way recommended online, using the Azure Sync tool, didn't work for us -- and seeing as this tool is currently in CTP, it is not currently supported by Microsoft, so we want to implement this ourselves.
The requirements for this mirroring solution aren't extremely high - we only want to make backups every half an hour or so, so continuous synchronization isn't an issue. What would be the best way to approach this without resorting to commercial solutions that seem to be an overkill for us?
Hummm... it depends what you call an overkill. One way to do this is to wrap up your own BCP commands out of SQL Azure, and BCP into a database on premises. But depending on your database complexity, this may very quickly get out of hands, unless you can identify the top 2 or 3 tables that you really want to export/import to minimize your work. In fact you might event want to consider using SSIS; you will need to manage your own retry logic regardless of the approach you take.
We ended up choosing a complete backup-restore from the Azure account to the on-premise VM, since implementing custom retry & incremental query generation sounded way too complicated for this case.
Azure SQL Database support Import Export Database Service including Automated Exports to Azure Storage account.
Using Automated Exports you can define the export interval per day and bacpac files will be created in your Azure storage account which can be imported into your on-premise server.
You can find more detail about Configuring Automated Exports

What is the best way to sync data into Azure from a SQL server

I have a SQL 2012 database that I want to sync/replicate up into Azure.
Because we intend to use this in production we cannot use the Azure Sync tool that is currently in preview.
This needs to be near real time, and only one directional. (Only ever pushing data to Azure like a cache)
What are some recommended tools for doing this?
In my opinion:
SSDT - Sql Server Data Tools
http://thomaslarock.com/2013/01/sql-server-data-tools-why-must-life-be-so-hard/
http://msdn.microsoft.com/en-us/library/dn266028(v=vs.103).aspx
http://msdn.microsoft.com/en-us/data/tools.aspx
if you're using Azure SQL Database, you can have a look at SSIS, Sync Framework, etc...
the biggest challenge you'll have is not the sync, but the near real time requirement that you have.
The best approach to this problem is to use the Sync Framework, create an agent that sits on a Worker Role in your Azure environment, and a client agent that is on your network.
Here is an end-to-end sample: http://code.msdn.microsoft.com/Windows-Azure-Sync-Service-60293622
Here is another option, this one uses a two-tier approach that is simpler and may be more suited to your push-only scenario: http://blogs.msdn.com/b/zkap/archive/2012/04/12/synchronize-sql-server-and-sql-azure-using-sync-framework.aspx

Azure Database Installation Error "Invalid Object name 'Categories' "

I am completely ignorant in relation to databases and servers etc. Please bear with me.
I am trying to install a program called RealProspect 2009 which allows both local and remote sql database installation. Both types are done using the program installation .exe.
I have an azure account on which I have set up a server, and a database. During the program installation I am asked to provide the SQL server address, SQL server name, SQL username and SQL password. Using the information provided in the Azure online tools, I input all of this information into the fields and the program commences installing the database on the remote location. If I use incorrect information in these fields the installation returns an error and tells me it cannot log in, or the IP is not allowed etc., so I know it's actually attempting to connect and verifying the connection credentials.
When I use the correct server and login information the program proceeds. It spends several minutes "Creating the Tables". When it finishes doing that it attempts to begin "Installing Default Data (Categories)". At this point the program stops and I get the error in the subject line of this post "Invalid Object name 'Categories' "
I don't know enough to tell you what I don't know about this process.
I just signed up for Azure specifically because hosting the database with Azure is like $5-10 per month and I want myself and several other participants to be able to use the software with a common database. I created the server and database using the gui "tools/how to" from within the online Azure portal and I have never written a script, or accessed the server/database using anything other than the online GUI.
Thank you in advance for any help you may be able to provide. I hope i'm not too much of a speed bump to your day.
P.S. - For what it's worth you can download a free trial of the software from realinvestorsoftware.com and see if you could install it on a remote server. Maybe you can better see what I see and tell me how to do it on my own?
SQL Azure is VERY similar to SQL Server but there are a few features that SQL Azure doesn't support. That said, I'd be surprised if the app's installer is using any of the features that are unsupported by SQL Azure. My guess is that there's a bug in their installation scripts that might fail on more modern versions of SQL Server (note, their app installs on SQL Express 2005 which is no longer in mainstream support).
Just a couple of other thoughts for you: You get keys to install the app on two machines but:
"If you would like to install on more than two computers, then after you order your copy of RealProspect you can login to your customer account on this website and order additional activation keys for only $97 each."
Because you're going to be paying several hundred dollars anyway, and because (you yourself admit) you're not a database expert, it may be less cost, stress and hard-work to use their $27 per month database hosting service. That way you can concentrate on building your business while they take care of the technology.
[Update: 3/27/2013 # 23:05]
Another option Chris presented was to install the app and database locally and then migrate the database to Azure.
While this is potentially feasible, it requires some finesse to execute.
Microsoft provides a DB migration guide presenting several (pretty manual) options.
You might also want to read this thread which discusses how to migrate your DB via a DACPack.
Another option is to download and use the SQL Azure Migration Wizard which should do most of the heavy-lifting for you and make your DB migration simpler.
However, note that it is possible that the DB the app uses may use features of SQL Server that are not supported on SQL Azure. Hopefully this isn't the case, but be aware that this may be an issue.
Good luck :)
Chris,
I think SQL Database Migration Wizard v3.9.10 & v4.0.13 will solve your problem, I have used this tool several time to migrate db from local machine to sql azure, the most beauty of this tool it also highlights the error or sql which couldn't be migrated to Azure, so we can easily find alternate syntax of such sql queries

Does anyone have a backup strategy for SQL Azure databases?

I'm using SQL Azure on a project and it works great. The problem is that the usual backup features do not exist. I have exported the database a couple of times using SQLAzureMW ( http://sqlazuremw.codeplex.com/ ) but this tool is now choking trying to download the database data with bcp. In any case, it's not as nice a solution as SQL Server backups.
Is anyone aware of a commercial or open source tool, or other technique, for making reliable backups of SQL Azure databases? This is really a showstopper.
Starting with update 4, SQL Azure now supports database copies. You can make a copy of your database, kept in Azure, and use that to retrieve data in the event of an accidental deletion or schema bugaboo:
http://msdn.microsoft.com/en-us/library/ff951624.aspx
It's still up to you to get that database off Azure and onto your own local SQL Server, though, but at least you've got a mechanism for making a point-in-time copy.
Microsoft takes care of the backups for you. There is no reason to back up SQL Azure databases yourself.
Yes, we had the same problem and couldn't find any good/simple solutions, so we cobbled together a solution using Red Gate: http://mooneyblog.mmdbsolutions.com/index.php/2011/01/11/simple-database-backups-with-sql-azure
SQL Azure will support PIT (Point in time) backup/restore (mainly restore) later this year (2011), CTP in summer. There is some (little) preliminary info here info here.

Resources