Tải bản đầy đủ (.pdf) (48 trang)

Additional Features Of SQL Server 2000

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (948.53 KB, 48 trang )

LESSON: 3A
ADDITIONAL FEATURES OF SQL
SERVER 2000
Objectives
Additional Features of SQL Server
2000
Objectives
In this lesson, you will learn about:






Configuring
Configuring
Configuring
Introducing
(XML)

©NIIT

and Using SQLMail
and Using SQLAgentMail
and Managing Linked Servers
IIS virtual directories to support Extensible Markup Language

Additional Features of SQL Server

Lesson 3A / Slide 1 of 26


In this lesson, you will learn about:

 Configuring
 Configuring
 Configuring
 Introducing

3A.1

and Using SQL Mail
and Using SQLAgentMail
and Managing Linked Servers
IIS virtual directories to support Extensible Markup Language (XML)

Administering and Troubleshooting SQL Server 2000


Additional Features of SQL Server
2000
Pre-Assessment Questions

©NIIT

1.

Which of the following SQL Server 2000 job step helps SQL Server
Agent to find the application source?
a)
Operating system commands
b)

Transact-SQL statements
c)
Microsoft ActiveX scripts
d)
Replication tasks

2.

Which of the following attributes of SQL Server alerts and their
messages contains the name of the stored procedure, if the error has
occurred in a stored procedure?
a)
State code
b)
Procedure name
c)
Line number
d)
Message string

Additional Features of SQL Server

Lesson 3A / Slide 2 of 26

Administering and Troubleshooting SQL Server 2000

3A.2


Additional Features of SQL Server

2000
Pre-Assessment Questions
3.

©NIIT

3A.3

Which of the following functions state the code attribute of the SQL
Server alert and their messages?
a)
It contains information about the cause of the error, place
where the error has occurred, and the object concerned with
this error.
b)
It is used to find the source code location of the error and is
used by Microsoft support engineers.
c)
It indicates the line number of the Transact-SQL statement in
the stored procedure, which has caused the error.
d)
It contains the name of the stored procedure if the error has
occurred in a stored procedure.

Additional Features of SQL Server

Lesson 3A / Slide 3 of 26

Administering and Troubleshooting SQL Server 2000



Additional Features of SQL Server
2000
Pre-Assessment Questions
4.

5.

©NIIT

From the following options, which attribute of the SQL Server alert
contains the name of the stored procedure that has generated the
error?
a)
Severity
b)
Message string
c)
Procedure name
d)
State code
From the following options which job step of SQL Server 2000 contains
the full path to all the executable files and command?
a)
CMDExec commands
b)
Transact-SQL statements
c)
Microsoft ActiveX scripts
d)

Replication tasks

Additional Features of SQL Server

Lesson 3A / Slide 4 of 26

Administering and Troubleshooting SQL Server 2000

3A.4


Additional Features of SQL Server
2000
Solutions to Pre-assessment Questions:
Ans 1. a. Operating system commands
Ans 2. b. Procedure name
Ans 3. b. It is used to find the source code location of the error and is used by
Microsoft support engineers.
Ans 4. c. Procedure name
Ans 5. a. CMDExec commands

©NIIT

Additional Features of SQL Server

Lesson 3A / Slide 5 of 26

INSTRUCTOR NOTES
Before beginning the session ensure that Employee.mdb is saved under C:. Start the
session by telling the students about the additional functions performed by SQL Server

2000, such as sending and receiving mails and integrating different mail servers. Then
tell the students that SQL Server performs these functions using the following
components:

„SQL Mail
„SQLAgentMail
„Linked Server
„SQL Server XML support in IIS
Discuss the functions of SQL Mail and tell the students about the xp_sendmail system
stored procedures used by it during its execution. Then discuss the functions of

3A.5

Administering and Troubleshooting SQL Server 2000


SQLAgentMail. Also tell the students about the various system-stored procedures used
by SQLAgentMail during its execution. Now tell the students that before using SQL Mail
and SQL AgentMail you need to configure MAPI clients on SQL Server 2000. Then
discuss linked server and SQL Server XML support in IIS in brief.
Ensure that the following datafiles are installed on the student nodes:

„Employee.mdb
„Customers.mdb

Administering and Troubleshooting SQL Server 2000

3A.6



INTRODUCING SQL SERVER 2000
MAIL SERVICES

