Tải bản đầy đủ (.pdf) (18 trang)

Instructor InputsSession 9..Session OverviewThis session includes the following topics: Linked pps

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.02 MB, 18 trang )

Instructor Inputs
Session 9

¤NIIT Instructor Inputs 9.3
This session includes the following topics:
 Linked servers
 Types of replication
 Monitoring and improving replication performance
 Resolving conflicts in merge replication
 Recovering from a failure in replication
 Using KILL statement
 Best practices
 Tips and Tricks
 FAQs
Slide 1
Installing Windows XP Professional Using Attended Installation
Slide 1 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Objectives
In this session, you will learn about:
Linked servers
Types of replication
Monitoring and improving replication performance
Resolving conflicts in merge replication
Recovering from a failure in replication
Using KILL statement
Best practices that can be considered while replicating
databases in SQL Server 2005
Tips and tricks that will help you use import and export utilities


in SQL Server 2005
FAQs related to replication concepts of SQL Server 2005
Session Overview
9.4 Instructor Inputs ¤NIIT
Slide 2
Installing Windows XP Professional Using Attended Installation
Slide 2 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Knowledge Byte
Linked server:
Is like an alias on a local SQL Server that points to an external
data source.
Offers the following advantages:
Remote server access.
The ability to issue distributed queries, updates, commands, and
tr ansactions on heter ogeneous data sourc es across the
enterprise.
The ability to address diverse data sources similarly.
Specifies the following objects:
An OLE DB provider
An OLE DB data source
Slide 3
Installing Windows XP Professional Using Attended Installation
Slide 3 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Knowledge Byte (Contd.)

SQL Server 2005 provides the following types of
replications:
Snapshot replication:
is used to replicate data that does not change frequently.
is also used when the subscribers require read-only data with a
high degree of latency time.
Transactional replication:
is used when the subscribers require the updated data with
minimal delay.
is generally implemented at the server-to-server level.
Merge replication:
is used when both the publishers as well as the subscribers can
change the data. In this case, changes are replicated to all the
subscribers and publishers until all the servers have the same
data.
¤NIIT Instructor Inputs 9.5
Slide 4
Installing Windows XP Professional Using Attended Installation
Slide 4 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Knowledge Byte (Contd.)
Replication Monitor:
Is a graphical tool that allows you to track the overall activity of
a replication.
Provides information on the status and performance of
publications and subscriptions.
Window has two panes, the left and the right pane.
The left pane shows the list of publishers and its associated

publications.
The right pane contains three tabs, All Subscriptions, Tracer
Tokens, and Warnings and Agents.
Slide 5
Installing Windows XP Professional Using Attended Installation
Slide 5 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Knowledge Byte (Contd.)
Replication conflict occurs in merge replication when copies
of an article that are part of a subscription are updated at
two subscriber locations or on a publisher and a subscriber.
The articles can be updated by any of the INSERT,
UPDATE, or DELETE DML statements. The detection of
replication conflict is done by the merge agent.
9.6 Instructor Inputs ¤NIIT
Slide 6
Installing Windows XP Professional Using Attended Installation
Slide 6 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Knowledge Byte (Contd.)
To recover from a failure in replication:
A best practice is to maintain back ups of the publisher and
subscriber data.
Take a full backup of the publisher database and maintain
regular backups at regular intervals after short periods.
Maintain backup of distribution database.

Set the minimum transaction retention period at the distributor.
This retention period should be greater than the transaction
log backup period at publisher.
Slide 7
Installing Windows XP Professional Using Attended Installation
Slide 7 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Knowledge Byte (Contd.)
The KILL statement is used to terminate a process on the
basis of the session ID.
The KILL statement can also be used to terminate a normal
connection, which internally terminates the transactions that
are associated with the specified session ID.
The syntax of using a KILL statement is:
KILL { session ID } [ WITH STATUSONLY ]
where,
session_ID is the session ID of the process to terminate.
session_ID is a unique integer that is assigned to each user
connection when the connection is made.
¤NIIT Instructor Inputs 9.7
Slide 8
Installing Windows XP Professional Using Attended Installation
Slide 8 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Best Practices
Program your application to use stand by server in case of

