Vous êtes sur la page 1sur 10

180917 FM-BINUS-AA-FPT-66/R7

Practicum Case
COMP6119
Database Administration
Computer Science O161-COMP6119-DI01

Valid on Odd Semester Year 2017/2018 Revision 00

Learning Outcomes
 Apply SQL server features

Topic
 Session 03 – Automating SQL Server

Sub Topics
 Configuration Tasks
 Automating Routine Maintenance Tasks
 Creating jobs, Operators, and Alerts
 Automating Multi Server Jobs

Page 1 of 10
180917 FM-BINUS-AA-FPT-66/R7

Soal
Case

IndBook

IndBook has implemented the new system for a month. They found that it’s very difficult to manage
the database if you have to watch over it every time. So, you are assigned to find out the way to manage the
database automatically. After some research, you know that you can use SQL Server Agent to do particular
jobs automatically. So, you are requesting training about SQL Server Agent for all the DBA in order to ease
their work. The training is about Jobs, Operators and Alerts.

AUTOMATED ADMINISTRATION TASKS


Microsoft SQL Server allows you to automate your administrative tasks. To automate administration,
you define predictable administrative tasks and then specify the conditions under which each task occurs.
By using automated administration to handle routine tasks and events frees your time to perform other
administrative functions.

SQL SERVER AGENT


SQL Server Agent is a Microsoft Windows service that executes scheduled administrative tasks, which
are called jobs in SQL Server 2012. SQL Server Agent uses SQL Server to store job information. Jobs
contain one or more job steps. Each step contains its own task, for example, backing up a database. SQL
Server Agent can run a job on a schedule, in response to a specific event, or on demand. For example, if
you want to back up all the company servers every weekday after hours, you can automate this task.
Schedule the backup to run after 22:00 Monday through Friday; if the backup encounters a problem, SQL
Server Agent can record the event and notify you.

Page 2 of 10
180917 FM-BINUS-AA-FPT-66/R7

CREATE JOBS
A job is a specified series of actions that SQL Server Agent performs. Use jobs to define an
administrative task that can be run one or more times and monitored for success or failure. A job can run
on one local server or on multiple remote servers. This is step by step how to create a new job:
 Expand SQL Server Agent and right click on Jobs folder and choose New Job.

 A window will appear. See the picture below.

- Fill Name with the job’s name.


- Owner contain the job’s owner.
- Category for the job’s category.
- Description describe the job’s information.
- Check Enabled will make the job start right after you create it. Uncheck if you want to start the job
manually.

Page 3 of 10
180917 FM-BINUS-AA-FPT-66/R7

 Move to the Targets page to specify the server. Choose Target local server if you want the job running
just in your server. Choose Target multiple servers if you want the job running in the several servers.
This option can be chosen if you have more than one server. Click OK to finish creating the job.

 You will find your job in the Jobs folder. Expand it to see all jobs you have created.

CREATE OPERATORS
Operators are aliases for people or groups that can receive electronic notification when jobs have
completed or alerts have been raised. The SQL Server Agent service supports the notification of

Page 4 of 10
180917 FM-BINUS-AA-FPT-66/R7

administrators through operators. Operators enable notification and monitoring capabilities of SQL Server
Agent. This is step by step how to create a new operator.
 Right click on the Operator folder and choose New Operator.

 You will see a window appear. See the picture below.

Page 5 of 10
180917 FM-BINUS-AA-FPT-66/R7

 Fill in the operator name. Check the Enable if you want the operator start right after you are creating
the operator. Fill the email address, net send address and pager e-mail name to specify who will receive
the notification.
 Check the day you want the operator working. The Workday begin and Workday end specify the
working time of the operator.
 Go to the Notifications page and you will see a window like this.

 Choose Alerts if you want the operator sends notification after an alert has been raised or choose Jobs
if you want the operator sends notification after a job completed. Click OK to finish creating new
operator.

 You will find your new operator inside the Operators folder. Expand it to see your new operator.

Page 6 of 10
180917 FM-BINUS-AA-FPT-66/R7

Page 7 of 10
180917 FM-BINUS-AA-FPT-66/R7

CREATE ALERTS
An alert is an automatic response to a specific event. For example, an event can be a job that starts or
system resources that reach a specific threshold. You define the conditions under which an alert occurs.
This is step by step how to create a new alert.
 Right click on the Alerts folder and choose New Alert.

 You will see a window appear. See the picture below.

 Fill the alert name. Same with jobs and operators, check Enable if you want the alert running right after
you create it. Choose the type, SQL Server event alert for alert when an event contains errors, SQL
Server performance condition alert for alert when a performance reaches some state and WMI event
alert for alert when a WMI event happens. For example, we choose SQL Server event alert.

Page 8 of 10
180917 FM-BINUS-AA-FPT-66/R7

 Fill the database name with the database where the alert works. Specify the Error number or choose
one of the Severities.
 Go to the Response page and check the Notify operators if you want to send some notifications to
operators and check the Execute job to run a particular job when the alert rises. Click OK if you finish
editing the new alert properties.

 Go to the Alerts folder and expand it. You will see your alerts inside the folder.

Page 9 of 10
180917 FM-BINUS-AA-FPT-66/R7

PRACTICE
1. Create a new job with specified steps. The step’s configuration is up to you.
2. Create a new alert that has SQL Server performance condition alert.
3. Create a new operator that has alert notification just for the operator’s email.

Page 10 of 10

Vous aimerez peut-être aussi