Tài liệu MASTERING SQL SERVER 2000- P21 doc

50 271 0
Tài liệu MASTERING SQL SERVER 2000- P21 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

CHAPTER 27 • REPLICATION 1020 company with different data-processing rules. In this instance, select No and click Next. 10. The next screen asks whether there are any subscribers that are not running SQL Server 2000. This is because other database systems may not understand proper- ties that are proprietary to SQL Server 2000. Also the snapshot can be stored in a format that only SQL Servers will understand (a binary format), which will make replication faster. If there are third-party servers involved, the snapshot must be stored in a format that they can read (character mode). Accept the defaults here and click Next. 11. On the next screen, you need to choose what you will publish as an article. Under Object Type, leave the default of Tables checked (this just limits the dis- play to tables only). Then on the right side of the dialog box, check the box next to Employees to enable it for publication. 12. Click the ellipsis button next to the Employees table to bring up the properties for the article (as tables are called in replication). 13. On the General tab of the Table Article Properties dialog box, change the Desti- nation Table Name to Repl_Employees and click OK. 2627ch27.qxd 8/22/00 11:24 AM Page 1020 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 1021 14. Click OK to continue to the next screen, where you are warned about the iden- tity replication issue and click Next. 15. On the next screen, you are asked to select a publication name and description. In the Publication Name box, enter Northwind Employees and leave the description that is typed in for you. Click Next. CREATING AND SUBSCRIBING TO A SNAPSHOT PUBLICATION Advanced Topics PART VI 2627ch27.qxd 8/22/00 11:24 AM Page 1021 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 27 • REPLICATION 1022 16. You are now asked whether you would like to customize the publication further by allowing anonymous subscribers or adding partitioning. Select Yes and click Next. 17. On the next screen, you are asked whether you would like to vertically or hori- zontally partition the data in some of the articles. Leave both boxes unchecked and click Next. 18. You are now asked whether you would like to allow anonymous subscribers to access your publication. If you select No, all subscribers must be registered in your copy of Enterprise Manager (meaning that you can see them in Enterprise Manager). If you select Yes, any server can subscribe to your data. Choose Yes if you intend to use pull subscriptions. You will choose Yes here and click Next. 19. On the next screen, you can change the schedule at which a snapshot is cre- ated to refresh the subscribers. This is done to make sure the subscriber is always up-to-date. You are going to use the default schedule and click Next. 20. On the final screen, click Finish to create your publication. 21. You will now see a list of tasks that SQL Server must complete to create your publication, after which you are presented with a dialog box informing you of success. Click OK. Now you should look back at the Create and Manage Publications dialog box, where you should see a pink-book icon. This is the icon used for snapshot replication (other types are different colors). If you click the Properties button, you will see a dia- log box that allows you to change any of the properties of the publication. This time you will pull the subscription so that you can see the difference in the process between pushing and pulling. In this next series, you will pull the subscrip- tion to the SECOND server: 1. Please close any open dialog boxes and return to Enterprise Manager. Once there, click the SECOND server to select it. 2. On the Tools menu, select Replication and click Pull Subscription to Server\second. 3. On the Pull Subscription dialog box, select Northwind and click the Pull New Subscription button. 4. On the welcome screen, check the box next to Show Advanced Options and click Next to get started. 2627ch27.qxd 8/22/00 11:24 AM Page 1022 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 1023 5. On the next screen, you can opt to find a publication by browsing through the available SQL Servers or searching Active Directory (assuming that you listed the publication in Active Directory). Choose the option to Look at Publications from Registered Servers and click Next. CREATING AND SUBSCRIBING TO A SNAPSHOT PUBLICATION Advanced Topics PART VI 2627ch27.qxd 8/22/00 11:24 AM Page 1023 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 27 • REPLICATION 1024 6. On the Choose Publication dialog box that comes up next, expand the pri- mary server (not SECOND), select the Northwind Employees subscription, and click Next. 7. You are now asked for the destination database; this is where the replicated data will reside. Because you changed the name of the destination table, you can use Northwind as the target database and click Next. 2627ch27.qxd 8/22/00 11:24 AM Page 1024 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 1025 8. The next screen asks whether this should be an anonymous subscription. Anonymous subscriptions are not registered at the publisher and are very useful for Internet subscriptions where FTP is used, because passwords are sent in clear text and therefore are unsecured. Leave the default of No, This Is a Named Sub- scription and click Next. 9. You are now informed that the schema will be updated. There is no choice in the matter here, because on a pull subscription, SQL Server can detect whether the schema exists. Click Next to continue. CREATING AND SUBSCRIBING TO A SNAPSHOT PUBLICATION Advanced Topics PART VI 2627ch27.qxd 8/22/00 11:24 AM Page 1025 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 27 • REPLICATION 1026 10. On this screen, you are asked from where to get the snapshot files. This can be the default (which is the distribution working folder) or a CD-ROM, FTP server, or Zip drive or some other removable media. In this instance, select the default location and click Next. 11. On the next screen, you are asked for an update schedule. Continuously means that the server will check for updates and pull them over whenever there is a change in the data (this is a bad choice for snapshot replication, because it copies the entire publication every time). The Schedule option allows you to pick a specific time for updating, and the On Demand Only option will instruct SQL Server not to replicate changes automatically—you will need to start repli- cation yourself using the Replication Monitor. In this case, leave the default schedule and click Next. 2627ch27.qxd 8/22/00 11:24 AM Page 1026 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 1027 12. The next screen ensures that the SQLServerAgent service is running on the pub- lisher. If the service is not running, replication will fail. Click Next to continue. 13. On the last screen, click Finish to pull the subscription. 14. You will see a list of tasks that SQL Server must perform to pull the subscription, after which a dialog box will inform you of success. Click OK. With a snapshot publication in place and a pull subscription running, you can test the replication. In the next series of steps, you will open two copies of Query Ana- lyzer, one connected to each instance of SQL Server, and test the replication of data: 1. Open the first copy of Query Analyzer by selecting it from the SQL Server 2000 program group under Programs on the Start menu and log in to the primary server (called first from here on out). 2. Open another copy of Query Analyzer and log in to the SECOND server (called sec- ond from here on out) by typing server_name\SECOND in the Server Name box. 3. In the second copy of Query Analyzer, enter and execute the following code to verify that replication worked: USE Northwind SELECT * FROM Repl_Employees 4. Now you will add a record to the original table; switch to the first copy of Query Analyzer, and enter and execute the following code: USE Northwind CREATING AND SUBSCRIBING TO A SNAPSHOT PUBLICATION Advanced Topics PART VI 2627ch27.qxd 8/22/00 11:24 AM Page 1027 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 27 • REPLICATION 1028 INSERT Employees (LastName, FirstName, Title) VALUES (‘Frost’, ‘Jasmine’, ‘Developer’) 5. Wait for about 5 minutes (to give the server time to replicate), switch to the sec- ond copy of Query Analyzer, and enter and execute the following code to see whether the change replicated: USE Northwind SELECT * FROM Repl_Employees WHERE LastName = ‘Frost’ 6. Close both copies of Query Analyzer once you are able to see the record in the second copy. With that, you have successfully created and pulled a snapshot subscription. We can now move on to merge replication. Creating and Subscribing to a Merge Publication Merge replication is used when the publisher and all subscribers need to be able to make changes to their local copy of the data and have those changes replicated to all other subscribers in the replication topology. To demonstrate how this works, you will configure a merge publication on the Northwind database; then you will have the 2627ch27.qxd 8/22/00 11:24 AM Page 1028 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 1029 SECOND server subscribe to the publication; finally you will modify the same record in both databases and see how to deal with the subsequent conflict: 1. If you are not in Enterprise Manager, open it by selecting it from the SQL Server 2000 group under Programs on the Start menu. 2. Click your default server (not SECOND) in the contents pane and from the Tools pull-down menu, select Replication and then click Create and Manage Publications. 3. From the Create and Manage Publications dialog box, select Northwind and click Create Publication to start the Create Publication Wizard. 4. On the first screen of the Wizard, check the box next to Show Advanced Options and click Next. 5. On the second screen, you will select Northwind as the database to publish from and click Next. 6. On the next screen, you are asked whether you would like to use the existing publication as a template. This is handy if you are creating another, similar transactional subscription. Because you are not, click No, I Will Define and then click Next. 7. On the next screen, you are asked what type of replication this is to be; choose Merge and click Next. CREATING AND SUBSCRIBING TO A MERGE PUBLICATION Advanced Topics PART VI 2627ch27.qxd 8/22/00 11:24 AM Page 1029 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... each instance of SQL Server, and test the replication of data: 1 Open the first copy of Query Analyzer by selecting it from the SQL Server 2000 program group under Programs on the Start menu and log in to the primary server (called first from here on) 2 Open another copy of Query Analyzer and log in to the SECOND server (called second from here on) by typing server_ name\SECOND in the Server Name box... steps involved in using SQL Server 2000 Analysis Services to analyze your data To do this, we’ll use the FoodMart sample data that ships with Analysis Services This data is in Microsoft Access format, so it’s accessible to Analysis Services users who don’t have SQL Server available Because we don’t have that problem, we’ll start by using SQL Server DTS to bring the data into a SQL Server database Please... will be running SQL Server 2000 If so, the snapshot can be stored in a format that only SQL Servers will understand (a binary format), which will make replication faster If there are thirdparty servers involved, the snapshot must be stored in a format that they can read (character mode) Not only that, but other database systems may not understand all of the proprietary properties in SQL Server 2000 Leave... looking for patterns and summarizing what’s in a database, is called online analytical processing, or OLAP Microsoft SQL Server 2000 includes a separate program called Microsoft SQL Server 2000 Analysis Services Analysis Services makes it possible to perform OLAP-based analysis on SQL Server and other OLE DB databases In this chapter, you’ll learn the basic concepts of OLAP and then see how it’s implemented... information on DTS, see Chapter 22 Creating a Sample Database To create a SQL Server database with the FoodMart data and populate it, follow these steps: 1 Launch SQL Server Enterprise Manager 2 Expand the treeview until you get to the Databases node for your server Rightclick this node and choose New Database 3 Name the database FoodMartSQL Click Next to move through the Create Database Wizard, accepting... both the subscribing and publishing servers to update the same data at the same time When you updated the same data on both servers at once (the ALFKI record), the server with the highest priority tentatively won the conflict To make sure that the right data is in the databases after a conflict, you then opened the Microsoft Replication Conflict Viewer and told SQL Server which data to keep in the databases... Import/Export Wizard by choosing Microsoft SQL Server ➣ Import and Export Data from the Start menu 5 For the data source, choose the Microsoft Access driver and browse to the FoodMart database By default, this is located at C:\Program Files\OLAP Services\Samples\foodmart 2000.mdb 6 For the data destination, choose the OLE DB Provider for SQL Server and select the FoodMartSQL database that you just created... database, follow these steps: 1 Choose Programs ➣ Microsoft SQL Server ➣ Analysis Services ➣ Analysis Manager from the Start menu Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark 2627ch28.qxd 8/22/00 11:28 AM Page 1053 USING ANALYSIS SERVICES 1053 2 Expand the Analysis Servers node and find your server s name Right-click the server and choose New Database This will open the Database... database FoodMartSQL 3 Click OK to create the database This will create the database, but will not connect it to any data 4 Expand the new database node and right-click the Data Sources node Choose New Data Source This will open the familiar Data Link Properties dialog box Select the OLE DB Provider for SQL Server and click Next Select your server, enter login information, select the FoodMartSQL database,... more time-consuming and require writing even more queries That’s where OLAP comes in The basic idea is to trade off increased storage space now for speed of querying later SQL Server 2000 ships with an entire product, Microsoft SQL Server 2000 Analysis Services, designed to make this trade-off Later in the chapter, you’ll see how you can use Analysis Services to extract summary information from your . not understand all of the proprietary properties in SQL Server 2000. Leave the default of servers running SQL Server 2000 and click Next. 9. On the next screen,. each instance of SQL Server, and test the replication of data: 1. Open the first copy of Query Analyzer by selecting it from the SQL Server 2000 program