database failover.
Backup replication databases regularly.
The following databases should be backed up regularly:
Publication database
Distribution database
Subscription databases
msdb database and master database at the Publisher,
Distributor, and Subscribers server
Validate data periodically to verify the replication between
Subscriber and Publisher.
Slide 9
Installing Windows XP Professional Using Attended Installation
Slide 9 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Tips and Tricks
When the bcp utility is connecting to SQL Server with a
trusted connection using integrated security, use the -T
option (trusted connection) instead of the user name and
password combination.
While using bcp utility do not use a blank password, use a
strong password.
While using bcp utility, if the file name includes a space or
quotation mark at the command prompt, enclose the
identifier in quotation marks ("").
9.8 Instructor Inputs ¤NIIT
Slide 10
Installing Windows XP Professional Using Attended Installation
Slide 10 of 19

Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Do you need to stop an Activity on a database when it is
published?
No, Activity can continue on a database while a publication is
being created.
FAQs
Slide 11
Installing Windows XP Professional Using Attended Installation
Slide 11 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
When is a subscription available?
A subscription is available after a snapshot has been applied
to the subscription database.
FAQs (Contd.)
¤NIIT Instructor Inputs 9.9
Slide 12
Installing Windows XP Professional Using Attended Installation
Slide 12 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
What recovery model is required on a replicated database?
Replication functions properly using any of the recovery
models: simple, bulk-logged, or full.
FAQs (Contd.)
Slide 13

Installing Windows XP Professional Using Attended Installation
Slide 13 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Does replication encrypt data?
No, replication does not encrypt data that is stored in the
database or transferred over the network.
FAQs (Contd.)
9.10 Instructor Inputs ¤NIIT
Slide 14
Installing Windows XP Professional Using Attended Installation
Slide 14 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Does replication resume if a connection is dropped?
Yes, replication processing resumes at the point at which it left
off if a connection is dropped.
FAQs (Contd.)
Slide 15
Installing Windows XP Professional Using Attended Installation
Slide 15 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Challenge
Which of the following editions of SQL Server 2005 allows
database snapshots?
Standard edition

Enterprise edition
Express edition
Workgroup edition
Answer:
Enterprise edition
¤NIIT Instructor Inputs 9.11
Slide 16
Installing Windows XP Professional Using Attended Installation
Slide 16 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Challenge (Contd.)
You want to create a database snapshot. Which command
will you use with AS SNAPSHOT OF clause to create a
snapshot of a database?
CREATE SNAPSHOT
ALTER DATABASE
ALTER SNAPSHOT
CREATE DATABASE
Answer:
CREATE DATABASE
Slide 17
Installing Windows XP Professional Using Attended Installation
Slide 17 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Collaborate Session 9
Challenge (Contd.)
Which of the following task you cannot perform with respect

to database snapshots?
Create multiple snapshots of a database
Drop files from database snapshot
Create table through a snapshot
Create snapshot on the same server instance as the source
database
Answer:
Drop files from database snapshot
9.12 Instructor Inputs ¤NIIT
Slide 18
Installing Windows XP Professional Using Attended Installation
Slide 18 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Challenge (Contd.)
Which of the following command reverts back a database
from a snapshot?
RETRIEVE DATABASE <db1> FROM
DATABASE_SNAPSHOT=<Sn1>
RESTORE DATABASE FROM DATABASE_SNAPSHOT=<Sn1>
RESTORE DATABASE <db1> FROM
DATABASE_SNAPSHOT=<Sn1>
RETRIEVE DATABASE FROM
DATABASE_SNAPSHOT=<Sn1>
Answer:
RESTORE DATABASE <db1> FROM
DATABASE_SNAPSHOT=<Sn1>
Slide 19
Installing Windows XP Professional Using Attended Installation

Slide 19 of 19
Ver. 1.0
Querying, Managing, and Administering Databases Using SQL Server 2005
Colla borate Session 9
Challenge (Contd.)
Which of the following method is used to query against a
linked server?
openlink()
openquery()
createquery()
createlink()
Answer:
openquery()
¤NIIT Instructor Inputs 9.13
1. b. Enterprise edition
2. d. CREATE DATABASE
3. b. Drop files from a database snapshot.
4. c.
RESTORE DATABASE <db1> FROM DATABASE_SNAPSHOT=<Sn1>
5. b. openquery() method
Solutions to Challenge
9.14 Instructor Inputs ¤NIIT
1. Which of the following is the publisher in replication implementation by using SQL
Server 2005?
a. Database server that replicates the data and database objects
b. Database objects that are to be replicated
c. Database data that is replicated
d. Database server that takes the publication
2. Which of the following creates the snapshot of data in the primary server?
a. Replication job

