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

Hands-On Microsoft SQL Server 2008 Integration Services part 25 doc

10 154 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 383,54 KB

Nội dung

218 Hands-On Microsoft SQL Server 2008 Integration Services Notify Operator Task The Notify Operator task sends notification messages to SQL Server Agent operators. For this task to work properly, you need to have the SQL Server Agent service working, and for this task to show you the list of operators, you need to have operators defined in the SQL Server Agent and assign them an e-mail address. This task lists only users that have an e-mail address associated with them. Figure 5-35 Configuration options for the Maintenance Cleanup task Chapter 5: Integration Services Control Flow Tasks 219 Following is the step-by-step method to configure this task: 1. Specify an ADO.NET (SqlClient Data Provider) Connection Manager in the Connection field. If you do not have any operator configured with an e-mail address to which you are trying to connect, you will receive the error message “There are no operators with e-mail addresses defined on this server.” You can configure operators using SQL Server Management Studio. 2. Select the operators you want to notify from the list, as shown in Figure 5-36 under the Operators To Notify area. 3. Type in the subject and the message you want to send in the provided fields and click OK to complete the configuration. Figure 5-36 User Interface for the Notify Operator task 220 Hands-On Microsoft SQL Server 2008 Integration Services Rebuild Index Task When you insert, update, or delete records from tables, the indexes become fragmented and the performance suffers. To keep the performance at the optimal level, you may decide to rebuild indexes as part of your SSIS package. The Rebuild Index task drops the index and creates a new one using the specified fill factor for SQL Server database tables and views. By rebuilding the index, this task removes fragmentation of pages, compacts the tables, reclaims disk space, and orders the rows in the contiguous pages, thus improving performance. This task effectively runs the ALTER INDEX REBUILD T-SQL command. Here is the step-by-step method to configure this task: 1. Specify the ADO.NET Connection Manager in the Connection field. 2. Choose the databases from the following options: All Databases, System Databases (master, msdb, model), All User Databases (excluding master, msdb, model, and tempdb) or select databases from the provided list. If you choose a single database from the list, the Object option highlights, enabling you to choose tables or views for which you want to update statistics. However, if you choose multiple databases, you can’t select the tables or views and the Object option is dimmed. 3. If you have selected a single database in the Databases option, you can select Table, View, or Tables and Views in the Object option (Figure 5-37). Selecting Table or View enables the Selection option. 4. When the Selection option is available, you can either select all objects or select objects from the list. 5. Choose how much free space you want to leave in a page. This free space is governed by the FILLFACTOR represented as a percentage. You can either use the original FILLFACTOR by selecting Reorganize Pages with the default amount of free space or you can type in a value for the free space as a percentage when you select the “Change free space per page percentage to” option. Based on your value of free space, a FILLFACTOR value is calculated. For example, if you specify 20% for the free space per page, the FILLFACTOR value will be calculated as 80%. The specified values of 0 and 100 are treated similarly, and the pages are filled to the full capacity. 6. When you build the index, the intermediate sort results are generally stored in the same database. However, you can also store these sort results in the tempdb. By doing this, you can reduce the time required to build an index, when the tempdb is on a separate set of disks than the database in question. Note that this may put extra requirements of space on the tempdb. So, when you want to use tempdb to store the intermediate sort results to reduce time, you can select the Sort results in tempdb advanced option. 7. Choose the “Keep index online while reindexing” advanced option to let the queries or updates happen to the underlying table during reindexing. Chapter 5: Integration Services Control Flow Tasks 221 Reorganize Index Task As mentioned earlier, the insert, update, or delete activities on the tables cause indexes to become fragmented and the performance suffers. To fix this, you can use this task in your SSIS packages; for example, after the Bulk Insert task you may use this task. The Reorganize Index task reorganizes indexes in SQL Server database tables and views and does the defragmenting of indexes by reordering leaf-level pages and compaction. This task runs the ALTER INDEX T-SQL command and uses the REORGANIZE WITH (LOB_COMPACTION = ON) clause in the command. Here is the step-by-step method to configure this task: 1. Specify an ADO.NET Connection Manager in the Connection field. 2. Choose the databases from the option list (refer to Figure 5-38): All Databases, System Databases (master, msdb, model), All User Databases (excluding master, msdb, model, and tempdb), or select databases from the provided list. Figure 5-37 Configuration options for the Rebuild Index task 222 Hands-On Microsoft SQL Server 2008 Integration Services If you choose a single database from the list, the Object option highlights, enabling you to choose Table, View, or Tables and Views for which you want to update statistics. However, if you choose multiple databases in this option, you can’t select the tables or views and the Object option is dimmed. 3. Selecting Table or View highlights the Selection option. When the Selection option is available, you can either select all objects or select objects from the list. 4. You can choose to compact the large objects. The data with the image, text, ntext, varchar(max), nvarchar(max), varbinary(max), or xml data type is considered as the Large object data. You can optionally choose to view the T-SQL code. Shrink Database Task This task runs the DBCC SHRINKDATABASE T-SQL command to shrink the specified database. The step-by-step configuration process goes like this: 1. Specify an ADO.NET Connection Manager to create a connection to the server. 2. Choose the databases from the option list: All Databases, System Databases (master, msdb, model), All User Databases (excluding master, msdb, model, and tempdb), or select databases from the provided list. 3. After selecting the database, specify the size in megabytes beyond what you want this task to execute to shrink the database. 4. Specify how much free space you want to leave in the database by typing in a value as a percentage (from 0 through 100) in the “Amount of free space to remain after shrink” option (see Figure 5-39). This percentage value is calculated on the space occupied by the data in the database and not the total size of the database. For example, when you have a database of 100MB with 40MB of data Figure 5-38 Interface for the Reorganize Index task Chapter 5: Integration Services Control Flow Tasks 223 and 60MB of free space, specifying a 50 percent value in the “Amount of free space to remain after shrink” option will shrink the database to 60MB, having 40MB of data and 20MB of free space. 5. Finally, choose between the two options either to retain the freed space in the database or to return the freed space to the operating system after shrinking. Update Statistics Task This task runs UPDATE STATISTICS T-SQL command to update information about the distribution of key values for one or more statistics groups (collections) in the specified databases. Following is the step-by-step procedure for configuring this task: 1. Specify an ADO.NET (SqlClient Data Provider) Connection Manager to connect to the server. 2. Choose one or more databases from the option list: All Databases, System Databases (master, msdb, model), All User Databases (excluding master, msdb, model, and tempdb), or select databases from the provided list. 3. If you choose a single database from the list, the Object option highlights, enabling you to choose Table, View, or Tables and Views for which you want to update statistics (see Figure 5-40). However, if you choose multiple databases in this option, you can’t select the tables or views and the Object option is dimmed. 4. Selecting Table or View highlights the Selection option. When the Selection option is available, you can select all objects or select objects from the list. Figure 5-39 Interface for the Shrink Database task 224 Hands-On Microsoft SQL Server 2008 Integration Services 5. Choose between the three options to update All Existing Statistics or Column Statistics Only or Index Statistics Only. If you view the T-SQL code, you will see that the Column Statistics Only option adds the WITH COLUMN clause and the Index Statistics Only option adds the WITH INDEX clause to the SQL code. 6. Finally choose a full scan or else specify a percentage or number of rows for the scan type. Summary We have covered a lot of ground in this chapter—all the Control Flow tasks, and we’ve used some of them in Hands-On exercises. We have also used variables and property expressions, along with a little exercise on precedence constraints. By now you must be getting ready to create packages involving complex features and data manipulation. Before we get into advanced features of event handling and logging (Chapter 8) and data flow (Chapters 9 and 10), we will cover administration of SSIS packages in next two chapters so that while you’re learning about functional objects within SSIS, you also understand the storage and security architecture of Integration Services. Figure 5-40 The Update Statistics task interface Administering Integration Services Chapter 6 In This Chapter c Connecting to Integration Services Service c Managing SSIS Packages c Running SSIS Packages c Summary 226 Hands-On Microsoft SQL Server 2008 Integration Services W hen you’re developing a package in Business Intelligence Development Studio (BIDS), the package is stored in the file system. Once the package has been developed, you can choose to save the developed package either on the file system or inside the MSDB database of SQL Server. Later you may use SQL Server Management Studio to run, monitor, or manage the packages from the chosen storage location. SQL Server Management Studio provides these management capabilities using a Windows service—the SQL Server Integration Services 10.0 service. Using this service, you can manage SSIS packages on local or remote servers. Integration Services service lets you stop and start SSIS packages, monitor running packages, import and export packages, and manage and customize the package store. SQL Server Management Studio provides a GUI interface to manage SSIS packages when you connect to Integration Services. Another utility, dtutil, helps you to manage SSIS packages from a command line. It is important to understand that the Integration Services service is a Windows service for managing SSIS packages and behaves in the same way as other Windows services do; for instance, you can use tools to connect to it and get your requests serviced such as to copy or run a package. SQL Server Management Studio is the out-of-the-box application that allows you to connect to the Integration Services service and manage the stored and running SSIS packages, although you can also use the dtutil utility or a custom-built application to do the same. During installation, when you choose Integration Services in the Feature Selection page, SQL Server Integration Services 10.0 service is installed. If you don’t install the Integration Services service, you cannot manage your packages using SQL Server Management Studio; however, you can still save and execute your packages while working in BIDS. Another benefit of having the Integration Services service installed is that it caches the SSIS tasks and components metadata when the package is loaded the first time and speeds up subsequent loading of the package. Connecting to Integration Services Service As mentioned earlier, you can connect to Integration Services using SQL Server Management Studio. When you install the Integration Services service, by default, it is started and is ready to be connected to. Generally, you’ll be connecting to it with the default settings; however, you may have reasons to connect differently. You will be using Integration Services to manage your packages in the following scenarios: Managing packages with default settings c Managing packages saved on a remote server c Managing packages on an instance of SQL Server c Connecting to Integration Services on a remote server c Chapter 6: Administering Integration Services 227 Managing Packages with Default Settings Integration Services creates a configuration file, MsDtsSrvr.ini.xml, on installation. The default configuration file for Integration Services is located in the folder C:\Program Files\Microsoft SQL Server\100\DTS\Binn, though your location may differ, depending upon your installation. Locate the file, right-click it, and choose Open With | Notepad. You will see the following XML configuration code in the file: <?xml version="1.0" encoding="utf-8"?> <DtsServiceConfiguration xmlns:xsd="http://www.w3.org/2001/ XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <StopExecutingPackagesOnShutdown>true </StopExecutingPackagesOnShutdown> <TopLevelFolders> <Folder xsi:type="SqlServerFolder"> <Name>MSDB</Name> <ServerName>.</ServerName> </Folder> <Folder xsi:type="FileSystemFolder"> <Name>File System</Name> <StorePath> \Packages</StorePath> </Folder> </TopLevelFolders> </DtsServiceConfiguration> When you connect to Integration Services using SQL Server Management Studio, you see the File System and MSDB root-level folders, which are explained in detail later in this chapter. For now, let’s focus on connectivity; note that the ServerName element in the configuration file contains a dot (.), which is pointing to the default instance of the local SQL Server. This means by default, you connect to the MSDB database on the default instance of local SQL Server. The File System folder is configured by the FileSystemFolder folder type element, which points to C:\Program Files\Microsoft SQL Server\100\DTS\Packages folder by default. Managing Packages Saved on a Remote Server You might have saved packages to SQL Server on a remote server and want to manage those packages by connecting from your client machine. In this case, you will have SQL Server Management Studio running on your client machine and will connect to the local instance of Integration Services. However, the local instance is configured to manage the storage areas such as the MSDB database that are on the remote server to show packages saved to SQL Server and a UNC path for packages saved to File System. The configuration file is modified to accomplish this. . 218 Hands-On Microsoft SQL Server 2008 Integration Services Notify Operator Task The Notify Operator task sends notification messages to SQL Server Agent operators. For. instance of SQL Server c Connecting to Integration Services on a remote server c Chapter 6: Administering Integration Services 227 Managing Packages with Default Settings Integration Services creates. package. Connecting to Integration Services Service As mentioned earlier, you can connect to Integration Services using SQL Server Management Studio. When you install the Integration Services service,

Ngày đăng: 04/07/2014, 15:21

w