540 likes | 675 Views
Chapter Three. Administering and Configuring SQL Server 2000. Objectives. Identify the applications installed with SQL Server 2000 Configure SQL Server 2000 with the Enterprise Manager and SQL Query Analyzer Configure SQLMail and SQLAgentMail Create a linked server.
E N D
Chapter Three Administering and Configuring SQL Server 2000
Objectives • Identify the applications installed with SQL Server 2000 • Configure SQL Server 2000 with the Enterprise Manager and SQL Query Analyzer • Configure SQLMail and SQLAgentMail • Create a linked server
Client Applications Installed with SQL Server 2000 Figure 3-1: The SQL Server 2000 program group
Client Applications Installed with SQL Server 2000 • Books Online • Contains the documentation and help files associated with SQL Server 2000 • Client Network Utility • Used to determine the versions of various network libraries installed on a computer
Client Applications Installed with SQL Server 2000 • Configure SQL XML Support in IIS • Opens IIS Virtual Directory Management for SQL Server, which allows SQL Server 2000 to be configured to listen for requests over the Hypertext Transfer Protocol (HTTP) • Most common protocol used to transfer information from Web servers to Web browsers • Enterprise Manager • Management tool for administering and configuring SQL Server 2000 instances
Client Applications Installed with SQL Server 2000 • Import and Export Data • Invokes Data Transformation Services (DTS) Import/Export Wizard • Profiler • Diagnoses queries not running at acceptable speeds • Records set of actions that lead to a problem and replay steps to replicate problems • Monitors how queries perform under specific workloads • Performs security audits of actions occurring on a SQL Server 2000 instance for later review
Client Applications Installed with SQL Server 2000 • Query Analyzer • Standard query tool for use with SQL Server 2000 • Server Network Utility • Changes network libraries for installed instance of SQL Server 2000
Client Applications Installed with SQL Server 2000 • Services Manager • Allows various services associated with SQL Server 2000 to be stopped • Has access to the following services: • SQL Server service • SQL Server Agent service • Microsoft Search service • MS DTC service • MSSQLServerOLAPService service
Server Groups Figure 3-2: SQL Server Enterprise Manager Figure 3-3: Creating Server Groups in Enterprise Manager
Server Groups Figure 3-4: Server Groups screen
Registering Servers • To complete a successful registration, you must supply the following about an instance: • Name of the SQL Server 2000 instance • Authentication mode used to connect to the SQL Server • Server group within which the new instance will reside in Enterprise Manager
Registering Servers Figure 3-5: Registered SQL Server Properties screen
Query Analyzers • Tool used for developing and executing T-SQL statements • Can be started in the following ways • By entering command isqlw in command prompt window or from Run prompt • By clicking Start and navigating to Programs, highlighting Microsoft SQL Server and then clicking on Query Analyzer • Clicking the Tools menu in Enterprise Manager and then clicking on the SQL Query Analyzer
Query Analyzers Figure 3-6 SQL Query Analyzer
Configuring a Registered SQL Server Figure 3-7: Accessing the Properties of a registered instance of SQL Server 2000
Configuring a Registered SQL Server Figure 3-8: General Tab of the SQL Server Properties screen • General tab displays the various software and hardware properties of the computer on which SQL Server 2000 is installed
Configuring a Registered SQL Server Table 3-1: Default startup parameters
Configuring a Registered SQL Server Table 3-2: Additional startup options
Server Setting Tab • Query governor threshold • Maximum query cost a query can have while still being able to run Figure 3-9: Server Settings tab of SQL Server Properties screen
Server Setting Tab • Way in which SQL Server 2000 handles two-digit years is set from the Server Settings Tab • Two-digit years less than or equal to last two digits of cutoff year are in same century as that of cutoff year • Years greater than last two digits of cutoff year are in century previous to that of cutoff year • Rules are not applied for explicit four-digit years Figure 3-10: Configured values and Running values
Memory Tab • Memory tab allows minimum and maximum size parameter for amount of memory that SQL Server 2000 will use Figure 3-11: Memory tab of the SQL Server Properties screen
Database Settings Tab • Database Settings tab allows several global properties for databases across an instance Figure 3-12: Database Settings tab of SQL Server Properties screen
Processor Tab • Thread • Operating system component that allows multiple simultaneous requests to a multiuser application to execute as separate tasks Figure 3-13: Processor tab of SQL Server Properties screen
Security Tab • Security tab provides an interface to alter authentication type and security auditing level of a SQL Server 2000 instance Figure 3-14: Security tab of the SQL Server Properties screen
Connections Tab • Connections tab allows maximum number of simultaneous user connections to be specified Figure 3-15: Connections tab of the SQL Server Properties screen
Configuring Server Options with Sp_configure • Most configuration options modified in SQL Server properties screen are available through a system-stored procedure called sp_configure • The sp_configure procedure takes two parameters: • @configname • Name of the configuration setting to change • @configvalue • New value to assign to the specified configuration setting
Configuring Server Options with Sp_configure Table 3-3: Configuration names for use with sp_configure
Configuring Server Options with Sp_configure Table 3-3: Configuration names for use with sp_configure (cont.)
Configuring E-mail for SQL Server 2000 • There are two services of SQL Server 2000 that provide mail functionality: • SQLMail • SQLAgentMail • Both services can connect to the following e-mail server types: • Microsoft Exchange Server • Microsoft Windows NT Mail • Post Office Protocol (POP3)
Configuring E-mail for SQL Server 2000 Figure 3-16: SQL Mail Configuration screen
Sending Mail with SQLMail • Extended stored procedures • Function that is part of an external software object (DLL), which is coded using the SQL Server 2000 Extended Stored Procedure API Figure 3-17: SQL Server Agent Properties
Sending Mail with SQLMail Table 3-4: SQL Server 2000 extended stored procedure for e-mail
Xp_sendmail Parameters • @recipients • E-mail addresses that e-mail is sent to • @message • Body of the e-mail message to be sent • @query • Valid T-SQL query • @attachments • Semicolon-delimited list of paths for files to be added as an attachment • @copy _recipients • Semicolon-delimited list of addresses to which message is copied
Xp_sendmail Parameters • @blind_copy_recipients • Semicolon-delimited list of addresses to which message is blind copied • @subject • Subject of e-mail to be sent • @type • E-mail message type • @attach_results • Specifies whether query results are returned with the query in the e-mail body
Xp_sendmail Parameters • @no_header • Specifies whether the column headings are returned with the query in the e-mail body • @width • Specifies the line width of the output of a query to prevent line breaks from being inserted into query output • @separator • Text column separator used to format results • @echo_error • Appends any error messages encountered from the execution of the query to the body of the e-mail message
Linked Servers • OLE DB • Microsoft specification for an application programming interface used to access data in relational databases, spreadsheets, mail stores or any data repository with an OLE DB provider • OLE DB Providers • Software components that provide access to various data source types
Linked Servers Figure 3-18: SQL Server linked server architecture
Setting Up a Linked Server Figure 3-19: Linked Servers in Enterprise Manager • Linked Servers are set up through either a graphic interface in Enterprise Manager or by executing system-stored procedures
Setting Up a Linked Server Figure 3-20: General tab of the New Linked Server screen in Enterprise Manager
Setting Up a Linked Server • Linked servers can be created by using system-stored procedure called sp_addlinkedserver • Sp_addlinkedserver takes the following arguments: • @server • System name of server being added as linked server • @srvproduct • Product name of OLE DB provider • @provider • Programmatic identifier for OLE DB provider specified by @srvproduct
Setting Up a Linked Server • Sp_addlinkedserver takes the following arguments (cont.): • @datasrc • Data source name as interpreted by OLE DB provider • @location • Location of data source as interpreted by OLE DB provider • @provstr • Provider-specific OLE DB connection string that identifies a data source • @catalog • Name of the database that resides on the linked server
Setting Up a Linked Server Figure 3-21: Security tab of the New Linked Server screen in Enterprise Manager
Setting Up a Linked Server • Security information can be set up using system-stored procedure called sp_addlinkedsrvlogin • Sp_addlinkedsrvlogin takes the following arguments: • @rmtsrvname • Name of the linked server that login applies to • @useself • Specifies the name of the login used to connect to the linked server
Setting Up a Linked Server • Sp_addlinkedsrvlogin takes the following arguments (cont.): • @locallogin • Login the local server • @rmtuser • Name used to connect to the linked server • @rmtpassword • Password associated with the login supplied for the @rmtuser parameter
Command Line Utilities • Osql utility • Allows T-SQL statements to be run from the command line Figure 3-22: Osql Command Line utility
Osql Options • -L • Lists locally configured servers and name of servers broadcasting on the network • -U • Login name used to connect to SQL Server 2000 • -P • Password for the login • -E • Causes osql to connect to SQL Server 2000 using a trusted connection instead of requesting a password • -S server_name[\instance_name] • Name of instance of SQL Server 2000 osql will connect to
Osql Options • -d database_name • Name of database the query will execute against • -l time_out • Login timeout for osql • -t time_out • Query time used by osql • -s col_separator • Specifies character used as a column separator • -w column_width • Screen width for output queries
Osql Options • -q “query” • Executes query specified when osql starts but does not exit osql when query is completed • -Q “query” • Executes query specified when osql starts and causes osql to exit when query is completed • -I input_file • Full path of a file containing SQL statements or stored procedures • -o output_file • Identifies file that receives output from osql • -p • Includes performance statistics when queries are run
SQLDIAG Utility • SQLDIAG utility generates informational file consisting of diagnostic information and query trace information (if a query is running) • Generates information that Microsoft Product Support will use to help diagnose problems with a SQL Server 2000 implementation
SQLDIAG Utility • File generated by SQLDIAG contains: • Text of all error logs • Registry information • DLL version information