Ngày đăng: 26/01/2014, 08:20

Mục lục

  • PART I • INTRODUCING SQL SERVER

    • 1 Introduction to SQL Server 2000

      • Tour for DBAs

      • 2 Overview of Database Concepts

        • Databases

        • Jobs, Alerts, and Operators

        • 3 Overview of SQL Server

          • Programs Installed with SQL Server

          • Parts of a Database

          • SQL Server Storage Concepts

          • 4 Database Design and Normalization

            • What Is Normalization?

            • Tools for Normalization in SQL Server

            • PART II • TRANSACT-SQL

              • 5 Transact-SQL Overview and Basics

                • What Is Transact-SQL?

                • T-SQL Syntax and Conventions

                • 6 SELECT Queries

                  • Using Basic SELECT Queries

                  • Turning Result Sets into Reports

                  • 7 Action Queries

                    • What Are Action Queries?

                    • Using the System Tables and Information Schema Views

                    • PART III • DIGGING INTO SQL SERVER

                      • 9 Using SQL Server Enterprise Manager

                        • The Microsoft Management Console (MMC)

                        • The SQL Server Enterprise Manager Tree

                        • 13 Views

                          • Using Views to Partition Tables

                          • Using Views to Join Tables

                          • Modifying Data through a View

                          • Working with Indexed Views

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

Tài liệu liên quan