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

Oracle 8 Database Administration volume 2 instruction guide phần 5 potx

34 248 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 34
Dung lượng 229,64 KB

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

Nội dung

The log file contains: • Header information such as the date of the run and software version number • Global information including: • Table information such as: • Field and column inform

Trang 1

The log file is mandatory and the load terminates if the log file cannot be

created because of lack of space or permission The log file contains:

Header information such as the date of the run and software version

number

Global information including:

Table information such as:

• Field and column information

Data file information showing records rejected and records discarded

with reasons, only for data files with data errors

16-12 Copyright  Oracle Corporation, 1998 All rights reserved.

Log File Contents

• Data file information: records processed

• Table load information: errors and

discards

• Summary statistics

Trang 2

- Number of rows that qualified for loading but were rejected due to

data errors

• Summary Statistics that displays the following data:

- Load statistics for all data files

time used by background processes

Trang 3

Bad File

The bad file contains records that are rejected during processing due to one

of the following reasons:

fields

• Rows could not be inserted for reasons such as constraint violation

The records in the bad file are in the same format as the input records The

records can be used, after rectifying the errors, to reload the data

Discard File

The discard file contains data in the same format as the input data files and

are useful if data needs to be selectively loaded into tables either in different

databases or at different points in time

16-13 Copyright  Oracle Corporation, 1998 All rights reserved.

SQL*Loader: Other Output Files

• Bad file

– Rejected records

– Same format as data files

• Discard file

– Records not satisfying conditions

– Same format as data files

Trang 4

Use the following guidelines when using SQL*Loader to minimize errors

and improve performance:

For example, if loading into a data warehouse every week, all options

except the names of the files may be the same

• Separating the control file and the data file permits reusing control files

for several load sessions

allocation of extents during the load and improves the speed of the load

indexes for the new data These indexes are merged with the existing

indexes at the end of the load By sorting the input data on the keys in the

largest index, use of sort space can be minimized

segments used for inserting data For each load session, specify a

different database file to achieve maximum performance

Instructor Note

For the last bulleted point, you may remind participants that you can specify

only files belonging to the tablespace containing the table being loaded

16-14 Copyright  Oracle Corporation, 1998 All rights reserved.

SQL*Loader: Usage Guidelines

• Use a parameter file to specify

commonly used command line options

• Place data within the control file only for

a small, one-time load

• Improve performance by:

– Allocating sufficient space

– Sorting the data on the largest index

– For parallel loads, specify different

files for temporary segments

Trang 5

When a load terminates abnormally, all data that has been loaded up to the

point of failure is likely to have been committed After rectifying the

problem as discussed in the following paragraphs, proceed as follows to

complete the load:

• If loading to one table or if all tables have the same number of records

processed, use the SKIP command line parameter to continue the load

the same for all tables, use the CONTINUE_LOAD option in the control

file to specify the number records to skip for each table

consistent with the table Drop the indexes in this state and recreate them

after completing the load

16-15 Copyright  Oracle Corporation, 1998 All rights reserved.

SQL*Loader: Troubleshooting

• Insufficient space for table or index

• Instance failure during the load

• If the SORTED INDEXES clause is used

and data is not in the order specified

• Duplicate keys found in a unique index,

unique or primary key during a direct

load

• BINDSIZE for conventional load cannot

fit one row

• Errors or discards exceed specified limit

Trang 6

allocate sufficient space to the tables loaded to accommodate all the rows

inserted In this case, investigate the cause of the problem—whether it is

due to insufficient disk space, or the files becoming full, or

MAXEXTENTS being reached, and correct the problem

• Instance failure: Investigate the reason for failure, rectify it, restart the

instance and continue the load

• Data is not in the order specified: The data is loaded, but the index is in

an unusable state Drop and re-create the indexes that are unusable

This does not abort the load process, but may result in disabled

constraints or unusable indexes In the case of constraint errors, use an

exceptions table to trap the errors and rectify them If a unique index is

unusable, you may have to detect errors by attempting to create a unique

constraint on the indexed column, trapping the errors into an exception

table, and correcting them

• Errors or discards exceeding the limit set: This occurs when a load is

aborted because the number of invalid records on discards have

