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

Microsoft SQL Server 2000 Weekend Crash Course phần 9 pptx

41 273 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 41
Dung lượng 476,08 KB

Nội dung

19. What is the difference between SQL Server Mail and SQL Server Mail Agent? 20. What is the security context of SQL Server Mail Agent? 21. How do you send ad hoc e-mail messages? 22. What is the SQL Server Profiler and what can you do with it? 23. How do you view an estimated execution plan for a query? 24. How do you create statistics for a table? Who uses statistics? 25. What would you use as input data for the Index Tuning Wizard? 26. How can you optimize transaction-log performance? 27. What is DBCC? Part V–Sunday Morning Part Review306 404840-9 pr5.F 8/28/01 12:55 PM Page 306 404840-9 pr5.F 8/28/01 12:55 PM Page 307 PART Sunday Afternoon VI Session 27 Disaster Recovery Session 28 SQL Server Security Session 29 Database Connectivity Session 30 Advanced Features of SQL Server 2000 414840-9 po6.F 8/28/01 12:56 PM Page 308 Session Checklist ✔ Planning for disaster ✔ Identifying basic disaster scenarios ✔ Creating standby servers ✔ Managing the disaster D isaster can happen to your system at any time. It might be a hardware fail- ure, a software failure, or both; it might be a problem with your power sup- ply; it might be one of thousands of other things. You need to be prepared to recover from any of these disasters. This session deals with the most common disaster scenarios and the ways to recover from them. Planning for Disaster No matter how well-tuned your system, or how well-behaved your client applica- tions, sooner or later it is going to happen: You are going to get a call at 3:00 AM telling you that your server is down, nobody can connect to the database, and your presence is required immediately. If I had only enough time to give you one SESSION Disaster Recovery 27 424840-9 ch27.F 8/28/01 12:56 PM Page 309 piece of advice, it would be this: Don’t panic. Fortunately, I have more time and space to elaborate on the subject. The basis of disaster recovery is planning. Recovery is really easy — in theory: All you need to do is plan ahead for a disaster and then, when it happens, imple- ment your plan — step by step. Later in this session I discuss the most common disaster scenarios. You will need a separate plan for each one of them, and then for every additional one you can think of. However, for practical reasons, you prob- ably won’t create more than a dozen plans. Every SQL Server RDBMS system consists of at least three components: ¼ Operating system ¼ SQL Server ¼ Client applications that connect to SQL Server Any of these components can malfunction. While you probably won’t have to fix the OS or client-application problems, you should have enough information on hand that other professionals will be able to do so. Start with the assumption that your data are of paramount importance and must be protected. Next, ask yourself: What could go wrong? Blackout, faulty hard drive, computer virus, hacker’s attack, earthquake, alien invasion to mention just a few. You need to have a valid up-to-date recovery plan; moreover this plan has to be tested, and the amount of testing should be proportional to the importance of your data. While you are at it, make sure that you are not the only person capable of performing the recovery, because you might be away just when you are needed the most. To sum it up: ¼ Disasters happen ¼ You need multiple recovery plans, one for each possible scenario ¼ You need to test your plans and keep them up to date ¼ Don’t panic Identifying Basic Disaster Scenarios So you’ve got your server up and running: Your cleverly written custom applica- tions pump tons of data into your properly designed databases, and get them back when necessary. What could possibly go wrong? Sunday Afternoon310 424840-9 ch27.F 8/28/01 12:56 PM Page 310 Physical destruction Chances are that you have one or two computers in your system (it’s mightily diffi- cult to run RDBMS without them, you know). The only way to recover from physical destruction of one of these computers is to replace your system with an identical or compatible (and tested!) hardware configuration. So that you’ll be able to do this if the need should arise, you need to maintain a detailed hardware-configuration list for your system. Your hardware is your first line of defense: Take proper care of it. You need UPS — uninterruptible power supply — so that your com- puters can shut down gracefully in the event of a power failure. If you can afford it, I recommend an air conditioner to keep your computer lab at a constant temperature. Computers do produce heat, and they can operate only within a fairly narrow range of temperatures. Failed operating system Computers cannot run without operating systems, and SQL Server requires Windows NT or Windows 2000 Server. The purpose of configuration management is to maintain a fully restorable configuration: You need to know, in addition to the OS that is in use, the Service Pack that is required, what other software has been installed on the server, and the sequence in which that software was installed. You need ready access to all the software you need to install from scratch and you need step-by-step instructions for installing it. Though not foolproof, one technique is to create and archive (possibly Zip) an image of your fully functional system. You will be able to restore this image in much less time than it would take you to perform a step-by-step installation of all the neces- sary stuff; of course, the image must be up to date to be useful. Database corruption On a typical system you will have one or more SQL Server instances, each contain- ing one or more custom databases, plus the master, model, MSDB, and TempDB databases. Any of these can become corrupted. Corruption can occur on various levels — from compromised data integrity to physical corruption of the data files and Windows Registry. Tip Tip Session 27—Disaster Recovery 311 Part VI—Sunday Afternoon Session 27 424840-9 ch27.F 8/28/01 12:56 PM Page 311 Verifying functionality Once you’ve restored your working configuration you need to verify that all the functionality is there. You need to do this yourself; you cannot rely on the users to tell you. This means that you need a testing program (preferably a script you can run from the command line) that will test the base functionality of the restored system. You need a disaster-recovery plan for each of the scenarios I’ve mentioned so far. Your plan must be up-to-date and it must be tested — you’ll have no time for tune-up operations while recovering a system. Creating Standby Servers When you’re dealing with disaster recovery time is always in short supply. Your database is supposed to be operational five minutes ago; it was not supposed to be down in the first place. Sunday Afternoon312 Back Up and Restore! When it comes to restoring data and databases nothing beats backups. I discuss backing up databases and transaction logs in Session 18; I hope I’ve convinced you of the paramount importance of timely backups. Once you’ve got your OS, SQL Server, and all the applicable Service Packs installed, restore the master database from your backup. Restoring your master database from a backup is not the same as rebuild- ing it. Restoring it from backup brings the old master database back to life, with all the old changes and preferences; rebuilding gives you a new master database with all the default settings of a newborn SQL Server. You need to have a full up-to-date backup of every important database in your SQL Server installation (you can restore Northwind and Pubs databases from SQL scripts, however; see Session 6 for details). Moreover, you must store these backups safely so that they will not perish with your RDBMS system. You must maintain proper records of the basic configuration of your SQL Server: passwords, network libraries used, collation order — all the choices you made when installing and configuring your SQL Server. 424840-9 ch27.F 8/28/01 12:56 PM Page 312 While you are trying your patience restoring your primary server, you can switch a standby server into operation to supply all the data services. To create a standby server, follow these steps: 1. Install an identical copy of SQL Server on identical or compatible hard- ware. Make sure that the configuration of both servers is identical (iden- tical passwords, collation order, code page, and so on). 2. Copy all the databases from the primary server to the standby server. You can do this in a variety of ways: by restoring backups of the primary server to the standby; by copying databases through DTS; by running SQL scripts, and so on. 3. Periodically synchronize data between the primary server and the standby server. When your primary server fails, bring your standby server online. Before doing this you need to restore the most recent backup and apply all the transaction logs from the primary server. Any changes you make to your standby server you must also make to your primary server after bringing it back to life. It is important to remember that all the current users of a primary server must log onto this standby server once it is brought online; none of the user processes will be switched to the standby server. Managing the Disaster It has happened. You have all this expensive hardware junk in front of you and you need to bring it back to life — now. But you aren’t panicking — you are prepared! If you are using standby servers, bring one online immediately (do not forget to apply the most recent backups). Ask users to save whatever work they might be in the middle of, log off, and log on again. This will give you time to concentrate on the task at hand: restoring your primary server. Note Session 27—Disaster Recovery 313 Part VI—Sunday Afternoon Session 27 424840-9 ch27.F 8/28/01 12:56 PM Page 313 Evaluate the type of disaster and characterize it as one of the following: ¼ Hardware failure ¼ OS failure ¼ SQL Server failure ¼ Some combination of the above Once you’ve determined the type, you need to determine your course of action, based on the plans you prepared and tested for a case like this. (Though recovery from hardware failure and OS malfunction in general is a fascinating topic, here I will discuss SQL Server recovery only, being constrained by the topic of the book.) You might only have a corrupted database (although this hardly qualifies as a disaster): In this case you can restore the database from a backup, verify its func- tionality, and bring the server back online. Things will get much hairier if you cannot start SQL Server. The simplest thing is to reboot the system. If SQL Server comes back normally, analyze the logs for a possible cause and run a series of tests before bringing it back online; if it does not, try starting from the command line. The <instance name> in the following code refers to your SQL Server name. Drop it if you are starting the default SQL Server instance. Also make sure that you are in the directory in which the SQL Server executable is installed. sqlservr.exe -c - m -s <instance name> Starting SQL Server in single-user mode ensures that nobody else can interfere with recovery. If this operation succeeds you may continue restoring your master database and then proceed with the rest of your plan. If your attempt to start SQL Server fails you can try rebuilding the Registry with a SQL Server installation. This procedure falls a little short of reinstalling SQL Server: It fixes any Registry settings for your SQL Server installation that might have been corrupted, but it will not fix a corrupted master database. If you included the Registry rebuild in your recovery plan, make sure you perform it cor- rectly by following these steps: 1. Repeat all the steps you went through in Session 1 when installing SQL Server for the first time. Make sure that you select all the options you installed SQL Server with originally. Sunday Afternoon314 424840-9 ch27.F 8/28/01 12:56 PM Page 314 2. Select Advanced from the Installation Selection Screen (shown in Figure 27-1). Figure 27-1 Selecting the Advanced installation option 3. Select Registry Rebuild from the screen shown in Figure 27-2. SQL Server warns you about the importance of specifying all the same options you specified in the original installation; if you are not sure which options you specified, you are better off reinstalling the server. If after rebuilding the Registry you still cannot start SQL Server, you have one more option before choosing to reinstall: rebuilding the master database. SQL Server comes with a utility, Rebuildm.exe, that does this. This utility is located in the directory Microsoft SQL Server\80\Tools\Binn. Unlike many command-line commands, this one actually offers a visual interface. Click Browse to specify the location of your data files, and — once you have made your selections — click Rebuild. Session 27—Disaster Recovery 315 Part VI—Sunday Afternoon Session 27 424840-9 ch27.F 8/28/01 12:56 PM Page 315 [...]... making use of the SQL Server database 444840 -9 ch 29. F 8/28/01 12:56 PM Page 338 338 Sunday Afternoon Application ADO DAO RDO ODBC Driver OLE DB Provider (and MSDASQL) Network Protocols SQL Server Figure 29- 5 Visualizing the data-access components relationship Table 29- 1 lists the OLE DB providers tested with SQL Server; it’s adapted from Microsoft SQL Server 2000 Books Online Table 29- 1 List of OLE... Fixed server roles — Applied and administered at the SQL Server level ¼ Database roles — Applied and administered at the database level Fixed server roles Server roles are predefined (fixed) You cannot add a new role on the server level, although you can add users to these roles Table 28-1 lists the fixed server roles adapted from Microsoft SQL Server Books Online Table 28-1 SQL Server 2000 Fixed Server. .. DB Providers for SQL Server 2000 Data Source Provider Name SQL Server 6.5 or later Microsoft OLE DB Provider for SQL Server ODBC Data Sources Microsoft OLE DB Provider for ODBC Microsoft Access (Jet) databases Microsoft OLE DB Provider for Jet version 4.00 Microsoft Excel spreadsheets Microsoft OLE DB Provider for Jet version 4.00 Data Transformation Service Package Data Source Object Microsoft OLE DB... of all SQL Servers visible from your machine Click Next 444840 -9 ch 29. F 8/28/01 12:56 PM Page 335 Session 29 Database Connectivity 335 Figure 29- 2 Selecting the ODBC driver for SQL Server Part VI—Sunday Afternoon Session 29 Figure 29- 3 Specifying properties and the destination data source 444840 -9 ch 29. F 8/28/01 12:56 PM Page 336 336 Sunday Afternoon 4 On the next screen (shown in Figure 29- 4), select... Server authentication) ¼ You set the authentication mode on the server level; it applies to all SQL Server objects 434840 -9 ch28.F 8/28/01 12:56 PM Page 3 29 Session 28 SQL Server Security 3 29 ¼ You can assign users in SQL Server to roles, which are modeled after Windows user groups ¼ Two types of roles exist: server roles and database roles Server roles are fixed and cannot be custom-created; database... drive, SQL Server will stop You can configure SQL Server 2000 to perform C2 auditing, which is an advanced security feature that has more to do with standard guidelines than with SQL Server itself Use it only if your system is C2 certified by U.S government standards REVIEW ¼ SQL Server 2000 supports two modes of user authentication: Windows Authentication Mode and Mixed Mode (both Windows and SQL Server. .. components did Microsoft provide to enable you to program data access to its data sources? 4 What is the prerequisite for accessing SQL Server via HTTP? 5 From which platforms can you connect to SQL Server? 454840 -9 ch30.F 8/28/01 12:56 PM Page 341 SESSION 30 Advanced Features of SQL Server 2000 Session Checklist ✔ Using English Query ✔ Performing full-text searches ✔ Using SQL Server 2000 Analytical... Roles in SQL Server 2000 are modeled after Windows groups and make it easier to assign or revoke permissions and privileges to a group of users at once SQL Server supports two groups of roles: Part VI—Sunday Afternoon Session 28 SQL Server Authentication is provided for compatibility with previous versions (version 7.0 and earlier) as well as for SQL Server instances running on Windows 98 434840 -9 ch28.F... Understanding SQL Server Authentication Modes ✔ Configuring SQL Server roles ✔ Using views as a security mechanism ✔ Understanding SQL Server file permissions ✔ Auditing SQL Server T his session will give you an overview and some hands-on examples of setting up and administering your SQL Server security on various levels, from connection authentication mode through adding members to the Server Fixed... Mode (SQL Server and Windows) Optionally, you may want to set the Audit level (which I’ll discuss later in this session), which will keep track of all login attempts, either successful, unsuccessful, or both, depending on the option you select 434840 -9 ch28.F 8/28/01 12:56 PM Page 321 Session 28 SQL Server Security 321 Figure 28-1 Setting Authentication Mode for SQL Server 2000 Note Configuring SQL Server . these roles. Table 28-1 lists the fixed server roles adapted from Microsoft SQL Server Books Online. Table 28-1 SQL Server 2000 Fixed Server Roles Fixed Server Role Description sysadmin Grants. versions (version 7.0 and earlier) as well as for SQL Server instances running on Windows 98 . Configuring SQL Server Roles Roles in SQL Server 2000 are modeled after Windows groups and make it. start SQL Server fails you can try rebuilding the Registry with a SQL Server installation. This procedure falls a little short of reinstalling SQL Server: It fixes any Registry settings for your SQL

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

w