Manage SQL Server Agent Flashcards
How do you see what jobs are running and what the finished status was of ones that have completed?
Job Activity Monitor
What is the system table to get Job Information?
use [msdb]
go
SELECT * FROM SYSJOBS
What system table is used for the Job Setup (Including actions that it will take?)
SYSJOBSTEPS
USE [MSDB]
GO
SELECT * FROM SYSJOBSTEPS
What system table is used to see information about job time run from beginning to end?
SYSSESSIONS
SYSJOBACTIVITY
SYSJOBHISTORY
What is the system table that shows the schedules and types?
SYSSCHEDULES
What is the syntax for RAISERROR?
RAISERROR(ID, SEVERITY, STATE) –STATE = 1 usually
For custom errors, you need to add a line to sys.messages using EXEC sp_addmessage
How do you get an alert to run when RAISERROR has happened?
Use WITH LOG in the RAISERROR command:
RAISERROR(50001, 16, 1) WITH LOG
What are the steps to be able to send an email from an alert or job?
Configure database mail from Management->Database Mail
Create a new Operator (Agent->Operators->New Operator)
Go into the alerts or jobs and set the operator as a receiver of emails