exceeded ERRORS or the DISCARDMAX specified The most common

cause of this problem is the use of incorrect input data files Check and

use the correct files

Note

The SORTED INDEXES clause is only applicable to direct path loads For

syntax and details of usage refer to the chapter “SQL*Loader Control File

Reference” in the manual Oracle8 Server Utilities.

Trang 7

Reorganizing Data Using Export and Import

Export and Import utilities enable the administrator to move data between

Oracle databases, and within an Oracle database, to different tablespaces or

users, or to reorganize data for efficient storage and performance

Export Utility

The Export utility can be used to make a logical copy of object definitions

and data to an operating system binary file Export can write to a file on disk

or tape The Export utility extracts a consistent view of data within each

table

Import Utility

The Import utility can read the operating system files created by the Export

utility and copy the object definitions and data into an Oracle database

Import utility cannot read text files or files created in any other format

Note

16-16 Copyright  Oracle Corporation, 1998 All rights reserved.

Moving Data Using EXP/IMP

Data files

O/S file

Export

Import

Trang 8

Export and Import can be used in the following cases:

reorganization:

another to minimize contention, reduce free-space fragmentation, or

to facilitate backup

when a username needs to be removed from the database or to

redistribute object ownership Data that was exported by one user can be

imported into a different user’s account

development to production by extracting only definitions and

disregarding data Export and Import can also be used to extract data

from an OLTP application into a data warehouse

16-17 Copyright  Oracle Corporation, 1998 All rights reserved.

Uses of Export and Import

– OLTP system to a data warehouse

• Migrate to a different platform or

Trang 9

• Migrate to a different platform or release of Oracle: Data that is exported

on one machine can be imported into a database on a different machine,

possibly using a different character set When upgrading to a new release

of Oracle, data can be exported from the older release and imported into

the new release Note that it may not be possible to use this method for

moving data from a later release to an earlier release

test database, an application may require several test runs before it is

fully debugged and accepted Test data can be exported to an external file

and imported before each run to ensure that tests are performed on the

same set of data This method is also useful to test a new version of

Oracle before a production database is upgraded

exported, and the export file can be used as a logical backup

In this lesson, use of Export and Import for data reorganization and moving

data between users is presented

Note

Use of Export and Import for backup and recovery is discussed in detail in

the course Oracle8: Backup and Recovery Workshop.

Trang 10

The Export utility provides three modes of export:

Table Mode

All users can use the table mode to export their own tables Privileged users

can export tables owned by any user The use of the table mode exports:

• Data in the table, if required

• All indexes on the table if the export is performed by a privileged user

(Otherwise, only those indexes on the table owned by the user are

exported.)

• All triggers on the table only if the utility is run by a privileged user

(Otherwise, only the triggers on the table owned by the user are

exported.)

16-18 Copyright  Oracle Corporation, 1998 All rights reserved.

by other users

• All objects in the database (except

objects owned by SYS)

Trang 11

User Mode

User mode export works differently depending on whether the user running

the export has special privileges

• A privileged user can export objects owned by any user In this case, the

objects exported are:

- All objects owned by the user, except indexes and triggers that are

owned by the user but are on tables owned by other users

- Triggers and indexes created by other users on the user’s tables

mode will not include any indexes or triggers that are created by other

users on the tables owned by this user

Full Database

All objects in the database, except those owned by the user SYS, are

exported when using this mode This mode requires special privileges and

cannot be used by all the users

Note

In all the three modes of export, privileged users are users with the

EXP_FULL_DATABASE role This role is discussed in the lesson

“Managing Roles.”

Trang 12

The slide shows the difference between conventional path and direct path

exports

Conventional Path

This term refers to the default method of formatting data from a database

and writing it out to an export file Conventional path export uses the SQL

SELECT statement to extract data from tables Data is read from disk into a

buffer cache, and rows are transferred to the evaluation buffer The data,

after passing expression evaluation, is transferred to the export client, which

then writes the data into the export file

Direct Path

Direct path export extracts data much faster than a conventional path export

In a direct path export, data is read from disk into the buffer cache and rows

are transferred directly to the export process The evaluating buffer is

bypassed—that is, data in the blocks is not reorganized to bring row pieces

