1. Trang chủ
  2. » Công Nghệ Thông Tin

Microsoft Press Configuring sql server 2005 môn 70 - 431 phần 2 pdf

98 267 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 98
Dung lượng 2,65 MB

Nội dung

62 Chapter 2 Configuring SQL Server 2005 2. You are in charge of designing the physical structure for your company’s new server running SQL Server 2005. The server has the following characteristics: two disks in RAID 1, five disks in RAID 5, and another ten disks in RAID 5. Where should you store database files for the best performance? A. Use RAID 1 to install the operating system. Use the first RAID 5 disk set to install SQL Server executable files and the second RAID 5 disk set to store database files. B. Use RAID 1 to install the operating system. Use the first RAID 5 system to install SQL Server executable files and data and transaction log files. Use the second RAID 5 system to store database backups. C. Use RAID 1 to install the operating system and SQL Server executable files. Use the first RAID 5 system to store transaction log files. Use the second RAID 5 system to store data files. D. Use the first RAID 5 system to install the operating system and SQL Server executable files. Store data files in the second RAID 5 system and log files in the RAID 1 system. 3. Which of the following are valid filegroup types? (Choose all that apply.) A. Read-only B. Write-only C. Default D. Primary C0262271X.fm Page 62 Friday, April 29, 2005 7:29 PM Lesson 2: Configuring Database Mail 63 Lesson 2: Configuring Database Mail Database Mail is a new solution for sending messages from the SQL Server 2005 database engine. Applications that are configured to use Database Mail can send e-mail messages, including HTML messages, query results, and file attachments, to users. Database Mail uses the Simple Mail Transfer Protocol (SMTP) and does not require you to install any Extended MAPI client, such as Microsoft Office Outlook, on SQL Server. After this lesson, you will be able to: ■ Identify Database Mail prerequisites. ■ Understand the Database Mail architecture. ■ Configure the SQL Server Database Mail subsystem. Estimated lesson time: 15 minutes Identifying Database Mail Prerequisites Before you configure Database Mail, you need to review the following prerequisites: ■ Database Mail must be enabled. Database Mail is not enabled by default; you need to enable it by using the SQL Server Surface Area Configuration tool, the Database Mail Configuration Wizard, or the sp_configure stored procedure. ■ Service Broker needs to be enabled in the Database Mail host database. The default Database Mail host database is msdb, and Service Broker is enabled on msdb by default. MORE INFO Service Broker You can get a full explanation about Service Broker from http://msdn.microsoft.com/library/ default.asp?url=/library/en-us/dnsql90/html/sqlsvcbroker.asp. ■ The Database Mail external executable needs access to the SMTP server. If the SMTP server requires authentication, the executable accesses the SMTP server by using the SQL Server service account credentials by default. You should ensure that the SQL Server service account can access the SMTP server. C0262271X.fm Page 63 Friday, April 29, 2005 7:29 PM 64 Chapter 2 Configuring SQL Server 2005 Understanding the Database Mail Architecture Database Mail has four main components: configuration components, messaging components, the executable, and logging and auditing components. ■ Configuration components There are two configuration components: ❑ A Database Mail account contains the information that SQL Server uses to send e-mail messages to the SMTP server, such as the SMTP server name, the authentication type, and the e-mail address. ❑ A Database Mail profile is a collection of Database Mail accounts. Applica- tions use Database Mail profiles to send e-mail messages so that the infor- mation about the accounts is transparent for applications, which lets DBAs change account information without modifying applications’ stored proce- dures. Database Mail profiles can be private or public. For a private profile, Database Mail maintains a list of users that can use the profile. For a public profile, members of the msdb database role DatabaseMailUserRole can use the profile. ■ Messaging components The main messaging component is the Database Mail host database, which contains all the Database Mail objects. The Database Mail host database is msdb. ■ Database Mail executable To minimize the impact on SQL Server, Database Mail uses an external executable to process e-mail messages. The executable, called DatabaseMail90.exe, is located in the MSSQL\Binn directory in the SQL Server installation path. Database Mail uses Service Broker activation to start the exter- nal program when there are e-mail messages waiting to be processed. The exter- nal program connects to the database engine by using Microsoft Windows authentication with the SQL Server service account credentials. ■ Logging and auditing components Database Mail stores log information in tables in the Database Mail host database. You can see this log information from the Database Mail Log or by querying the sysmail_event_log system view. How to Configure Database Mail SSMS provides the Database Mail Configuration Wizard for configuring your Database Mail environment. You can set up Database Mail; manage accounts, profiles, and secu- rity; and change system parameters from the wizard, which is shown in Figure 2-1. C0262271X.fm Page 64 Friday, April 29, 2005 7:29 PM Lesson 2: Configuring Database Mail 65 Figure 2-1 Database Mail Configuration Wizard In the following example, you have an SMTP mail server called mail.adventure- works.com and an account on that server with an e-mail address of sql@adventure- works.com. To configure a Database Mail profile account for this e-mail account, follow these steps: 1. Expand the Management node within Object Explorer in SSMS. 2. Right-click Database Mail and select Configure Database Mail. The Welcome page of the Database Mail Configuration Wizard appears. Click Next. 3. On the Select Configuration Task page, verify that Set Up Database Mail By Per- forming The Following Tasks is selected and click Next. 4. A warning message appears: The Database Mail feature Is Not Available. Would You Like To Enable This Feature? Click Yes. 5. In the Profile Name text box, type TestProfile and click Add to add a new SMTP account. 6. The New Database Mail Account dialog box appears. Fill in the text boxes as Fig- ure 2-2 shows. Click OK and then click Next. C0262271X.fm Page 65 Friday, April 29, 2005 7:29 PM 66 Chapter 2 Configuring SQL Server 2005 Figure 2-2 New Database Mail Account dialog box 7. In the resulting Manage Profile Security page, you configure public and private profiles. Select the TestProfile check box and click Next. 8. The Configure System Parameters page appears, which enables you to change system-level configurations. Leave the default options and click Next. The Com- plete The Wizard page appears. Click Finish. You can also accomplish these tasks by using the Database Mail stored procedures. For example, you can change configuration information by using the sysmail_configure_sp stored procedure. MORE INFO Database Mail stored procedures For a list of Database Mail stored procedures and what they do, see the “Database Mail and SQL Mail Stored Procedures (Transact-SQL)” topic in SQL Server 2005 Books Online. NOTE Viewing configuration options You can view information about Database Mail configuration options by running the Database Mail Wizard or by executing the sysmail_help_configure_sp msdb stored procedure. C0262271X.fm Page 66 Friday, April 29, 2005 7:29 PM Lesson 2: Configuring Database Mail 67 PRACTICE Configuring Database Mail In this practice, you will use the Database Mail stored procedures to configure Data- base Mail so that you can send e-mail messages from SQL Server. You will create a Database Mail public profile for an SMTP mail account. The SMTP server is mail.Adventure-Works.com, and the e-mail address is sql@Adventure-Works.com. NOTE Example server name and e-mail address in this code SMTP server names and account e-mail addresses used in this code are examples. You should change them to a valid SMTP server name and e-mail address to run the code. 1. Execute the sysmail_add_account procedure as follows to create a Database Mail account, using mail.Adventure-works.com as the mail server and sql@adventure- works.com as the e-mail account: EXECUTE msdb.dbo.sysmail_add_account_sp @account_name = 'AdventureWorks Mail', @description = 'Mail account for Database Mail.', @email_address = 'sql@Adventure-Works.com', @display_name = 'AdventureWorks Automated Mailer', @mailserver_name = 'mail.Adventure-Works.com' 2. Use the sysmail_add_profile procedure to create a Database Mail profile called AdventureWorks Mail Profile: EXECUTE msdb.dbo.sysmail_add_profile_sp @profile_name = 'AdventureWorks Mail Profile', @description = 'Profile used for database mail.' 3. Execute the sysmail_add_profileaccount procedure to add the Database Mail account you created in step 1 to the Database Mail profile you created in step 2: EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name = 'AdventureWorks Mail Profile', @account_name = 'AdventureWorks Mail', @sequence_number = 1 4. Use the sysmail_add_principalprofile procedure to grant the Database Mail pro- file access to the msdb public database role and to make the profile the default Database Mail profile: EXECUTE msdb.dbo.sysmail_add_principalprofile_sp @profile_name = 'AdventureWorks Mail Profile', @principal_name = 'public', @is_default = 1 ; C0262271X.fm Page 67 Friday, April 29, 2005 7:29 PM 68 Chapter 2 Configuring SQL Server 2005 Lesson Summary ■ Database Mail is the SQL Server 2005 subsystem that lets you send e-mail mes- sages from database applications. ■ Database Mail does not need any Extended MAPI client installed on SQL Server because the mail subsystem sends messages directly to an SMTP server. ■ You need to have Service Broker enabled to use Database Mail, which uses an external executable to send messages. ■ You can configure multiple Database Mail accounts and group them into Data- base Mail profiles. ■ All Database Mail information is stored in the msdb database, the default Data- base Mail host database. Lesson Review The following questions are intended to reinforce key information presented in this lesson. The questions are also available on the companion CD if you prefer to review them in electronic form. NOTE Answers Answers to these questions and explanations of why each answer choice is right or wrong are located in the “Answers” section at the end of the book. 1. Which of the following is a prerequisite for Database Mail? A. Service Broker B. Database Mirroring C. Extended MAPI Profile D. Microsoft Exchange Server C0262271X.fm Page 68 Friday, April 29, 2005 7:29 PM Lesson 2: Configuring Database Mail 69 2. Which of the following sentences is true for authentication mechanisms when the SMTP server is being accessed? A. Database Mail accesses the SMTP server using the database engine service credentials by default. B. Database Mail accesses the SMTP server using the SQL Server Agent service credentials by default. C. Database Mail accesses the SMTP server using the SQL Browser service cre- dentials by default. D. Database Mail accesses the SMTP server using the SQL Server Active Direc- tory Helper service credentials by default. 3. Which of the following sentences is true for Database Mail? A. A Database Mail account is a collection of Database Mail profiles. B. Each Mail Database Host user account must have a Database Mail profile associated. C. A Database Mail profile is a collection of Mail Database Host user accounts. D. A Database Mail profile is a collection of Database Mail accounts. C0262271X.fm Page 69 Friday, April 29, 2005 7:29 PM 70 Chapter 2 Configuring SQL Server 2005 Lesson 3: Specifying a Recovery Model A recovery model is a database configuration option that controls how transactions are logged, whether the transaction log is backed up, and what restore options are avail- able for the database. The recovery model you choose for your database has both data- recovery implications and performance implications, based on the logging the recov- ery model performs or doesn’t perform. After this lesson, you will be able to: ■ Explain the differences between the recovery models. ■ Choose the best recovery model for each SQL Server 2005 database. Estimated lesson time: 10 minutes Recovery Models Overview SQL Server 2005 provides three recovery models for databases: Full, Simple, and Bulk-Logged. These models determine how SQL Server works with the transaction log and selects the operations that it logs and whether it truncates the log. Truncating the transaction log is the process of removing committed transactions and leaving log space to new transactions. The following is a definition of each recovery model: ■ In the Full recovery model, the database engine logs all operations onto the trans- action log, and the database engine never truncates the log. The Full recovery model lets you restore a database to the point of failure (or to an earlier point in time in SQL Server 2005 Enterprise Edition). ■ In the Simple recovery model, the database engine minimally logs most operations and truncates the transaction log after each checkpoint. In the Simple recovery model, you cannot back up or restore the transaction log. Furthermore, you can- not restore individual data pages. IMPORTANT Simple recovery model scenarios The Simple recovery model is not appropriate for databases in which the loss of recent changes is unacceptable. ■ In the Bulk-Logged recovery model, the database engine minimally logs bulk oper- ations such as SELECT INTO and BULK INSERT. In this recovery model, if a log backup contains any bulk operation, you can restore the database to the end of the log backup, not to a point in time. The Bulk-Logged recovery model is intended to be used only during large bulk operations. C0262271X.fm Page 70 Friday, April 29, 2005 7:29 PM Lesson 3: Specifying a Recovery Model 71 How to Configure Recovery Models You can see the recovery model specified for a given database on the Database Properties page in SSMS or by querying the sys.databases catalog view, as this basic syntax shows: SELECT name, recovery_model_desc FROM sys.databases To configure the recovery model for a database, you can go to the Database Properties page in SSMS or use the ALTER DATABASE statement. In SSMS, you can change the recovery model by performing the following steps: 1. Expand the Databases node within Object Explorer in SSMS. 2. Right-click the database for which you want to set the recovery model and then choose Properties. Select the Options page. 3. You can change the recovery mode from the Recovery model drop-down list, as Figure 2-3 shows. Figure 2-3 Changing the recovery model from SSMS The basic syntax for configuring the recovery model using ALTER DATABASE is as follows: ALTER DATABASE <database _name> SET RECOVERY FULL | SIMPLE | BULK_LOGGED C0262271X.fm Page 71 Friday, April 29, 2005 7:29 PM [...]... select the Microsoft Jet 4.0 OLE DB Provider to connect to an Access database C 026 227 1X.fm Page 96 Friday, April 29 , 20 05 7 :29 PM 96 Chapter 2 Configuring SQL Server 20 05 Figure 2- 5 Create a new linked server 4 Select the Security page, which Figure 2- 6 shows, to configure the security context that you will use for the linked server Figure 2- 6 Configure the security model for a linked server C 026 227 1X.fm... new database roles D You can add fixed server roles to database roles C 026 227 1X.fm Page 88 Friday, April 29 , 20 05 7 :29 PM 88 Chapter 2 Configuring SQL Server 20 05 Lesson 6: Configuring Encryption SQL Server 20 05 provides a hierarchical key infrastructure that lets you encrypt data—offering a new level of security that didn’t exist in previous versions of SQL Server To implement data encryption in... created manually C 026 227 1X.fm Page 94 Friday, April 29 , 20 05 7 :29 PM 94 Chapter 2 Configuring SQL Server 20 05 Lesson 7: Configuring Linked Servers SQL Server lets you access external data sources from your local Transact -SQL code You can get ad hoc access to external data sources by using the OPENROWSET function When you need to access data outside your local instance—such as a remote SQL Server; another... restore operations are NOT allowed in the Simple recovery model? (Choose all that apply.) A Point-in-Time Restore B Differential C Full D Page Restore C 026 227 1X.fm Page 74 Friday, April 29 , 20 05 7 :29 PM 74 Chapter 2 Configuring SQL Server 20 05 Lesson 4: Configuring Server Security Principals SQL Server 20 05 provides a strong security model that helps you prevent unauthorized access to your important... four-part table name—in the form linked _server_ name.catalog.schema.object_name—for each data source you are querying C 026 227 1X.fm Page 95 Friday, April 29 , 20 05 7 :29 PM Lesson 7: Configuring Linked Servers 95 Here are the general steps for creating a linked server: 1 Expand the Server Objects node within Object Explorer in SSMS, as Figure 2- 4 shows Figure 2- 4 Manage Linked Servers from SSMS 2 Right-click... Server Roles SQL Server provides a set of fixed server roles, such as sysadmin and securityadmin, which you can use to assign and manage administrative privileges to logins by adding logins as members of these roles Table 2- 2 describes the fixed server roles for SQL Server 20 05 Table 2- 2 SQL Server s Fixed Server Roles Fixed Server Role Members Can sysadmin Perform any activity in SQL Server The permissions... CONNECT SQL TO [domain_name\user_name] C 026 227 1X.fm Page 77 Friday, April 29 , 20 05 7 :29 PM Lesson 4: Configuring Server Security Principals NOTE 77 Backward compatibility You can use SQL Server 20 00 stored procedures, such as sp_addlogin, sp_droplogin, and so on, to manage logins But remember that these stored procedures are in SQL Server 20 05 only for backward-compatibility purposes Managing Fixed Server. .. policy on SQL Server logins C 026 227 1X.fm Page 76 Friday, April 29 , 20 05 7 :29 PM 76 Chapter 2 Configuring SQL Server 20 05 BEST PRACTICES Password policies To get a secure SQL Server environment, you should use the options to check the Windows expiration policy for SQL Server logins and apply the local Windows password policy on them In the following example, you create a SQL Server login and force checking... are located in the “Answers” section at the end of the book 1 Which of the following are valid SQL Server principals? (Choose all that apply.) A Database users B Fixed server roles C Windows logins D SQL Server logins C 026 227 1X.fm Page 80 Friday, April 29 , 20 05 7 :29 PM 80 Chapter 2 Configuring SQL Server 20 05 2 Which of the following sentences are true regarding authentication modes? (Choose all that... tries to access a database, SQL Server looks for the Guest database user SQL Server creates a Guest user in each database By default, the Guest user is not permitted to connect to the database You can allow guest connections by activating the Guest user, as follows: GRANT CONNECT TO Guest C 026 227 1X.fm Page 82 Friday, April 29 , 20 05 7 :29 PM 82 Chapter 2 Configuring SQL Server 20 05 You can revoke guest . the text boxes as Fig- ure 2- 2 shows. Click OK and then click Next. C 026 227 1X.fm Page 65 Friday, April 29 , 20 05 7 :29 PM 66 Chapter 2 Configuring SQL Server 20 05 Figure 2- 2 New Database Mail Account. ; C 026 227 1X.fm Page 67 Friday, April 29 , 20 05 7 :29 PM 68 Chapter 2 Configuring SQL Server 20 05 Lesson Summary ■ Database Mail is the SQL Server 20 05 subsystem that lets you send e-mail mes- sages. 62 Chapter 2 Configuring SQL Server 20 05 2. You are in charge of designing the physical structure for your company’s new server running SQL Server 20 05. The server has the following

Ngày đăng: 09/08/2014, 09:21