b. Database server
c. Distributor
d. Replication agent
3. Which replication agent transfers the changes made to the publication from the
distributor to the subscribers?
a. Snapshot agent
b. Distributor agent
c. Log reader agent
d. Merge agent
4. Which replication job detects replication agents that are not actively logging history?
a. Agent history clean up
b. Distribution clean up
c. Expired subscription clean up
d. Replication agent checkup
5. Which type of replication is used to replicate data that does not change frequently?
a. Merge replication
b. Transaction replication
c. Snapshot replication
d. Distribution replication
6. Consider the following stages of a replication process:
a. Configuring a publisher and distributor
b. Identifying a publication
c. Initializing replication
Which stage is missing in the preceding list of stages of a replication process?
a. Creating and initializing the publisher
b. Creating and initializing subscriptions
c. Creating subscriptions
Home Assignment
¤NIIT Instructor Inputs 9.15
d. Initializing subscriptions

7. Which type of publication allows both the publisher and subscriber to update data
independently?
a. Transactional publication
b. Snapshot publication
c. Merge publication
d. Transactional publication with updatable subscriptions
8. What is the default value for the replication latency threshold?
a. 35 seconds
b. 32 seconds
c. 40 seconds
d. 30 seconds
9. Which statement is not true with regard to the BCP utility?
a. It is a command line utility.
b. It is used to copy the SQL Server data to or from an operating system data file.
c. It provides the BCP GET and BCP SET operations.
d. BCP parameters are case-sensitive.
10. Which of the following tool/command is not used to import and export data in SQL
Server 2005?
a. SSIS Tool
b. BCP Utility
c. OPENROWSET Function
d. Bulk Import Tool
Solutions
1. Database server that replicates the data and database objects
2. Replication agent
3. Distributor agent
4. Agent history clean up
5. Snapshot replication
6. Creating and initializing subscriptions
7. Merge publication

8. 30 seconds
9. It provides the BCP GET and BCP SET operations.
10. Bulk Import Tool
9.16 Instructor Inputs ¤NIIT
Replication refers to a set of technologies used for copying and distributing data and
database objects from one database to another and then synchronizing the databases to
maintain consistency.
Discuss the need for replicating data in an enterprise. In addition, discuss the different
replication types and their respective uses.
Instructor Inputs
You can conduct the discussion as follows:
 Encourage the students to discuss the need for replication in an enterprise.
 Ask the students to discuss the different replication types with the help of different
situations in which each replication type is useful.
Solution
Replicating data at physically different locations helps in quick access of data. In addition,
it reduces network traffic, as the users do not need to send the data to a distant server for
every transaction. Replication involves various components such as publisher, distributor,
and subscriber. Synchronization of data between these components depends on the type of
replication you select, such as snapshot replication, transactional replication, or merge
replication.
Snapshot Replication
Snapshot replication is used to replicate data that does not change frequently. It is also
used when the subscribers require read-only data with a high degree of latency time. For
example, the price list of a sales organization changes once or twice a year. In this case,
you can replicate the snapshot of the data after it has changed.
Transactional Replication
Transactional replication is used when the subscribers require the updated data with
minimal delay. Transactional replication is generally implemented at the server-to-server
level. Consider an example of a sales organization. The inventory data is maintained at

the corporate office. The regional offices of the organization also have their own servers
containing the same data. Whenever any change is made at the corporate server, the
changes will be replicated to the servers at the regional offices using transactional
replication.
Collaborative Exercise
¤NIIT Instructor Inputs 9.17
Merge Replication
Merge replication is used when both the publishers as well as the subscribers can change
the data. In this case, changes are replicated to all the subscribers and publishers until all
the servers have the same data. Consider an example of a book store, which has various
regional offices. Every office has its own database server. The transaction details at the
regional offices need to be synchronized. In such a case, merge replication can be
implemented.
9.18 Instructor Inputs ¤NIIT

×