Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Add SQL Server Agent Management to SQL Operations Studio

$
0
0

By: Rajendra Gupta || Related Tips:More > SQL Operations Studio

Problem

SQL Operations Studio is a new tool that runs on windows, macOS, and linux, and aims to simplify management for SQL Server on Windows, Linux, Azure SQL Database, and Azure SQL Data Warehouse. SQL Operations Studio provides support for extensions, which is a nice way to extend features and enhancements. Let's explore how to setup SQL Server Agent for SQL Operations Studio.

Solution

Extensions in SQL Server are a way to provide add-on functionality by Microsoft as well as third party users. As we discussed earlier in my tips about SQL Operations Studio , below are the SQL Operations Studio versions.

Release Date Release Version Description November 15, 2017 0.23.6 Initial release of SQL Operations Studio December 19,2017 0.24.1 December Public Preview January 17,2018 0.25.4 January Public Preview February 15,2018 0.26.7 February Public Preview March 28,2018 0.27.3 March Public Preview April 25, 2018 0.28.6 April Public Preview May 7, 2018 0.29.3 May Public Preview June 20,2018 0.30.6 June Public Preview July 19, 2018 0.31.4 July Public Preview August 30, 2018 0.32.8 August Public Preview

To view the SQL Operations Studio version, go to Help > About.


Add SQL Server Agent Management to SQL Operations Studio
.

Inthis previous tip we explored these extensions:

Server Reports WhoIsActive Extension RedGate SQL Search Extension

SQL Operations Studio does not support SQL Server Agent by default. I feel that withoutSQL Server Agent this tool is not complete. In this tip, we'll explore how setup the SQL Server Agent extension in SQL Operations Studio.

SQL Server Agent Extension

SQL Operations Studio provides supports for SQL Server Agent using the SQL Server Agent extension.

With this extension, we can:

View SQL Server Agent Jobs Configured on a SQL Server View Job History with job execution results Basic Job Control to start and stop jobs Create or Edit SQL Server Agent Jobs View, Configure Operators, Alerts Create Proxy accounts

To install SQL Server Agent, click on the extension in the marketplace.


Add SQL Server Agent Management to SQL Operations Studio

This opens a web page in a new tab that shows the basic details about the SQL Server Agent extension. Click on Install and Reload.

.
Add SQL Server Agent Management to SQL Operations Studio

Now we can see that the SQL Server Agent Extension is installed.


Add SQL Server Agent Management to SQL Operations Studio

In order to launch the SQL Server Agent extension, connect to the database instance, right click on the instance and select the Manage option.


Add SQL Server Agent Management to SQL Operations Studio

We can see SQL Agent as a tab in the server dashboard.


Add SQL Server Agent Management to SQL Operations Studio

Click on the SQL Agent tab and it opens the below window.


Add SQL Server Agent Management to SQL Operations Studio

In the left sidebar, we can see these options:

Jobs Alerts Operators Proxies

Let's explore the SQL Server Agent extension options and see how useful SQL Operations Studio can be.

Jobs in SQL Server Agent Extension

When we launch SQL Server Agent Extension, by default it opens up in the Job tab, which shows all the configured jobs for that particular instance and the history.

In the jobs dashboard, we can see the below important columns:

Name : Job Name Last Run : Last execution time of the job. Next Run : If the job is scheduled, it shows the next run time of the job. Enabled : If the job is enabled, then yes else no Category : If we have defined a job category in Job configuration, it shows the category from the below list. The default value is [Uncategorized [Local]]. Categories help filter jobs based on a particular category.
Add SQL Server Agent Management to SQL Operations Studio
Scheduled : If the Job is scheduled then Yes else No. Last Run Outcome :The last outcome of the job execution. It can show these values: failed, succeeded, retry, canceled, in progress. The status of Unknown shows that the job has not been run. Previous Runs : An interesting and nice enhancement to view job run trends. This shows the graphical history of the job execution with Green and Red color bars. Green Bars: For successful job execution Red bars: For failed job execution

For example, in the below screenshot, we can see that two instances of the job failed while others were successful.


Add SQL Server Agent Management to SQL Operations Studio

You can check the job execution time by placing the cursor over the bar.


Add SQL Server Agent Management to SQL Operations Studio

You can also see the height of the bars are different. The height of the bar depends upon the job execution time. We can see the difference in the execution time of a job.


Add SQL Server Agent Management to SQL Operations Studio

In the jobs, we can also see a bar on the left as shown below. This bar shows the last job run outcome.


Add SQL Server Agent Management to SQL Operations Studio

To refresh the jobs dashboard, click on the Refresh icon towards the upper right corner.


Add SQL Server Agent Management to SQL Operations Studio

Now let me run a job and make it fail to see the behavior in the dashboard.

We can see the below changes in the SQL Server Agent job dashboard.

Last run outcome bar becomes Red This also shows the failed job reason Previous runs also adds a failed bar
Add SQL Server Agent Management to SQL Operations Studio

If we want to view the detailed job history, click on the particular job. For example, below we can see the job history for the DB Backup Job.


Add SQL Server Agent Management to SQL Operations Studio
Scroll down to the screen and we can see the step history for the job. Currently, there seems to be some formatting issue as we cannot scroll

Viewing all articles
Browse latest Browse all 3160

Latest Images

Trending Articles