Você está na página 1de 12

2010

Lovely Professional University

Submitted By:-

Vishal
Roll No. – RC1601A38
Reg. No. – 3050071019
B.T-M.T (CSE)

[INT401 DATABASE ADMINISTRATION]

[HOME WORK-3]

Lovely Professional University Page 1


Part A
Q1. What are the benefits of configuring mail on database ?

Answer: Below Show Some of benefit of Configuring mail an database:

• Database Mail can be configured with multiple profiles and multiple SMTP accounts, which
can be on several SMTP servers. In the case of failure of one SMTP server, the next available
server will take up the task of sending e-mails. This increases the reliability of the mailing
system.

• SQL Server continues to queue messages when the external mailing process fails. Whenever
the process is successful, it starts to send queued messages.
• Mailing is an external process so it does not decrease your database performance. This
external process is handled by an executable called DatabaseMail90.Exe located in the
MSSQL\Bin directory.
• Availability of an auditing facility is a major enhancement in Database Mail. Previously,
DBAs could not verify whether the system had sent an e-mail. All mail events are logged so
that DBAs can easily view the mail history. In addition, DBAs can view the errors to fix
SMTP related issues. Plus, there is the capability to send HTML messages.
• Database Mail has the option of limiting files sizes to prevent sending large files that would
degrade mail server performance. In addition, you have the option of limiting files by their
extensions. For example, .exe.com can be prevented from being sent from the database
server.

Lovely Professional University Page 2


Q2. Explain the process of Managing Profiles and Accounts on SQL server 2005 ?

Answer: In Database Mail, the Account holds information that the database engine uses to send e-mail
messages. An Account holds information for only one e-mail server, such as the account name, e-mail
address, reply-to e-mail address, server name or IP address, and some optional security settings.

To send a Database Mail e-mail, a Profile must be used. A Profile is set up of one or more Accounts. This
Profile-Account setup is very useful for a couple of reasons. It allows you to associate more than one
Account to a profile, which means that you can associate more than one e-mail server to a profile. So, when
you try to send an e-mail, each Account for the profile is tried until the message is successfully sent, which is
great in case one or more of your SMTP servers is unavailable. It also allows you to develop your application
code for sending e-mails without worrying about changing the Profile name for different environments. You
can use the same Profile name for your Development and Production environments; the only difference is
that the Accounts contained in the profiles will be different

Database Mail's T-SQL Commands

 SQL Server 2005 Database Mail Configuration Script


Lovely Professional University Page 3
1.Create a Database Mail profile :-

EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'SQL2005_Email_ProfileName',
@description = 'Notification service for SQL Server'

2. Create a Database Mail account :-

EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'SQL Server Notification Service',
@description = 'SQL Server Notification Service',
@email_address = 'john.doe@domain_name.com',
@replyto_address = 'john.doe@domain_name.com',
@display_name = 'SQL Server Notification Service',
@mailserver_name = 'smtpserver.domain_name.com' ;

3. Add the account to the profile

EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'SQL2005_Email_ProfileName',
@account_name = 'SQL Server Notification Service',
@sequence_number =1 ;

4. Grant access to the profile to the DBMailUsers role :-

EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'SQL2005_Email_ProfileName',
@principal_id = 0,
@is_default = 1 ;

SELECT * FROM msdb.dbo.sysmail_profile

SELECT * FROM msdb.dbo.sysmail_account

Q3. Briefly explain different mail sending options for SQL 2005 ?
Answer:

Lovely Professional University Page 4


Step 1 - After launching SSMS, you'll need to connect to the server for which you wish to configure
Database Mail. Expand the Management folder, then right-click Database Mail and select Configure
Database Mail.

Step 2 - Doing so will launch the Configure Database Mail Wizard. It may look a little confusing at first, but
once we step through it the script at the end of this tip will make more sense.

Step 3 - Since we're setting up Database Mail for the first time, select the Setup option as recommended

Lovely Professional University Page 5


Step 4 - The first step is to set up an email profile to be used with mail being sent from your SQL Server
2005 instance on this screen you will be required to create a profile name, description, and then assign an
SMTP account to the profile.

Step 5 - Click the Add button to assign an SMTP account to the profile you're creating. You may need to
work with your Server Technicians and/or Security Teams to collect some of the information you'll need.
It's best to have this ahead of time so as not to hold up the process of configuring Database Mail. You will
need the account name, description, email address (both incoming and outgoing), display name, and
SMTP server name for this account. Be sure to confirm the port number with your Server Technicians as
well. Typically, the default of port 25 will work. Select how you want to authenticate to the SMTP server
and then click OK to proceed

Step 6 - You will notice that the account information is now listed. You can set up multiple accounts for the
Database Mail profile to allow for failover if you so choose. Click Next to continue onto setting up security for
the Database Mail profile. I've already taken the liberty of setting this up as a Public Profile. This means that
all users of the SQL instance will have access to this Database Mail profile. You have the option of creating
Private Profiles that are only accessible to certain users of the instance. In our environment we have a default
Database Mail profile that is used across all SQL instances. Your environment may differ. A Future tip will
outline creation and use of Private Database Mail Profiles.

Lovely Professional University Page 6


Step 7 - It is finally time to finish up with the wizard. Click Next for a summary of all the configuration settings
you've made. Once you've reviewed them you can proceed with running the underlying stored procedures
that create .

Lovely Professional University Page 7


Part B
Q4. Mention use and benefits of Event notifications?

Answer: Uses of Event Notification:

• New in SQL Server 2005, Event Notifications provide a flexible and powerful way of
capturing and handling events that occur inside of SQL Server.

• Event Notifications execute for DDL Events and Trace Events inside of the database engine
and can be used instead of DDL triggers or SQL Trace to capture information about the event
being fired. However, unlike DDL triggers and SQL Trace which process synchronously,
Event Notifications utilize Service Broker to asynchronously capture event information.

Syntax to Create Event Notification:


CREATE EVENT NOTIFICATION event_notification_name
ON { SERVER | DATABASE | QUEUE queue_name }
[ WITH FAN_IN ]
FOR { event_type | event_group } [ ,...n ]
TO SERVICE 'broker_service' , { 'broker_instance_specifier' | 'current database' }
[;]

Advantages of the event notification:

Lovely Professional University Page 8


1. Notification Services enable the application to send notifications to its subscribers. The
notification can include critical information. These subscribers can be customers, employees,
or partners.

2. Notification Services help subscribers by providing them with timely, customized, and
personalized services.

3. Notification applications allow users to communicate with mobile subscribers over a wide
variety of devices.

4. Notification Services keep subscribers alert by providing them with information whenever
and wherever they need it. This helps businesses be more productive.

Q5. Explain multi-server jobs?

Answer: Multiserver administration requires that you set up a master server and one or more target
servers. Jobs that will be processed on all the target servers are first defined on the master server and
then downloaded to the target servers.

To create a Multiserver environment, use the Master Server Wizard. For information about using the
Master Server Wizard, see How to: Make a Master Server (SQL Server Management Studio). Full
Secure Sockets Layer (SSL) encryption and certificate validation are enabled for connections
between master servers and target servers by default. For more information, see Setting Encryption
Options on Target Servers.

The wizard takes you through the following steps:

• Checking the security settings for the SQL Server Agent service and the SQL Server service
on all servers intended to become target servers. We recommend that both services should be
running in Microsoft Windows domain accounts. For more information, see Choosing the
Right SQL Server Agent Service Account for Multiserver Environments.

Lovely Professional University Page 9


• Creating a master server operator (MSXOperator) on the master server. MSXOperator is the
only operator that can receive notifications for Multiserver jobs.
• Starting the SQL Server Agent service on the master server.
• Enlisting one or more servers as target servers.

Considerations for Multiserver Environments

Consider the following issues when creating a Multiserver environment:

• Each target server reports to only one master server. You must defect a target server from one
master server before you can enlist it into a different one.
• When changing the name of a target server, you must defect it before changing the name and
re-enlist it after the change.
• If you want to dismantle a Multiserver configuration, you must defect all the target servers
from the master server.
• If you want to distribute maintenance plans additional configuration is required.

Q6 .what are the advantages of JOB and how JOB is created?


Answer: Advantages of job:
Jobs are really at the core of the SQL Server Agent service.
Jobs are operations that perform through a sequence of steps that run Transact-SQL scripts, launch
command-prompt applications, ActiveX script tasks, replication tasks, and a variety of other tasks.
Each task is defined as a separate job step. Part of the design of the job system is to build each task
so that you can build dependencies and workflows between the job steps. A very simple example of
this would be a backup job that ran nightly, and then emailed an administrator to inform him or her
that the job was complete.

Creating Job Steps:


Now that you have a couple of jobs you can work with, add some
simple steps to these jobs. Before doing this, though, take a look at the different types of job steps
you can define, as shown in the following table.
For each job step type, you can identify one or more
proxy accounts that can be used to execute that step type, in case the owner of the job, or the login
under which the job is run, does not have permissions to execute that type of task. It allows you to let
users run jobs that contain steps they would not be able to run under their own credentials. You learn
about creating and managing proxies later in this chapter. This first example uses Management
Studio again to edit the properties of the Simple Backup job. You’re going to add a Transact-SQL
step that will perform a full backup of the Adventure Works database onto the local disk. Before
beginning, you should create a folder called dbBackups on your C: drive.

1. From Object Explorer, expand your server, and then expand SQL Server Agent.
2. Expand Jobs.
3. Right-click Simple Backup and select Properties.
4. Under the Select a Page list, select Steps.
5. Click the New button.

Lovely Professional University Page 10


6. In the Step Name box, enter Adventure Works Backup.
7. In the Type drop-down list, ensure that Transact-SQL is listed.
8. Leave “Run as” empty.
9. Ensure that master is the selected database.
10. Enter the following code in the command window: BACKUP DATABASE Adventure Works
TO DISK = ‘C:\dbBackups\AWFull.bkf’;
11. Click OK to close the New Job Step window.
12. Click OK to close the Job Properties window.
13. In the SQL Server Management Studio Note, it informs you that the last step will be changed
from “Go to Next Step” to “Quit with Success.” Click Yes.

Q7 What is the advantage of proxies ?

Answer: Defines the security context for a job step


• SQL 2000 – only one proxy account available for all jobs. Generally this account had
very high levels of privileges
• SQL 2005 – Many proxy accounts that can have limited access to certain subsystems
and principals can be assigned rights to use particular proxies.
• The list of available proxies will be filtered by the type of job step and proxies to
which the user has access.
• During upgrade the old proxy account is changed to an UpgradeProxyAccount with
access to the subsystems that were explicitly used.

Lovely Professional University Page 11


Agent Proxy Accounts Subsystems
❑ ActiveX Script

❑ CmdExec

❑ Replication Distributor

❑ Replication Merge

❑ Replication Queue Reader

❑ Replication Snapshot

❑ Replication Transaction-Log Reader

❑ Analysis Services Command

❑ Analysis Services Query

❑ SSIS Package Execution

Lovely Professional University Page 12

Você também pode gostar