Lab Answer Key: Module 10: Monitoring SQL Server With Alerts and Notifications Lab: Monitoring SQL Server With Alerts and Notifications
Lab Answer Key: Module 10: Monitoring SQL Server With Alerts and Notifications Lab: Monitoring SQL Server With Alerts and Notifications
1. EEnsure
ste that the 20764C-MIA-DC and 20764C-MIA-SQL virtual machines are
do
both crunning,
um
en and then log on to 20764C-MIA-SQL as
to
pe
ADVENTUREWORKS\Student
No lui
rte
ne with the password Pa55w.rd.
es s gu ce
tán ille aL
pe rm uis
o Gu
2. In the D:\Labfiles\Lab10\Starter
rm
itid
co
rre ille folder, right-click Setup.cmd, and then click
as a @ rm
las gm oC
Run as administrator. co ail orr
pia .co ea
ss m Lo
in pe
au ra
3. In the User Account Control t oriz
ac
dialog .box, click Yes and wait for the script to
ión
finish. .
Es
te
do
cu
Task 2: Configure
me
n
Database Mail
to
pe
rte
No lui ne
es sg ce
tán u ille aL
pe uis rm
1. Start SQL rm Server
oc Management
o Gu Studio and connect to the MIA-SQL Database
itid rre ille
sl @ moa a r
Engine instanceas using
c
gm Windows
a Co authentication.
op il.c rre
aL ias om
op sin
a era
2. In Object Explorer, expand
u tor Management,
iza
. right-click Database Mail, and then
ció
click Configure Database Mail. n.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 1/9
30/1/2019 Librería
5. On the New Profile page, in the Profile name box, type SQL Server Agent
Profile, and then click Add.
Es
te
6. do Add Account to profile 'SQL Server Agent Profile' dialog box, click
In thecu
me
to n
New Account.
pe
r
No lui ten
sg ec
es ea
u
tán ille
Lu
7. In the New
p erm Database
r m oc is Mail Account dialog box, enter
Gu the following details and
itid orr ille
a e a rm
click OK: s las @
gm oC
co ail orr
pia .co ea
ss m Lo
in pe
o Account name: aAdventureWorks uto ra. Administrator
riz
ac
ión
.
o Email address: [email protected]
11. EOn the Complete the Wizard page, click Finish, and when configuration is
ste
do
complete, click Close.
cu
me
nto
pe
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
rm oc Gu
itid orr ille
as ea rm
@
Task 3: Test Database
las
c
Mail
gm
a
oC
orr
op il.c ea
ias om L
sin op
au era
tor .
iza
1. In Object Explorer, c
right-clickónDatabase
i Mail, and then click Sent Test E-Mail.
.
2. In the Send Test E-Mail from MIA-SQL dialog box, ensure that the SQL
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 2/9
30/1/2019 Librería
8. In the query pane, type the following Transact-SQL code, and then click
EExecute:
ste
do
cu
me
nto
pert
NSELECT lui * FROM en
oe sg ec msdb.dbo.sysmail_event_log;
stá u ea
np ille Lu
rm is
SELECT erm * FROM oc msdb.dbo.sysmail_mailitems;
Gu
itid o rre ille
as a @ rm
las gm oC
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
9. Review the results. The first t oriz result shows system events for Database
ac
Mail, and
ió
the second shows records of nemail . messages that have been sent.
ste E
11. Leavedo SSMS open for the next exercise.
cu
me
nto
pe
rte
No lui ne
es sg ce
tán uaL
ille
pe uisrm
r o c Gu
Result: Aftermithis
tid exercise,
o rre ilyou
ler should have configured Database Mail with a new
as a@ mo
profile named SQL las Server gm Agent Co Profile.
co ail rre
pia .co aL
ss m op
in era
au .
tor
iza
ció
n.
Exercise 2: Configuring Operators
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 3/9
30/1/2019 Librería
1. In Object Explorer, expand SQL Server Agent, right-click Operators, and then
click New Operator.
Es
2. Intethe
do New Operator dialog box, in the Name box, type Student, in the E-mail
cu
en m
name box,to type [email protected], and then click OK.
pe
rte
No lui ne
es sg ce
tán uille aL
pe rm uis
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
rre co ail o
Task 2: Create the DBA .co Operator
pia Team aL
s m o sin pe
au ra.
tor
iza
ció
n .
1. In Object Explorer, under SQL Server Agent, right-click Operators and click
New Operator.
2. EIn
stethe New Operator dialog box, in the Name box, type DBA Team, in the E-
do
cu
mail name me
nto box, type [email protected], and then click OK.
pe
rte
No lui ne
es sgu ce
tán ille aL
pe rm uis
rm o co Gu
itid rre ille
as a @ rm
las gm oC
Task 3: Configure the c a
op SQL ilServer orr Agent Mail Profile
ias . co ea
sin m Lo
pe
au ra.
tor
iza
ció
n.
1. In Object Explorer, right-click SQL Server Agent, and then click Properties.
2. In the SQL Server Agent Properties dialog box, on the Alert System page,
Eselect
ste Enable mail profile.
do
cu
me
3. In the Mail nto profile drop-down list, click SQL Server Agent Profile.
pe
rte
No lui ne
es sg ce
tán uil aL
4. SelectpEnable l erm fail-safe uis operator, in the Operator drop-down list, click DBA
erm oc Gu
itid o rre ille
Team. as
las
a@
gm
rm
oC
co ail orr
pia .co ea
ss m L
5. In the Notify using section, i n au selectopeE-mail,
ra. and then click OK.
tor
iza
ció
n.
6. In Object Explorer, right-click SQL Server Agent, and then click Restart.
8. In the Microsoft SQL Server Management Studio dialog box, click Yes.
Es
t
ed
Result: oAfter
cu this exercise, you should have created operators named Student
me
and DBA Team, nto
pe
and configured the SQL Server Agent service to use the SQL
rte
Server
No Agent lui Profile
s
ne
c
Database Mail profile.
es gu ea
tán ille Lu
pe rm is
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
orr co
Exercise 3: Configuring
pia
s
.coAlerts
m
ea and Notifications
L
ail
sin op
au era
tor .
iza
ció
n.
Task 1: Create an Alert
1. EIn
steObject Explorer, expand SQL Server Agent, right-click Alerts, and then click
d
NewocAlert.
um
en
to
pe
rte
No lui ne
2. In ethe
stá New sg Alert
uil
ce dialog box, on the General page, in the Name box, type
aL
np ler uis
mo
InternetSales
e rm
itid
cLog
orr Full Gu Alert.
ille
as e a rm
las @ oC
gm
co ail orr
3. In the Database name p ias list,
. co click
m
ea InternetSales.
Lo
sin pe
au ra.
tor
iza
4. Click Error number, and type ció the error number 9002.
n.
5. On the Response page, select Execute job, and in the drop-down list, click
Back Up Log - InternetSales ([Uncategorized (Local)]).
Es
te
oc d
6. SelectumNotify operators, and then select E-mail for the Student operator.
e nto
pe
rte
No ne lui
7. Onesthe Options
sg
u
cepage, under Include alert error text in, select E-mail, and
a
tán ille Lu
pe m r is
then click
rm OK.oco
it r
Gu
ille
ida rea rm
sl @ oC
as gm
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
tor
iza
ció
. n
Task 2: Configure Job Notifications
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 5/9
30/1/2019 Librería
1. In Object Explorer, under SQL Server Agent, expand Jobs and view the
existing jobs.
13. EIn the second drop-down list, click When the job completes, and then click
ste
OK.docu
me
nto
pe
rte
14. Right-click
No lui
s the eBack
n
c Up Log - InternetSales job, and then click Properties.
es gu ea
tán ille
Lu
pe isrm
rm Guoc
15. o
In the JobitidProperties
rre -illeBack Up Log - InternetSales dialog box, on the
as a@ rm
las gm oC
Notifications page, co
pia select
ail
.co E-mail.
orr
ea
ss m Lo
in pe
au ra.
tor
16. In the first drop-down list, zclick i ac
ión
Student.
.
17. In the second drop-down list, click When the job completes, and then click
OK.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 6/9
30/1/2019 Librería
18. Expand the Operators folder, right-click Student, and then click Properties.
19. In the Student Properties dialog box, on the Notifications page, click Jobs,
verify the job notifications that have been defined for this operator, and then
click Cancel.
Es
te
do
cu SSMS open for the next exercise.
20. Leave me
nto
pe
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
rm Gu oc
itid ille orr
a ea rm should have created an alert named InternetSales
Result: After thislaexercise,
s
sc
@
gm youo C
a orr
Log Full Alert. Also,opyou il.c
ias should om have ea
Lo configured the Back Up Database -
sin pe
AWDataWarehouse, Back au Up Database
tor
ra. - HumanResources, Back Up
iza
Database - InternetSales, andciBack ón Up Log - InternetSales jobs to send
.
notifications.
Es
Exercise
te
do 4: Testing Alerts and Notifications
cu
me
nto
pe
rte
No lui ne
e sg c
Task 1:eTest
stá
n the
illeAlerta L
r u
u
pe mo is
rm co Gu
itid rre ille
as a@ rm
las gm oC
co ail orr
ea pia .co
1. On the File menu, spoint
s tom Open,Loand then click File.
p in era
au .
tor
iza
2. In the Open File dialog c
box,iónavigate to the D:\Labfiles\Lab10\Starter folder,
n.
click TestAlert.sql, and then click Open.
3. On the toolbar, click Execute and wait for the script to finish. When the log file
Es
te the InternetSales database is full, error 9002 occurs.
for do
c um
en
to
ert p
4. In
N Object
lu Explorer,
en
e
expand Alerts, right-click InternetSales Log Full Alert, and
oe isg ce
stá ille aL u
then click
np Properties.
rm uis
erm oc Gu
itid ille orr
as rm ea
oC
las @
5. In the 'InternetSales g Log Full
co m ail orr Alert' alert properties dialog box, on the
pia .co ea
ss m Lo
History page, note theauDate of last
i n pe alert and Date of
ra. last response values,
tor
iza
and then click Cancel. ció
n.
7. Double-click the new email messages to view them in Outlook. They should
include a notification that the transaction log was filled, and a notification that
the Back Up Log - InternetSales job completed. When you have finished
checking them, close all email messages and minimize the Drop window.
Es
te
do
cu
me
nto
pe
rte
No lui ne
sg ce
Task 2: Test
e stá Jobuil Notifications
ler aL
np m uis
erm oc Gu
itid orr ille
as ea rm
las @ oC
gm
co ail orr
1. In Object Explorer, pia under .co Jobs, ea right-click Back Up Database -
ss m Lo
in pe
au r
AWDataWarehouse, and tor click Starta.Job at Step.
iza
ció
n.
2. When the job has completed, note that it failed and click Close.
8. In the Student Properties dialog box, on the History page, note the date and
Es
time
te of the most recent notification by email, and then click Cancel.
do
cu
me
nto
pe
9. In
N
File Explorer,
l
rte
n
in the C:\inetpub\mailroot\Drop folder, verify that new email
oe uis ec
stá uihave g e
messages
np lle
rm been
aL
ui created.
erm oc sG
itid orr uil
as ler ea
l mo @
10. Open each of the
a s c messages
op
g ma Coand verify that they include a failure notification for
rre
il.c
ias om aL
the Back Up Database sin
au
- AWDataWarehouse op
era job and a completion notification
tor .
for the Back Up Database iza - InternetSales job, but no notification regarding the
ció
n.
Back Up Database - HumanResources job.
11. When you have read the messages, close them and close the Drop window.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 8/9
30/1/2019 Librería
12. Close SQL Server Management Studio without saving any files.
Result: After this exercise, you will have verified that the notifications you
configured
Es
te
for backups of the AWDataWarehouse, HumanResources, and
do
InternetSalescu
me databases work as expected. You will also verify that an alert is
nto
triggered whenpethe transaction log of the Internet Sales database is full.
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
tor
iza
ció
n.
Es
te
do
cu
me
nto
pe
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
tor
iza
ció
n.
Es
te
do
cu
me
nto
pe
rte
No lui ne
es sg ce
tán u ille aL
pe rm uis
rm oc Gu
itid orr ille
as ea rm
las @ oC
gm
co ail orr
pia .co ea
ss m Lo
in pe
au ra.
tor
iza
ció
n.
https://skillpipe.com/?lang=es-ES#/reader/book/24820548-a5cd-4cbe-80fd-0658d7f0f8c4 9/9