Additional Features of SQL Server
2000
Additional Components of SQL Server
2000



SQL Server 2000 provides features to send and receive e-mail messages
between multiple database users.
To take advantage of all these features, you need to configure the following
components:






©NIIT

3A.7

SQLMail
SQLAgentMail
Linked Server
SQL Server XML support in IIS

Additional Features of SQL Server


Lesson 3A / Slide 6 of 26

Administering and Troubleshooting SQL Server 2000


Additional Features of SQL Server
2000
Additional Components of SQL Server
2000 (Contd.)




©NIIT

SQL Server 2000 sends and receives messages by establishing a connection
with mail servers.
SQL Mail is the mail service of SQL Server 2000 that sends messages to
mailboxes and e-mail pagers using the Transact-SQL commands and
xp_sendmail extended stored procedure.
You can also create a scheduled job for automatic process of e-mail.

Additional Features of SQL Server

Lesson 3A / Slide 7 of 26

Administering and Troubleshooting SQL Server 2000

3A.8



Additional Features of SQL Server
2000
Additional Components of SQL Server
2000 (Contd.)


Descriptions

xp_sendmail

Sends e-mail messages from Transact-SQL batches, scripts, triggers, and
procedures to the designated user

xp_readmail

Reads the message

xp_startmail

Starts the session of SQL Mail

xp_stopmail

Stops the session of SQL Mail

xp_processmail

Processes queries as an incoming messages and sends the result set to

the designated recipients as an outgoing message

xp_deletemail

Deletes specified messages

xp_findnextmsg

Finds the next message in the SQL Server inbox for processing

©NIIT

3A.9

The following table lists the SQL Mail stored procedures and their description:

Stored Procedures

Additional Features of SQL Server

Lesson 3A / Slide 8 of 26

Administering and Troubleshooting SQL Server 2000


Additional Features of SQL Server
2000
Additional Components of SQL Server
2000 (Contd.)





©NIIT

SQLAgentMail is the mail service of SQL Server 2000 that is used for SQL
Server Agent services.
Before configuring SQL Mail and SQLAgentMail, you need to install MAPI clients
on the SQL Server 2000 computer.
Linked server is a component of SQL Server 2000 that links multiple database
servers to facilitate exchange of information.

Additional Features of SQL Server

Lesson 3A / Slide 9 of 26

Administering and Troubleshooting SQL Server 2000

3A.10


Additional Features of SQL Server
2000
Additional Components of SQL Server
2000 (Contd.)


Besides database servers, you can also link SQL Server 2000 database to a text
file or a spreadsheet as shown in the following figure:
Oracle DB

Server
OLEDB Provider
SQL Server

OLEDB Provider
OLEDB Provider

©NIIT

3A.11

Additional Features of SQL Server

Text Files

SQL Server

Lesson 3A / Slide 10 of 26

Administering and Troubleshooting SQL Server 2000


Additional Features of SQL Server
2000
Additional Components of SQL Server
2000 (Contd.)


SQL Server 2000 supports XML to convert an SQL Server 2000 instance into an
XML enabled database server.


©NIIT

Additional Features of SQL Server

Lesson 3A / Slide 11 of 26

SQL Server 2000 provides features to send and receive e-mail messages between
multiple database users. It provides features to link multiple databases, such as
Oracle, or MS Access for the execution of distributed queries. In addition, SQL Server
2000 supports XML for exchange of information across platforms. SQL Server 2000
also provides features for accessing databases through Internet servers, such as IIS.
To take advantage of all these features, you need to configure the following
components:

„SQL Mail
„SQLAgentMail
„Linked Server
„SQL Server XML support in IIS
SQL Server 2000 sends and receives messages by establishing a connection with mail
servers. SQL Server 2000 supports mail servers such as, Microsoft Exchange Server,
Microsoft Windows Mail, or Post Office Protocol 3 (POP3). The mails are sent and
received using two separate services, SQL Mail and SQLAgentMail. Both these services
require Messaging Application Programming Interface (MAPI) client applications, such
as Microsoft Outlook and MAPI messaging profile on SQL Server 2000 computer.

Administering and Troubleshooting SQL Server 2000

3A.12



MAPI is an interface of Microsoft Windows program that enables you to send and
receive e-mail within Windows application. The services also require Windows NT 4.0
or Windows 2000 domain user account to logon to an instance of SQL Server 2000.

