I am moving from an onprem SQL Server managed instance to a Azure SQL Database. My issue is that given the lack of a Sql Agent I am forced to run a Azure Function to automate some stored procedures that we`re running.
Here is the issue:
Azure Function cannot run more than 10 minutes (without a big hassle) my archiving job runs for about 40 minutes.
sp_start_job - does not exist in Azure SQL
Trying to find a way to not keep open the connection from Azure function.
Thanks in advance all help is appreciated
I think You could using Data Factory to help you schedule execute the stored procedures.
Create a pipeline with on or more Stored Procedure activities:
Add trigger to schedule the pipeline running:
And #Chetan Ranpariya also provided the good suggestions for you. Ref:
https://learn.microsoft.com/en-us/azure/azure-sql/database/job-automation-overview
https://www.netwoven.com/2017/12/12/schedule-execution-sql-jobs-azure-automation-service/
Hope this helps.
Related
We are having real time application which is hosted on on-premises(IIS) using .Net core 2.1. Whenever there is an update happening in a table, we have to capture the change and show in page and to achieve this we have implemented SignalR. Since we are using Azure SQL db, we couldn't SQLTableDependency as it doesn't have Service Broker.
Current Implementation:
We have created a Stored procedure to check the records which captures changes and where timeout for stored procedure is set to 90 sec. Once the execution completes it captures the change and push it to front-end. In order to achieve this, we have kept a loop running for 10 min in back-end.
Problem Statement:
As number of users increases, the overall SQL CPU consumption is high. Is there a way to reduce the CPU cost or any other approach to get real time data using Azure SQL db and SignalR?
SignalR Service is a fully managed Azure service that simplifies the process of adding real-time web functionality to applications over HTTP.
It seems there is less compatibility between Azure SQL and SignalR. From this discussion also we can see that there is a compatibility issue between these two.
The solution to this problem is to use SQL server instead of Azure SQL DB. You can install SQL Server on one of the servers or another option is to install SQL Server in one VM on Azure.
You can follow this two documents for the process:
SignalR Scaleout with SQL Server.
SignalR with SQL Server.
I'm implementing an application to sync data from a remote mysql server to local mysql database. Without the main part (Synchronization) I have almost done with the application.
I want to know how to synchronize my local mysql database from a remote mysql database. I'm ok if it want to run from PHP scrip. but, if it runs from PHP script I want to know how to call php script from C# application. So the application can call php and sync at a certain time. Apologize if my question is unclear to you.
Any help on this would be great.
Thanks in Advanced!
Why you cant setup master -slave replication with your local database. Here is more information.
Here is good starting point.
Mysql database sync between two databases
Generally with SQL Server, I could setup a job and have it run every so often. Something like this. However SQL Server Azure does not seem to have this ability.
My thoughts were to instead, have a service that runs this procedure every x minutes. I'm just wondering if anyone sees any issues with that, or has any better suggestions?
The stored procedure takes some xml data stored in one table and normalizes it across other tables making it easier to query on.
You can schedule jobs using the new Scheduler:
http://weblogs.asp.net/scottgu/archive/2012/12/21/great-updates-to-windows-azure-mobile-services-web-sites-sql-data-sync-acs-media-more.aspx
More Detail:
http://www.windowsazure.com/en-us/develop/mobile/tutorials/schedule-backend-tasks/
If you are open to using a service, Cotega offers the ability to schedule execution of stored procedures from within SQL Azure. You can read more about how to schedule these jobs here.
Full disclosure, I work on this service.
You can trigger scheduled task running procedure directly from your application using, for example, Quartz.
I am trying to write a SQL job to run every 10 minutes and to execute a console application that I wrote in C#.
It would be really helpful if someone could help.
What you want is a SQL Server Agent Job, with a CmdExec step (which can execute a windows command line). This is explained here: http://msdn.microsoft.com/en-us/library/ms190264.aspx
If security is a concern, it can be secured through the use of a SQL Agent Proxy definition. This is explained here: http://msdn.microsoft.com/en-us/library/ms189064(SQL.105).aspx
I want to try out to run my C# console application from SQL Job. So to test it, I simply created a console application and using C# and SMO, wrote few lines to create a database. I could run it successfully and it creates a database in the SQL Server as expected.
Then in IDE, I clicked on Build-->Publish myProject to E:\myFolder\MakeNewDB24 because that's where my SQL Server resides on.
The above action copied the following files to the specified location i.e., E:\myFolder\MakeNewDB24
Application Files
setup.exe
myProject.application
Then I opened my SQL Server, created a job by
rt. clicking Jobs Folder-->New Job.
I filled all the information in General.
In Steps, I have under Command,
\\mySQLServer\myFolder\MakeNewDB24\setup.exe
Type: Operating System(CmdExec)
Run as: SQL Server Agent Service Account
I ran the job. It showed the result as "Success"
When I viewed the History,
Executed as user: mySQLServer\SYSTEM. The step did not generate any output. Process Exit Code 0. The step succeeded.
I was happy. But when I went to check the database that was supposed to be created, its not available, meaning the SQL JOb didn't do its job to create my db.
I don't know what am I missing here? If anyone has knowledge on this, please kindly share with me. I really really want to see my SQL Job do this work. The reason I m using SQL job is because all of my automation tasks start from here. Thanks.
Your problem almost certainly has to do with permissions. You need to check the user id used for running the SQL Server Agent job. My guess is that it doesn't have permissions somewhere along the line.
The reason that your job returns success is because CMD jobs always return success if they successfully launch the CMD executable. It has nothing to do with whether or not your code succeeded.
In environments where I don't have to worry about security, I have gotten into the unfortunate habit of giving everything admin privileges, so I don't have to worry about what privileges are needed where. Good luck.