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

SQL Server Tacklebox- P12 ppt

5 121 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 5
Dung lượng 444,81 KB

Nội dung

2 – The SQL Server landscape 55 Figure 2.14: Connection Manager property with blank Server name. Notice that the Server name property value is blank. This is because this value is populated at runtime from the SRV_Conn string variable, from every Foreach Loop Container object in the SSIS package. So how do you populate the server name property with the values stored in the SRV_Conn string variable? That is easy. SSIS, along with other Microsoft technologies like Reporting Services, allows you to use Expressions, which are very useful in controlling object properties including, in this case, the server name. Figure 2.15 shows the Properties window for the Multiserver object. 2 – The SQL Server landscape 56 Figure 2.15: Assigning the User::SRV_Conn variable to the ServerName property. Notice that the expression @[User::SRV_Conn] variable is assigned to the ServerName property. At runtime the ServerName Expression, which is part of the Connection Manager, is populated with the current value of the SRV_Conn variable. As the Foreach Loop container iterates through the server list that was derived from the Populate_ADO Variable From ServerList_SSIS task, the value for the expression changes dynamically and the next server in the list is assigned to variable, and queried. This continues until there are no more servers in the list. All that is required is that you know that they are in the ServerList_SSIS table and have the Connect field set to 1. Executing the package Now that we know how to populate DBA_Rep, via the SSIS Populate_DBA_Rep package, let's execute the package and review the results. Figure 2.16 shows the Populate_DBA_Rep package executing in real time (the task to populate the SQL_Servers table is on the left). 2 – The SQL Server landscape 57 Figure 2.16: Populate_DBA_Rep package executing. At the start of this chapter, I ran a script that retrieved Server information for a single server. With this package, I can execute this script, and all the others, against as many servers as necessary, and return all the results to the central DBA_Rep repository. Listing 2.8 shows a typical reporting query against the recently-populated repository. select SQL_Servers.Server, SQL_Servers.ProductVersion, SQL_Servers.ProductLevel, SQL_Servers.ResourceLastUpdateDateTime, SQL_Servers.ResourceVersion, SQL_Servers.IsIntegratedSecurityOnly, SQL_Servers.EngineEdition, SQL_Servers.InstanceName, SQL_Servers.ComputerNamePhysicalNetBIOS, SQL_Servers.LicenseType, SQL_Servers.NumLicenses, 2 – The SQL Server landscape 58 SQL_Servers.BuildClrVersion, SQL_Servers.[Collation], SQL_Servers.CollationID, SQL_Servers.ComparisonStyle, SQL_Servers.ProductEdition, SQL_Servers.IsClustered, SQL_Servers.IsFullTextInstalled, SQL_Servers.SqlCharSet, SQL_Servers.SqlCharSetName, SQL_Servers.SqlSortOrderID, SQL_Servers.SqlSortOrderName, SQL_Servers.LocationID from SQL_Servers Listing 2.8: Selecting rows from the DBA_Rep table SQL-Servers. The output, as you can see in Figure 2.17, shows data for the two SQL Server instances, MW4HD1 and MW4HD1\SRVSAT. Figure 2.17: Output of multiple servers in the DBA_Rep database. After assuring that all is successful, you can schedule this package to run via SQL Agent. I have done this in my environment and I find that running it during production hours, say once every 3 hours, has no overhead and keeps data relatively fresh for immediate viewing. I have seen it run in about 15 minutes for 70 servers. 2 – The SQL Server landscape 59 SSRS reporting More powerful than ad hoc querying of DBA_Rep is designing fully fledged Reporting Services reports that can be scheduled and subscribed to. You can also offer a level of historical data viewing via SSRS execution snapshots. While I have created and written about many SSRS reports that I have developed for the DBA_Rep solution, one SSRS report, in particular, stands out for me, as I use it daily for many tasks. It is the Job Interval Report and it allows me to filter out SQL Agent Job information by a range of criteria, including whether or not the job is scheduled or enabled, if it is a database backup job, and also if it failed or succeeded on the last run. Additional details tell me how long the job ran, at what time and even how many jobs exist on each monitored server. Figure 2.18 shows the Job Interval Report listing all jobs that are labeled as "backups", based on the parameter "Backup Jobs Only". This helps me narrow down my search criteria, for server, location and job status. While a detailed description of creating such reports is outside the scope of this chapter, I've included several of them in the code download for the book. Figure 2.18: SSRS Job Interval report based on DBA_Rep database query. Summary Whether you build your own, deploy someone else's, or purchase one from a vendor, having a documentation solution is critical for a DBA, especially when dealing with more than 20 servers. In this chapter, I dove headlong into how to . SQL_ Servers.IsFullTextInstalled, SQL_ Servers.SqlCharSet, SQL_ Servers.SqlCharSetName, SQL_ Servers.SqlSortOrderID, SQL_ Servers.SqlSortOrderName, SQL_ Servers.LocationID from SQL_ Servers Listing 2.8:. SQL_ Servers.EngineEdition, SQL_ Servers.InstanceName, SQL_ Servers.ComputerNamePhysicalNetBIOS, SQL_ Servers.LicenseType, SQL_ Servers.NumLicenses, 2 – The SQL Server landscape 58 SQL_ Servers.BuildClrVersion,. 58 SQL_ Servers.BuildClrVersion, SQL_ Servers.[Collation], SQL_ Servers.CollationID, SQL_ Servers.ComparisonStyle, SQL_ Servers.ProductEdition, SQL_ Servers.IsClustered, SQL_ Servers.IsFullTextInstalled,

Ngày đăng: 04/07/2014, 23:20