SQL Mail
SQL Mail is the mail service of SQL Server 2000 that sends messages to mailboxes
and e-mail pagers using the Transact-SQL commands and xp_sendmail extended
stored procedure. It receives and processes mails from a mail system and sends the
query response to the designated mail account by creating a reply mail. You can use a
result set from a query, a message string, a Transact-SQL statement, or a page for an
electronic pager as the content of an e-mail message. For example, consider the
following statements:
EXEC xp_sendmail ‘’,
@subject = ’Database Login Information’,
@query = ‘Select * from master.dbo.master’
The Transact-SQL statement in the preceding example is a part of the content of the
e-mail message. You can also create a scheduled job for automatic process of e-mail.
The following table lists the SQL Mail stored procedures and their description:

Stored Procedures

Descriptions

xp_sendmail

Sends e-mail messages from Transact-SQL batches,
scripts, triggers, and procedures to the designated
user.


xp_readmail

Reads the message.

xp_startmail

Starts the session of SQL Mail.

xp_stopmail

Stops the session of SQL Mail.

xp_deletemail

Deletes specified messages.

xp_findnextmsg

Finds the next message in the SQL Server inbox for
processing.

3A.13

Administering and Troubleshooting SQL Server 2000


SQLAgentMail
SQLAgentMail is the mail service of SQL Server 2000 that is used for SQL Server
Agent services. SQL Server Agent services are server components that run scheduled
SQL Server 2000 administrative tasks. SQLAgentMail is used to send e-mail

notifications to the designated users when any scheduled task, such as database
backup or recovery, succeeds or fails. You can configure SQLAgentMail to send SQL
Server alerts when specific event occurs. For example, you can use SQLAgentMail to
send an alert to the operators when a particular database event needs immediate
action. SQLAgentMail uses its own mail profile and domain account. These mail
profiles and domain accounts are different from that of SQL Mail.

Prerequisite for Configuring SQL Mail and
SQLAgentMail
Before configuring SQL Mail and SQLAgentMail, you need to install MAPI clients on the
SQL Server 2000 computer. In addition, you must also configure the mail or
messaging profile of the domain user account. SQL Mail and SQLAgentMail use these
configured domain user accounts. You can create the message profile by using MAPI
client interface or Mail program from the Control Panel.

Apart from stored procedures, triggers and alerts can also be
coded to send messages using the SQL Mail system.

Administering and Troubleshooting SQL Server 2000

3A.14


Linked Server
Linked server is a component of SQL Server 2000 that links multiple database servers
to facilitate exchange of information. Using this component you can connect or link
multiple database servers, such as Oracle, and Microsoft Access using OLEDB data
source and OLEDB data providers. While you configure the linked server, you need to
register the connection and data source information of the OLEDB data source with
SQL Server 2000. After successful registration, you can always refer the data source

with a single logical name. Besides database servers, you can also link SQL Server
2000 database to a text file or a spreadsheet, as shown in the following figure:

Oracle DB
Server
OLEDB Provider
SQL Server

OLEDB Provider

OLEDB Provider

Text Files

SQL Server

You can create and configure the linked server, using SQL Server 2000 Enterprise
Manager. You can also create and configure a linked server using the
sp_addlinkedserver system stored procedure.

SQL Server XML Support in IIS
SQL Server 2000 supports XML to convert an SQL Server 2000 instance into an XML
enabled database server. With the help of XML enabled database server, you can
present the data on the web as XML pages in response to HTTP queries. The
generated XML page can be used for exchanging information across different
platforms and organizations. To do this, you need to configure IIS virtual directory.
The configured IIS virtual directory creates an association with the instance of SQL
Server 2000 server that enables access to SQL Server 2000 database objects, such as
tables through (Hypertext Transfer Protocol) HTTP. In addition, you can also access
the XML document consisting of one or more SQL statements.


3A.15

Administering and Troubleshooting SQL Server 2000


INSTRUCTOR NOTES

Additional Inputs
Using URL to Access SQL Server 2000
You can access SQL Server 2000 using the Uniform Resource Locator (URL) over the
Hyper Text Transfer Protocol (HTTP). Using the URL you can:
1. Directly access the database objects, such as tables, view, or triggers of a SQL
Server 2000 database. However, this is not recommended due to security
reasons.
2. Execute the XML files containing Transact-SQL statements, known as
Templates.
3. Execute XML queries.

