You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/sql-database/elastic-jobs-tsql.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ ms.topic: conceptual
10
10
ms.author: jaredmoo
11
11
author: jaredmoo
12
12
ms.reviewer: sstein
13
-
ms.date: 01/25/2019
13
+
ms.date: 02/07/2020
14
14
---
15
15
# Use Transact-SQL (T-SQL) to create and manage Elastic Database Jobs
16
16
@@ -183,10 +183,13 @@ For example, to group all results from the same job execution together, use the
183
183
184
184
The following example creates a new job to collect performance data from multiple databases.
185
185
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:
187
189
1. Columns with the correct name and data types for the result set.
188
190
2. Additional column for internal_execution_id with the data type of uniqueidentifier.
189
191
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.
190
193
191
194
Connect to the [*job database*](sql-database-job-automation-overview.md#job-database) and run the following commands:
Copy file name to clipboardExpand all lines: articles/sql-database/sql-database-job-automation-overview.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.topic: overview
9
9
author: jovanpop-msft
10
10
ms.author: jovanpop
11
11
ms.reviewer: carlr
12
-
ms.date: 01/25/2019
12
+
ms.date: 02/07/2020
13
13
---
14
14
# Automate management tasks using database jobs
15
15
@@ -197,7 +197,9 @@ The *Job database* is used for defining jobs and tracking the status and history
197
197
198
198
For the current preview, an existing Azure SQL database (S0 or higher) is required to create an Elastic Job agent.
199
199
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.
201
203
202
204
203
205
##### Job database permissions
@@ -246,6 +248,10 @@ The following examples show how different target group definitions are dynamical
246
248
**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>
247
249
**Example 7** shows that the shards in a shard map can also be evaluated at job run time.
248
250
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
+
249
255
#### Job
250
256
251
257
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