together The data is already in the format that export expects, thus avoiding

unnecessary data conversion The data is transferred to the export process,

which then writes the data into the export file

Import utility is capable of using an export file created by any of the paths

The time taken to perform the import is not significantly affected by the

export path used

16-19 Copyright  Oracle Corporation, 1998 All rights reserved.

Conventional/Direct Path Export

SQL command processing

Buffer cache management

Read database block

Dump

Evaluating buffer

Private buffer

or buffer cache

Direct Conventional

Trang 13

Export can be invoked using:

The interactive mode is primarily provided for backward compatibility and

does not offer the full range of options that the command line provides So,

use of command line mode is recommended

UNIX: Command Line

Use the following command on a UNIX system to perform an export:

$exp [keyword=]{value|(value, value )}

[ [ [,] keyword=]{value|(value, value )} ]

where: keyword is one of the keywords discussed in the

next section

value is the value assigned to the keyword

16-20 Copyright  Oracle Corporation, 1998 All rights reserved.

Using Export

$exp scott/tiger tables=(dept,emp) \

> file=emp.dmp log=exp.log compress=n \

Trang 14

order Although this option is available, it is generally advisable to use

the keywords

• As shown in the example, it is possible to specify the first few values

without keywords and then specify other values with keywords

special characters, such as a parenthesis, so that the character is not

treated as a special character

Windows NT: Command Line

Use the following command on Windows NT to perform an export:

C:\>EXP80 [keyword=]{value|(value, value )}

5 Specify associated objects, such as indexes and rows, to be exported and

the path on the Associated Objects page

the Wizard

7 If remote machine and deferred processing were specified in step 3,

specify a schedule on the Scheduling page

9 If remote machine was chosen in step 3, specify a destination in the

dialog box

Trang 15

Command Line Parameters

Some of the commonly used parameters are shown below

USERID Oracle username and password (If password is not

specified, the user will be prompted for the password.)

rows fetched before they are written to the export file COMPRESS Y A value of Y specifies that on import the initial

extent size will be set to a value that is equal to the current size of the segment A value of N will cause the current extent sizes to be retained The choice has

to be made at export because the information gets written to the export file.

LOB segments are not compressed.

CONSISTENT N A value of Y specifies that the whole export

operation be performed in one read-only transaction Export will attempt to get a read consistent image of all the objects exported A value of N specifies that only table level consistency need to be maintained CONSTRAINTS Y A value of Y specifies that constraints are to be

exported with the table A value of N causes constraints not to be exported.

DIRECT N A value of Y specifies that direct path be used for the

export A value of N uses conventional path.

(suppress display)

This parameter is specified as an integer n to request for a dot (.) to be displayed when n rows are

exported.

FILE expdat.dmp Output file name

FULL N A value of Y specifies full database export.

GRANTS Y A value of Y specifies that all the grants on objects

exported must also be preserved on import.

HELP N A value of Y will display a list of the parameters and

their meaning This parameter is not combined with

Trang 16

TABLES=schema.table can be defined.

cannot be set to Y

reference, see the chapter “Export” in the manual Oracle8 Server

Utilities.

INDEXES Y A value of Y causes indexes to be exported.

(no log)

The name of the file to store all export messages

OWNER The names of the users for user level export

PARFILE Specifies the name of the file that contains a list of

export parameters RECORDLENGTH O/S specific The size of the output record

ROWS Y A value of Y specifies that data is to be exported STATISTICS ESTIMATE Specifies the analyze method to be used on import TABLES schema.table for table mode export

Trang 17

Import can be invoked using:

The interactive mode is primarily provided for backward compatibility and

does not offer the full range of options that the command line provides So,

use of command line mode is recommended

UNIX: Command Line

Use the following command on a UNIX system to perform an export:

$imp [keyword=]{value|(value, value )}

[ [ [,] keyword=]{value|(value, value )} ]

where: keyword is one of the keywords discussed in the

next section

value is the value assigned to the keyword

16-21 Copyright  Oracle Corporation, 1998 All rights reserved.

Using Import

Import

emp.dmp

$imp scott/tiger tables=(dept,emp) \

> file=emp.dmp log=imp.log ignore=y

imp.log

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