I am new to SQL Azure, we have taken the subscription of Azure SQL elastic pool.
I have two databases in my local SQL Server and it has a stored procedure which internally is calling msdb.dbo.sp_send_dbmail and I have scheduled these stored procedures to run in a job (SQL Server Agent -> Scheduler).
I want to move these two databases along with DB-mail accounts and SQL Server jobs to Azure. I am finding difficulties as in my subscription I am not able to see msdb, SQL Server Agent and database email. We want to go with only SQL Azure as service, no need your support on these.
I tried to deploy the database and getting the error message:
Error
SQL71562: Error validating element [dbo].[AMPLoanAgingEMail]:
Procedure: [dbo].[AMPLoanAgingEMail] has an unresolved reference to object [msdb].[dbo].[sp_send_dbmail].[#profile_name]. External references are not supported when creating a package from this platform.
The expected result is I want to move those scheduled jobs and stored procedures to my Azure.
Azure SQL database doesn't support msdb database. We can not migrate msdb to Azure or do anything with it in Azure SQL database.
For more details, please see: msdb database.
SQL server agent is only supported Azure SQL Managed Instance only.
Database email also is not supported in Azure SQL Database.
This why you can not be able to see msdb , SQL server agent and database email.
Your stored procedure [dbo].[AMPLoanAgingEMail] could not call the [msdb].[dbo].[sp_send_dbmail] in msdb. The error message also mentioned that.
For now, there isn't a solution for msdb in Azrue SQL Database.
Before migrate your database to Azure SQL database, you can use Data Migration Assistant(DMA) to help you assess your database.
Hope this helps.
Related
I'm a new PowerBI developer.
I am inserting data from the Azure SQL database via SSMS.
I don't have access to a server agent for being able to create jobs.
I just want to run 4-5 queries (1 query = 1 step for my job). Is there a simple way to do this automatically for example?
Well, there's no server agent in Azure SQL DB, so you cannot create jobs as you do in on-prem or on Azure VM installations.
However, you do have Elastic jobs on Azure which can run queries on Azure SQL Database periodically.
See the documentation here.
I have some procedures created in Azure DWH and need to schedule to procedures daily.
Earlier we used to run them using SQL Agent but looks like thats not possible in Synapse
Unfortunately, Azure Synapse Analytics doesn't support scheduling stored procedures.
Stored procs were recently released on the serverless SQL pool engine side. Synapse Studio support yet to come.
Refer: Using stored procedures in Synapse SQL pool
This scenario is possible by using Synapse Pipelines inside Azure Synapse Studio.
Open your Azure Synapse Analytics workspace
Go to Integrate activity hub
Create new Pipeline
Drag & Drop activity called: "SQL Pool Stored Procedure"
Select SQL dedicated pool where you would like to execute store procedure
Select store procedure which you would like to execute
Trigger the pipeline by clicking "Add trigger" and then Trigger now (for example)
In the Monitor activity hub you can see the results of that pipeline and stored procedure inside.
If you are having Dedicated pool (formerly known as SQL DW gen2) then you can upgrade it to Workspace lite and then follow same steps as for standard workspace above.
If you would like to schedule queries using the serverless approach on Synapse you need to use the stored procedure activity in the ADF pipeline.
Steps followed (with useful resources):
Create the serverless SQL database and connect it to your external storage (https://learn.microsoft.com/en-us/azure/synapse-analytics/get-started-create-workspace)
Create and test a SQL query on the db
Create a stored procedure from the SQL query and save it to the db. (https://endjin.com/blog/2021/08/managing-schemas-in-azure-synapse-sql-serverless)
Create a ADF pipeline and select a stored procedure activity.
Create a linked service, where you link the serverless db endpoint. This endpoint can be found in the Azure Portal under the Synapse workspace. You will need to make sure of permissions on the db to enable connection.
In the stored procedure activity, link to the created linked service. The stored procedure should then be selectable.
Merge the feature branch to the main branch and publish.
Create a trigger and link it to the published pipeline.
IN my scenario need to take azure sql database backup and restore in another azure sql database server.I have done it using Export and Import . But i need to take the backup of users from one DB to another with permissions.
You can use the script for creating a script that can be run on the exported/imported database to create users. Here is the script -
https://dba.stackexchange.com/questions/190475/scripting-out-database-user-level-permissions
If the need is to move the On premises Logins to Azure SQL DB:There is a utility to move On-Premises SQL Server Logins to Azure SQL DB.
This scenario is documented in the Data Migration Assistant guide
Hope this helps.
Thanks
Navtej S
I have a backup file of an mssql database using which I would like to create a database in Azure SQL.I see option for restoring a database in azure. But I dont find an option to create a database in Azure SQL from an external backup file.kindly advise.
The data import steps might not be same as how we restore an on premise sql database.
The Data can easily be restored from a azure backup in azure portal ( just import it into a new sql db).
For migrating an on-premise sql database to azure sql database Microsoft provides a tool DMA (Data Migration Assistant). This tool provides a wizard based step by step approach to connect to your on-premise sql database source , select the objects to migrate , generate a script , follow the migration progress and errors if any during the process.
A few changes might be required post migration in the Azure sql database to update the pricing tier , performance and compatibility level.
Here is a document demonstrating a step by step process to migrate an on-premise sql database to azure sql database - https://learn.microsoft.com/en-us/azure/sql-database/sql-database-migrate-your-sql-server-database
Is there a script or function in sqlserver2005 that i can backup the jobs and login details of a server from the master database?
Jobs are stored in the MSDB database and logins in the Master database.
You can backup these system databases as you would any other of your user databases. Use the Management Studio GUI or via the "backup database.." TSQL syntax.
See this article on backing up your system databases. With specific considerations for the backing up master and backing up MSDB.