Skip to content

Commit ab90244

Browse files
authored
Merge pull request #103677 from dimitri-furman/dimitri-furman
Clarified elastic job usage scenarios
2 parents f0814dd + 432053f commit ab90244

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

articles/sql-database/elastic-jobs-tsql.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
1010
ms.author: jaredmoo
1111
author: jaredmoo
1212
ms.reviewer: sstein
13-
ms.date: 01/25/2019
13+
ms.date: 02/07/2020
1414
---
1515
# Use Transact-SQL (T-SQL) to create and manage Elastic Database Jobs
1616

@@ -183,10 +183,13 @@ For example, to group all results from the same job execution together, use the
183183

184184
The following example creates a new job to collect performance data from multiple databases.
185185

186-
By default the job agent will look to create the table to store the returned results in. As a result the login associated with the credential used for the output credential will need to have sufficient permissions to perform this. If you want to manually create the table ahead of time then it needs to have the following properties:
186+
By default, the job agent will create the output table to store returned results. Therefore, the database principal associated with the output credential must at a minimum have the following permissions: `CREATE TABLE` on the database, `ALTER`, `SELECT`, `INSERT`, `DELETE` on the output table or its schema, and `SELECT` on the [sys.indexes](https://docs.microsoft.com/sql/relational-databases/system-catalog-views/sys-indexes-transact-sql) catalog view.
187+
188+
If you want to manually create the table ahead of time then it needs to have the following properties:
187189
1. Columns with the correct name and data types for the result set.
188190
2. Additional column for internal_execution_id with the data type of uniqueidentifier.
189191
3. A nonclustered index named `IX_<TableName>_Internal_Execution_ID` on the internal_execution_id column.
192+
4. All permissions listed above except for `CREATE TABLE` permission on the database.
190193

191194
Connect to the [*job database*](sql-database-job-automation-overview.md#job-database) and run the following commands:
192195

articles/sql-database/sql-database-job-automation-overview.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: overview
99
author: jovanpop-msft
1010
ms.author: jovanpop
1111
ms.reviewer: carlr
12-
ms.date: 01/25/2019
12+
ms.date: 02/07/2020
1313
---
1414
# Automate management tasks using database jobs
1515

@@ -197,7 +197,9 @@ The *Job database* is used for defining jobs and tracking the status and history
197197

198198
For the current preview, an existing Azure SQL database (S0 or higher) is required to create an Elastic Job agent.
199199

200-
The *Job database* doesn't literally need to be new, but should be a clean, empty, S0 or higher service tier. The recommended service tier of the *Job database* is S1 or higher, but really depends on the performance needs of your job(s): number of job steps, how many times, and how frequently jobs are run. For example, an S0 database might be sufficient for a job agent that runs few jobs an hour, but running a job every minute might not be performant enough, and a higher service tier might be better.
200+
The *Job database* doesn't literally need to be new, but should be a clean, empty, S0 or higher service objective. The recommended service objective of the *Job database* is S1 or higher, but the optimal choice depends on the performance needs of your job(s): the number of job steps, the number of job targets, and how frequently jobs are run. For example, an S0 database might be sufficient for a job agent that runs few jobs an hour targeting less than ten databases, but running a job every minute might not be fast enough with an S0 database, and a higher service tier might be better.
201+
202+
If operations against the job database are slower than expected, [monitor](sql-database-monitor-tune-overview.md#monitor-database-performance) database performance and the resource utilization in the job database during periods of slowness using Azure portal or the [sys.dm_db_resource_stats](https://docs.microsoft.com/sql/relational-databases/system-dynamic-management-views/sys-dm-db-resource-stats-azure-sql-database) DMV. If utilization of a resource, such as CPU, Data IO, or Log Write approaches 100% and correlates with periods of slowness, consider incrementally scaling the database to higher service objectives (either in the [DTU model](sql-database-service-tiers-dtu.md) or in the [vCore model](sql-database-service-tiers-vcore.md)) until job database performance is sufficiently improved.
201203

202204

203205
##### Job database permissions
@@ -246,6 +248,10 @@ The following examples show how different target group definitions are dynamical
246248
**Example 5** and **Example 6** show advanced scenarios where Azure SQL Servers, elastic pools, and databases can be combined using include and exclude rules.<br>
247249
**Example 7** shows that the shards in a shard map can also be evaluated at job run time.
248250

251+
> [!NOTE]
252+
> The Job database itself can be the target of a job. In this scenario, the Job database is treated just like any other target database. The job user must be created and granted sufficient permissions in the Job database, and the database scoped credential for the job user must also exist in the Job database, just like it does for any other target database.
253+
>
254+
249255
#### Job
250256

251257
A *job* is a unit of work that is executed on a schedule or as a one-time job. A job consists of one or more *job steps*.

0 commit comments

Comments
 (0)