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

Hướng dẫn học Microsoft SQL Server 2008 part 109 pptx

10 202 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 727,18 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Select the databases you want to copy or moveOn page 5 Configure Destination Database, shown in Figure 44-5, the wizard asks you to configure the destination database.. On page 6 Select

Trang 1

FIGURE 44-2

Select the destination server

FIGURE 44-3

Select your preferred choice of transfer

Trang 2

Select the databases you want to copy or move

On page 5 (Configure Destination Database), shown in Figure 44-5, the wizard asks you to configure

the destination database You modify the destination database name and the default locations for the

database files on the destination server You also specify how the Copy Database Wizard should react

when a database with the requested name already exists on the destination The options are either

stopping the transfer or dropping the existing database and creating a new database with the same

name The wizard will move all the objects and data

On page 6 (Select Server Objects), shown in Figure 44-6, you can optionally direct the wizard to move

the following:

■ All logins or only those that have access to the database

■ All or selected non-system stored procedures in themasterdatabase that are used by the

database

■ All or selected SQL Agent jobs (automated and optionally scheduled tasks)

■ All or selected endpoints

■ All or selected SSIS packages

■ All or selected user-defined error messages (used by theRAISERRORT-SQL command)

Click the ellipses button next to each selected option and choose individual objects you want to

trans-fer If you do not choose individual objects, all the objects of each selection option are transferred by

default

1043

www.getcoolebook.com

Trang 3

FIGURE 44-5

Configure the destination database

FIGURE 44-6

The Copy Database Wizard can move server-related information as it moves the database

Trang 4

containing the source database files.

FIGURE 44-7

Select the location of the source database files

Page 8 (Configure the Package), shown in Figure 44-8, shows the package location You can also

provide a name for the package and choose a method for logging errors The default method uses the

Windows event log It’s also possible to send a list of errors to a text file The wizard will request a

filename when you choose this option

Page 9 (Schedule the Package), shown in Figure 44-9, directs the wizard to either run the Integration

Services package once upon completion of the wizard, run it once later, or set it up on a regular

schedule

Page 10 (Complete the Wizard), shown in Figure 44-10, shows a summary of the choices you made so

far If you want to change something, you can click Back If you are satisfied with all the choices, click

Finish

When finished, the wizard generates and runs an Integration Services package (see Figure 44-11) and

saves it on the destination server

You can open the generated Integration Services job, as shown in Figure 44-12, by selecting the Jobs

node under SQL Server Agent (of the destination SQL Server) in the console tree and then

double-clicking on the package If the name was not edited in the wizard’s schedule page, then it should be

CDW followed by the two server names and an integer The creation date is also listed

1045

www.getcoolebook.com

Trang 5

FIGURE 44-8

The Copy Database Wizard showing the Integration Services Package location

FIGURE 44-9

The Copy Database Wizard can run the Integration Services package once now, once later, or on a

schedule

Trang 6

Copy Database Wizard summary page

FIGURE 44-11

When the Copy Database Wizard creates the Integration Services package, it displays its progress as

it works its way through the steps

1047

www.getcoolebook.com

Trang 7

FIGURE 44-12

Job properties for the Integration Services package created by the Copy Database Wizard

Working with SQL Script

Of the four methods for moving a database, running a SQL Script, or batch, is the only method that

creates a new database Perhaps it’s false logic, but the idea of starting with a fresh installation at a client

site, without any residue from test data, is a reassuring thought

Scripts are smaller than databases They often fit on a floppy, and they can be edited with Notepad For

example, the sample databases for this book are distributed by means of scripts

Scripts are useful for distributing the following:

■ Database schema (databases, tables, views, stored procedures, functions, and so on)

■ Security roles

■ Database jobs

■ Limited sample data or priming data Though it’s possible, I don’t recommend creating a script to move the following:

■ Data: A script can insert rows, but this is a difficult method of moving data

■ Server logins: A script can easily create server logins, but server logins tend to be domain specific, so this option is useful only within a single domain

Trang 8

be useful to copy jobs, they will likely require editing prior to execution.

Scripts may also be used to implement a change to a database The easiest way to modify a client

database is to write a script The change script can be tested on a backup of the database

Scripts may be generated in several ways:

■ The database can be developed initially in Management Studio using a handwritten DDL script

Chapter 20, ‘‘Implementing the Physical Database Schema,’’ explains how to create such a

script In addition, the sample databases on the website are all created using a DDL script

This is my preferred method

The code for this chapter may be downloaded from the book’s website at

www.sqlserverbible.com

■ Management Studio can generate a script to create the entire database or a change script for

schema changes made with the Table Designer or the Database Designer

■ Most third-party database-design tools generate scripts to create the database or apply changes

With a focus on generating scripts with Management Studio, open the Management Studio script

genera-tor; select the database in the console tree, right-click, and select Tasks➪ Generate Scripts

Skip the Welcome to the Generate SQL Server Scripts page In Management Studio’s Script Wizard, use

the Select Database page, shown in Figure 44-13, to select the database that you want to script If you

want to script all objects, then check ‘‘Script all objects in the selected database.’’

The Choose Script Options page, shown in Figure 44-14, contains two sets of options The General

options determine script behavior, such as whether Management Studio appends the new script to an

existing script file The Table/View options determine script features, such as whether the script contains

code to create foreign keys

The Choose Object Types page, shown in Figure 44-15, contains a list of objects within the selected

databases At a minimum, you’ll see an option to script tables Note that you will not see this page if

you previously checked ‘‘Script all objects in the selected database’’ in the Select Databases page

The pages that follow vary depending on the objects you select For example, if you choose to script

tables, then you’ll see a Choose Tables page in which you select the tables you want to script

Eventually, you’ll reach the Output Option page, shown in Figure 44-16 Use the options on this page

to select an output method If you choose the Script to File option, then you’ll also need to choose the

output filename and output format

The next page (Script Wizard Summary) shows a summary of the choices that were made so far If you

want to change something, you can click Back If you are satisfied with all the choices, click Finish

1049

www.getcoolebook.com

Trang 9

FIGURE 44-13

Management Studio can generate scripts for any of the databases within the DBMS

FIGURE 44-14

Set the script options to match the database features you require and to define the behavior you expect

from Management Studio

Trang 10

Select the object types

FIGURE 44-16

Choose an output option that matches the kind of database transfer you want to perform

1051

www.getcoolebook.com

Ngày đăng: 04/07/2014, 09:20

TỪ KHÓA LIÊN QUAN