INSTRUCTOR NOTES
Now that you have introduced the additional components of SQL Server 2000, you can
now tell the students about configuring SQL Mail and SQL AgentMail using SQL Server
2000 Enterprise Manager. Explain the configuration process of both the components in
detail.

Administering and Troubleshooting SQL Server 2000

3A.16



CONFIGURING SQL MAIL AND
SQLAGENTMAIL

Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail



Before configuring SQL Mail and SQLAgentMail, you need to install
MAPI clients on the SQL Server 2000 computer.
To configure SQL Mail, perform the following steps:

1.

©NIIT

3A.17

Select Start->Programs->Microsoft SQL
Server->Enterprise Manager, to open the Enterprise
Manager console.

Additional Features of SQL Server

Lesson 3A / Slide 12 of 26

Administering and Troubleshooting SQL Server 2000



Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)
2.
3.

©NIIT

Expand the Microsoft SQL Server Group->Support Services option.
Right-click the SQL Mail option, and select the Properties option to
open the SQL Mail Configuration dialog box.

Additional Features of SQL Server

Lesson 3A / Slide 13 of 26

Administering and Troubleshooting SQL Server 2000

3A.18


Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)

©NIIT


3A.19

4.

Select the profile name from Profile name list as shown. (Enter your
user name.)

5.

Click the Test button to verify the session of mail service.
Additional Features of SQL Server

Lesson 3A / Slide 14 of 26

Administering and Troubleshooting SQL Server 2000


Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)


©NIIT

To configure SQLAgentMail, perform the following steps:
1. Select Start->Programs->Microsoft SQL Server->Enterprise
Manager, to open the Enterprise Manager console.
2. In the Enterprise Manager console, expand the Microsoft SQL Server
Group->Management container option.


Additional Features of SQL Server

Lesson 3A / Slide 15 of 26

Administering and Troubleshooting SQL Server 2000

3A.20


Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)
3.

©NIIT

3A.21

Right-click the SQL Server Agent option, and then click the
Properties option to open the SQL Server Agent
Properties dialog box.

Additional Features of SQL Server

Lesson 3A / Slide 16 of 26

Administering and Troubleshooting SQL Server 2000



Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)
4.

©NIIT

In the Mail Session section, from the Mail profile drop-down list box
select the messaging profile as shown:

Additional Features of SQL Server

Lesson 3A / Slide 17 of 26

Administering and Troubleshooting SQL Server 2000

3A.22


Additional Features of SQL Server
2000
Configuring SQL Mail and
SQLAgentMail (Contd.)
5.

©NIIT

Click the Test button to verify the session of mail service.


Additional Features of SQL Server

Lesson 3A / Slide 18 of 26

Before configuring SQL Mail and SQLAgentMail, you need to install MAPI clients on the
SQL Server 2000 computer. In addition, you need to configure the mail or messaging
profile of the domain user account. SQL Mail and SQLAgentMail use these domain user
accounts. You can create the message profile using MAPI client interface or using Mail
program in Control Panel.

Configuring SQL Mail
To configure SQL Mail, perform the following steps:
1. Select StartÆAll ProgramsÆMicrosoft SQL ServerÆEnterprise Manager,
to open the Enterprise Manager console.
2. Expand the Microsoft SQL ServersÆSQL Server Group. Expand Support
Services under default instance of SQL Server, as shown.

3A.23

Administering and Troubleshooting SQL Server 2000


3. Right-click the SQL Mail option, and select the Properties option to open the
SQL Mail Configuration dialog box.

4. Select the profile name from Profile name list box.
5. Click the Test button to verify the session of mail service.

Administering and Troubleshooting SQL Server 2000


3A.24


Configuring SQLAgentMail
To configure SQLAgentMail, perform the following steps:
1. Select StartÆAll ProgramsÆMicrosoft SQL ServerÆEnterprise Manager,
to open the Enterprise Manager console.
2. Expand the Microsoft SQL ServersÆSQL Server Group. Expand
Management under default instance of SQL Server.
3. Right-click the SQL Server Agent option, and then click the Properties
option to open the SQL Server Agent Properties dialog box.
4. In the Mail session section, from the Mail profile drop-down list box select
the messaging profile, as shown.

5. Click the Test button to verify the session of mail service.

3A.25

Administering and Troubleshooting SQL Server 2000


×