Tài liệu System Administration for Microsoft® SQL Server™ 7.0 doc

472 631 1
Tài liệu System Administration for Microsoft® SQL Server™ 7.0 doc

Đ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

System Administration for Microsoft SQL Server 7.0 ™ ® Workbook Course Number: 832B Part Number: X03-91260 Released: 12/98 Information in this document is subject to change without notice The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product, or event, unless otherwise noted Complying with all applicable copyright laws is the responsibility of the user No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Microsoft Corporation If, however, your only means of access is electronic, permission to print one copy is hereby granted Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property ? ?1998 Microsoft Corporation All rights reserved Microsoft, ActiveX, BackOffice, MS-DOS, Outlook, PowerPoint, Visual Basic, Visual C++, Visual Studio, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A and/or other countries The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product, or event, unless otherwise noted Other product and company names mentioned herein may be the trademarks of their respective owners Project Leads: Lori Oviatt, Margo Crandall Instructional Designers: Homer Christensen (Working Knowledge), Xandria Eykel (S&T OnSite), Cheryl Hoople (Write Stuff), Marilyn McGill Lead Program Manager: Karal Dehmer Program Managers: Dan Basica, Adam Shapiro, Stacey Dickinson (Solutions View), Carl Rabeler (Shadow Mountain Computers) Graphic Artist: Kimberly Jackson Editing Manager: Tina Tsiakalis Editor: Wendy Cleary (S&T OnSite) Online Program Manager: Nikki McCormick Online Support: Arlo Emerson (MacTemps), Tammy Stockton (Write Stuff) Compact Disc Testing: ST Labs Production Support: Kathy Ford (S&T OnSite) Manaufacturing Manager: Bo Galford Manufacturing Support: Rick Terek (S&T OnSite) Lead Product Manager, Development Services: Elaine Stovall Lead Product Manager: Heidi Tucker Group Product Manager: Robert Stewart Course Number: 832B Part Number: X03-91260 Released: 12/98 Contents Contents iii Introduction Introductions .3 Course Materials Prerequisites Course Outline Microsoft Certified Professional Program Facilities 10 Module 1: SQL Server Overview Overview 13 What Is SQL Server 14 SQL Server Platforms 16 SQL Server Integration with Windows NT 17 SQL Server Integration with Microsoft BackOffice 18 SQL Server Services 19 SQL Server Software 20 SQL Server Architecture 22 Communication 23 Application Development 24 Administration 26 SQL Server Security 28 Login Authentication 29 Database User Accounts and Roles 30 Permission Validation 32 SQL Server Databases 33 Types of Databases 34 Database Objects 35 Referring to SQL Server Objects 36 System Tables 38 Metadata Retrieval 39 Working with SQL Server 41 Designing an Application for SQL Server 42 Implementing a SQL Server Database 44 Administering a SQL Server Database 45 Lab 1.1: SQL Server Overview 46 Review 47 Module 2: Installing and Configuring SQL Server Overview 51 Minimum Hardware and Software Requirements 52 SQL Server 7.0 Editions 53 SQL Server Installation Options 54 Licensing Mode 55 Installation Path 56 Character Set 57 Sort Order 59 Unicode Collation 61 Network Support 62 iv Contents SQL Server Services Logon Account 64 Running SQL Server Setup 66 Unattended Installation 68 Verifying the Installation 70 Reviewing Installation Results 71 Starting SQL Server Services 72 Connecting to SQL Server 74 Preparing to Use SQL Server 75 Configuring SQL Server Enterprise Manager 76 Configuring SQL Server 78 Troubleshooting 79 Recommended Practices 81 Lab 2.1: Installing and Configuring SQL Server 82 Review 83 Module 3: Managing Security Overview 87 Implementing an Authentication Mode 88 Authentication Processing 89 Choosing an Authentication Mode 91 Steps in Implementing an Authentication Mode 92 Creating Login Accounts 93 Demonstration: Setting Up Login Accounts 95 Lab 3.1: Managing Security 96 Assigning Login Accounts to Users and Roles 97 Assigning Login Accounts to User Accounts 98 Assigning Login Accounts to Roles 100 Fixed Server Roles 101 Fixed Database Roles 102 User-defined Database Roles 104 Assigning Permissions to Users and Roles 106 Types of Permissions 107 Granting, Denying, and Revoking Permissions 109 Granting Permissions to Allow Access 110 Denying Permissions to Prevent Access 112 Revoking Granted and Denied Permissions 114 Planning Security 116 Demonstration: Assigning Login Accounts to User Accounts and Roles 118 Lab 3.2: Managing Permissions 119 Managing Application Security 120 Managing Security with Views and Stored Procedures 121 Managing Client Application Security with Application Roles 123 Creating Application Roles 124 Activating Application Roles 125 Recommended Practices 127 Lab 3.3: Managing Application Security 128 Review 129 Contents v Module 4: Managing Database Files Overview 133 Introduction to Databases 134 How Data Is Stored 135 Multimedia Presentation: Transactions 136 How the Transaction Log Works 137 Creating Databases 138 Setting Database Options 140 Modifying Databases 142 Managing Data and Log File Growth 143 Expanding a Transaction Log 145 Shrinking a Database or File 147 Dropping a Database 149 Managing Databases on Multiple Disks 151 Leveraging the Windows NT Server Fault Tolerance 152 Creating Filegroups 154 Capacity Planning 156 Determining the Size of model Database and System Tables 157 Estimating the Amount of Data in Tables 158 Performance Considerations 159 Recommended Practices 160 Lab 4.1: Managing Database Files 161 Review 162 Module 5: Backing Up Databases Overview 167 Preventing Data Loss 168 SQL Server Backup 170 Performing and Storing Backups 171 When to Back Up Databases 172 Backing Up System Databases 173 Backing Up User Databases 175 Activities That Are Restricted During Backup 177 Performing Backups 178 Creating Permanent Backup Files 179 Creating Temporary Backup Files 181 Using Multiple Backup Files to Store Backups 183 Using the BACKUP Statement 185 Backing Up to a Tape Device 187 Specifying Tape Options 188 Types of Backup Methods 190 Performing a Full Database Backup 191 Performing a Differential B ackup 193 Performing a Transaction Log Backup 195 Using the NO_TRUNCATE Option 196 Clearing the Transaction Log 197 Performing a Database File or Filegroup Backup 199 vi Contents Restrictions on Backing Up Database Files or Filegroups 201 Demonstration: Using SQL Server Enterprise Manager to Perform Backups 202 Planning a Backup Strategy 203 Full Database Backup Strategy 204 Full Database and Transaction Log Backup Strategy 207 Differential Backup Strategy 209 Database File or Filegroup Backup Strategy 211 Performance Considerations 213 Recommended Practices 214 Lab 5.1: Backing Up Databases 215 Review 216 Module 6: Restoring Databases Overview 221 SQL Server Recovery Process 222 SQL Server Activities During the Restore Process 223 Preparing to Restore a Database 225 Verifying Backups 226 Performing Specific Tasks Before Restoring Backups 228 Restoring Backups 229 Using the RESTORE Statement 230 Initiating the Recovery Process 231 Specifying Restore Options 232 Restoring Databases from Different Backup Types 233 Restoring from a Full Database Backup 234 Restoring from a Differential Backup 236 Restoring a Transaction Log Backup 237 Specifying a Point in Time 239 Restoring from a File or Filegroup Backup 241 Using a Standby SQL Server 243 Setting Up a Standby SQL Server 244 Using the Standby SQL Server as a Read-Only Server 246 Using the STANDBY Option 248 Replacing a Production Server with a Standby SQL Server 250 Restoring Damaged System Databases 252 Recommended Practices 254 Lab 6.1: Restoring Databases 255 Review 256 Module 7: Automating Administrative Tasks Overview 261 Reasons to Automate 262 Introduction to SQL Server Automation 263 Multimedia Presentation: Automating SQL Server Administration 264 Writing Events to the Application Log 265 Preparing to Automate 266 Configuring Mail 268 Automating Routine Maintenance Tasks 270 Creating Jobs 271 Contents vii Verifying Permissions 272 Defining Job Steps 274 Determining Action Flow Logic for Each Job Step 276 Scheduling Jobs 277 Creating Operators to Notify 278 Reviewing and Configuring Job History 280 Lab 7.1: Creating Jobs and Operators 282 Creating Alerts 283 Using Alerts to Respond to Potential Problems 284 Creating Alerts to Respond to SQL Server Errors 285 Creating Alerts on a User-defined Error 287 Responding to Performance Condition Alerts 289 Assigning a Fail-Safe Operator 290 Troubleshooting SQL Server Automation 291 Troubleshooting Alerts 293 Lab 7.2: Creating Alerts 295 Automating Multiserver Jobs 296 Defining Multiserver Jobs 298 Demonstration: Creating a Master Job 299 Publishing SQL Server Data on the Web 300 Creating a Web Page 301 Formatting the Web Page 303 Generating the Web Page 304 Managing Web Assistant Jobs 306 Recommended Practices 308 Lab 7.3: Publishing SQL Server Data on the Web 309 Review 310 Module 8: Transferring Data Overview 305 Introduction to Importing and Exporting Data 306 Why to Import and Export Data 307 Why to Transform Data 308 Tools for Importing and Exporting Data in SQL Server 310 Introduction to Data Transformation Services 312 DTS Overview 313 DTS Process 314 DTS Tools 315 Transforming Data with DTS 317 Creating a DTS Package 318 Transforming and Mapping Data 320 Defining Transformation Tasks 322 Defining Workflows 323 Defining Data Lineage 325 Executing and Scheduling a DTS Package 326 Demonstration: Defining a DTS Package 327 Recommended Practices 328 Lab 8.1: Transferring Data 329 Review 330 viii Contents Module 9: Monitoring and Maintaining SQL Server Overview 335 Why Monitor SQL Server 336 Reasons to Monitor SQL Server 337 Factors That Affect Performance 338 Detecting Performance Bottlenecks 340 Tools for Monitoring SQL Server 342 Common Monitoring Tasks 343 Using the Microsoft Event Viewer 345 Using SQL Server Performance Monitor 346 Using Current Activity in SQL Server Enterprise Manager 349 Using Transact-SQL to Monitor SQL Server 351 Using SQL Server Profiler 354 Generating a Query History 356 Demonstration: Using SQL Server Profiler 358 Using SQL Server Query Analyzer 359 Creating a Maintenance Plan for SQL Server 360 Developing a Database Maintenance Plan 361 Automating the Database Maintenance Plan Tasks 363 Recommended Practices 365 Lab 9.1: Monitoring SQL Server 366 Review 367 Module 10: Introducing Replication Overview 367 Introduction to Distributed Data 368 The Need for Distributed Data 369 Considerations for Distributing Data 370 Methods to Distribute Data 371 Introduction to SQL Server Replication 373 The Publisher-Subscriber Metaphor 374 Publications and Articles 375 Filtering Data 376 Subscriptions 377 SQL Server Replication Agents 378 SQL Server Replication Types 379 Overview of the Replication Types 380 Multimedia Presentation: SQL Server Replication 382 Considerations for Using Merge Replication 383 Physical Replication Models 385 Overview of the Replication Models 386 Combining Replication Models and Types 387 Central Publisher/Remote Distributor Example 388 Central Subscriber/Multiple Publishers Example 389 Multiple Publishers/Multiple Subscribers Example 390 Recommended Practices 391 Review 392 Contents ix Module 11: Planning and Setting Up Replication Overview 395 Planning Replication 396 Design Considerations 397 Determining a Replication Solution 399 Data Definition Issues 400 Configuring Network Security Access 402 Preparing the Servers 403 Setting Up a Distributor 404 Configuring a Distributor 406 Setting Up a Publisher 408 Setting Up a Subscriber 409 Publishing 410 Creating Publications 411 Publishing Considerations 413 Initial Synchronization 414 Subscribing 416 Setting Up Push and Pull Subscriptions 417 Using the Immediate Updating Subscribers Option 418 Performance Considerations 420 Recommended Practices 421 Demonstration: Implementing Replication 422 Lab 11.1: Implementing Replication 423 Review 424 Module 12: Managing Replication Overview 431 Monitoring and Troubleshooting Replication 432 Using SQL Server Replication Monitor 433 Maintaining Replication 434 Using Replication Scripts 436 Monitoring SQL Server Replication Performance 437 Viewing Replication Agent Histories 439 Troubleshooting Replication 440 Replicating in Heterogeneous Environments 442 Replicating Data with ODBC 443 Publishing Data to Heterogeneous Subscribers 444 Replicating from Heterogeneous Databases 445 Publishing on the Internet 446 Recommended Practices 447 Lab 12.1: Maintaining Replication 448 Review 449 Appendix A: Database Schemas Contents THIS PAGE INTENTIONALLY LEFT BLANK x 448 Module 12: Managing Replication Troubleshooting Replication Slide Objective To identify some common replication problems ? Common replication problems include issues with connectivity and services Check the Error Logs ? Lead-in Verify SQL Server Services ? ? ? MSSQLServer and SQLServerAgent services SQLServerAgent service account and password Test Connectivity by Using SQL Server Query Analyzer Many difficulties in replication processing involve connectivity and security Before these can be addressed, you must determine which servers are involved in a replication problem by observing the processing order of the replication agents Troubleshooting and resolution should focus on the access to each of the servers and to the databases that are involved in the replication scenario Check the Error Logs Several error logs can assist you in troubleshooting replication problems: SQL Server Error Log, SQL Server Agent Error Log, and Windows NT Event Viewer You also can use SQL Server Profiler to troubleshoot replication Verify SQL Server Services Replication agents run under the user context of the SQLServerAgent service If you have difficulty with MSSQLServer service or the SQLServerAgent service, verify that: ?? MSSQLServer and SQLServerAgent services are running ?? The service account and password are properly configured for the SQLServerAgent service Typically, all participants in the replication process should use the same SQLServerAgent service account ?? Multidomain environments have service accounts that are trusted across domains Module 12: Managing Replication 449 Test the Connectivity By default, SQL Server replication uses the Windows NT domain user account that SQL Server Agent uses If you experience a problem with connectivity, test the connectivity as follows: ?? For a push subscription: Log on to the Distributor with the same Windows NT account that the SQLServerAgent service uses on the Distributor From the Distributor, use SQL Server Query Analyzer, choose Windows NT Authentication Mode, and connect to the Subscriber ?? For a pull subscription: Log on to the Subscriber with the same Windows NT account that SQL Server Agent uses on the Subscriber From the Subscriber, use SQL Server Query Analyzer, choose Windows NT Authentication Mode, and connect to the Distributor If you cannot connect using either of these methods, the problem is with security rather than replication 450 Module 12: Managing Replication ? Replicating in Heterogeneous Environments Slide Objective To list the topics in this section Lead-in In this section, we'll cover… ? Replicating Data with ODBC ? Publishing Data to Heterogeneous Subscribers ? Replicating from Heterogeneous Databases With SQL Server, it is possible to replicate data to heterogeneous Subscribers by using Open Database Connectivity (ODBC) and OLE DB It also is possible to replicate data from sources other than SQL Server The term heterogeneous databases refers to data sources other than SQL Server Module 12: Managing Replication 451 Replicating Data with ODBC Slide Objective To discuss replicating data to heterogeneous databases ? Lead-in Data Sources Other Than SQL Server ? Oracle ? ? Microsoft Access ? SQL Server supports replication to heterogeneous databases Other databases that use ODBC ODBC Driver Requirements ? Allow updates ? Conform to ODBC Level ? Support transactions SQL Server supports replication to heterogeneous databases on Windows NT and Microsoft Windows® 95/98 You also can replicate to other platforms, provided that you have the appropriate ODBC or OLE DB driver and necessary communication software Data Sources Other Than SQL Server Heterogeneous databases that are supported by SQL Server replication include:? ?? Microsoft Access databases.? ?? Oracle databases.? ?? Other databases that comply with SQL Server ODBC subscriber requirements.? ODBC Driver Requirements SQL Server comes with Microsoft ODBC drivers for Oracle, Access, and the IBM data protocol Distributed Relational Database Architecture (DRDA) Drivers for other ODBC subscriber types must conform to SQL Server replication requirements for generic ODBC subscribers The ODBC driver must: ?? Allow updates ?? Conform to ODBC Level 1.? ?? Support transactions.? ?? Support the Transact-SQL data definition language (DDL) statements.? ?? Be 32-bit and thread-safe ? ODBC drivers and OLE DB providers for various heterogeneous data sources are included on the SQL Server compact disc For information about a complete list of the ODBC drivers and OLE DB providers in SQL Server Books Online, search on “Driver Support for Heterogeneous Data Sources.” 452 Module 12: Managing Replication Publishing Data to Heterogeneous Subscribers Slide Objective To explain aspects of publishing data to heterogeneous Subscribers ? Use a Push Subscription Lead-in ? Consider These Issues When you publish data to heterogeneous Subscribers, use a push subscription ? ? Snapshot must use character format ? ? Data types are not mapped Truncation before synchronization not supported Use System Stored Procedures To retrieve ODBC configuration information You can publish data to heterogeneous Subscribers by using replication wizards or SQL Server Enterprise Manager Use a Push Subscription You create a push subscription from the Publisher to the heterogeneous Subscriber You cannot set up heterogeneous subscriptions by using a pull subscription Consider These Issues The replication restrictions in the following table apply with replication to all heterogeneous Subscriber types that use ODBC Restriction Explanation Data types SQL Server data types are mapped to the closest data type on the target database Snapshots Must be bulk copy program character format Publication option to truncate Not supported before synchronization Batched statements Not supported to ODBC subscribers ODBC configuration issues The ODBC data source name (DSN) must conform to SQL Server naming conventions The quoted identifier setting on the target server is determined by the SQL Server ODBC driver Use System Stored Procedures SQL Server provides the following system stored procedures to support replication to ODBC subscribers System stored procedure Description sp_enumdsn Reports ODBC DSNs for a server running under a specific Windows NT user account sp_dsninfo Retrieves ODBC or OLE DB database information from the Distributor associated with the current server Module 12: Managing Replication 453 Replicating from Heterogeneous Databases Slide Objective SQL Server Publisher SQL Server Publisher To show a heterogeneous replication topology Lead-in SQL Server allows third-party Publishers SQL Server SQL Server Database Database SQL Server Replication Agents Third-Party Publisher Third-Party Publisher SQL Server Distributor SQL Server Distributor Third-Party Third-Party Database Database Third-Party Replication Agents Subscriber Subscriber SQL Server enables third-party replication products to become Publishers within the SQL Server replication framework To integrate with SQL Server replication, a third-party developer must write a program in Microsoft Visual Basic ®, Microsoft C, or Microsoft Visual C++® by using SQL-DMO When integrated, this heterogeneous Publisher can use all of the SQL Server replication features.? These replication services include:? ?? Programmable replication objects for administering and monitoring replication These are included in SQL-DMO ? ?? Replication Distributor interface for storing replicated transactions.? ?? Distribution Agent to forward transactions to Subscribers.? ?? SQL Server Enterprise Manager to administer and monitor replication graphically.? 454 Module 12: Managing Replication Publishing on the Internet Slide Objective To introduce Internet publishing issues ? Lead-in You must implement certain practices before you publish on the Internet Requirements for Push and Pull Subscriptions ? ? ? Publisher and Distributor must be on same side of firewall and directly connected Use TCP/IP Additional Requirements for Pull Subscriptions ? Ensure Distributor and IIS are on same server ? Set FTP directory to Distributor working folder ? Configure FTP addresses for Distribution and Merge Agents You must implement certain practices before you publish on the Internet Requirements for Push and Pull Subscriptions The following practices apply to both push and pull subscriptions: ?? Ensure that both the Publisher and the Distributor are on the same side of the firewall ?? Make sure that the Publisher and the Distributor have a direct network connection with one another and are not connected by the Internet alone ?? Enable the TCP/IP protocol on each computer where the Distribution Agent and Merge Agent execute and on the computers to which these agents connect Additional Requirements for Pull Subscriptions For a pull subscription you must also: ?? Ensure that the Distributor is installed on the same server as Microsoft Internet Information Server (IIS) ?? Set the File Transfer Protocol (FTP) home directory on IIS to the distribution working folder The default is \\computer_name\C$\Mssql7\Repldata Ensure that this working folder is available to Subscribers ?? Configure the Distribution Agent and Merge Agent at the Subscriber with the correct FTP address You set the address by using the \\Mssql7\binn\distrib.exe Replication Distribution Agent utility from the command prompt at the Distributor Module 12: Managing Replication 455 Recommended Practices Slide Objective To present recommended practices for managing replication Maintain Database and Transaction Log Sizes Maintain Database and Transaction Log Sizes Lead-in Create and Monitor Replication Alerts Use these recommended practices for managing replication Monitor Replication Histories and Event and Error Logs Create Replication Scripts Verify Network Connectivity and Security The following recommended practices are suggested to help you manage replication: ?? Maintain databases and transaction logs at appropriate sizes Ensure that sufficient space exists for the distribution database and transaction log If the distribution database becomes full, Publishers will retain all replicated transactions in their transaction logs, which leads to larger transaction log files ?? Create and monitor replication alerts Alerts decrease the amount of time that is required to look for the source of a replication problem ?? Monitor replication histories and application and error logs to ensure that jobs complete successfully ?? Create replication scripts for recovery, version control, and duplicating replication configuration ?? Verify network connectivity and security, because these are often the cause of replication problems Additional information on the following topics is available in SQL Server Books Online Topic Search on Implementing merge replication to Access Subscriber “replicating to Access” Scripting a replication topology “scripting a replication topology” 456 Module 12: Managing Replication Lab 12.1: Maintaining Replication Slide Objective To prepare students for the lab Lead-in In this lab, you will recreate the Distributor and all existing publications, modify replication agents, and monitor replication Exercise 1: Generating a Replication Script Exercise 2: Modifying Replication Maintenance Properties Module 12: Managing Replication 457 Review Slide Objective To reinforce module objectives by reviewing key points ? Monitoring and Troubleshooting Replication Lead-in ? Replicating in Heterogeneous Environments ? Publishing on the Internet The questions in your workbook cover critical points Delivery Tip Use these questions to review module topics Ask students whether they have any further questions before continuing How can you determine the number of transactions that are marked for replication in the transaction log that are waiting to be read by the Distribution Agent? Use SQL Server Performance Monitor and view the replication counters What would you check first if all of your publications on a server stopped working? Check the SQLServerAgent service to make sure that it is running and configured properly Also check the distribution database and the SQL Server Agent logs You are finished setting up replication You make changes to data in a publication, but the changes are not replicating to the Subscriber How would you determine which replication agent is failing? View the agent histories and check each agent to determine whether it was successful THIS PAGE INTENTIONALLY LEFT BLANK Appendix A: Database Schemas This page is blank Appendix A: Database Schemas 461 THIS PAGE INTENTIONALLY LEFT BLANK ... to: ?? Describe Microsoft® SQL Server ™ version 7.0 and its supported operating system platforms ?? Describe SQL Server architecture ?? Describe SQL Server security ?? Describe SQL Server databases... and stop SQL Server remotely Windows NT Performance Monitor SQL Server sends performance metrics to the Windows NT Performance Monitor, enabling you to monitor the system performance of SQL Server... and is suitable for writing administration scripts for SQL Server The graphical administration tools provided with SQL Server are written using SQL- DMO SQL Server Agent SQL Server Agent is a service

Ngày đăng: 10/12/2013, 16:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan