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

oracle 8 database administration volume 1 instruction guide phần 6 pps

40 312 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

Tiêu đề Oracle 8 Database Administration Volume 1 Instruction Guide Part 6 PPS
Trường học Oracle Corporation
Chuyên ngành Database Administration
Thể loại Instruction Guide
Năm xuất bản 1998
Định dạng
Số trang 40
Dung lượng 463,95 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 redo entries are written to one of the online redo log groups called the current online redo log group by the LGWR process under the following situations: • When a commit occurs • Wh

Trang 1

LGWR, Log Switches, and Checkpoints

LGWR, Log Switches, and Checkpoints

Redo Log Buffer and the Background Process LGWR

The Oracle Server sequentially records all changes made to the database in

the redo log buffer The redo log buffer is used in a circular manner The

redo entries are written to one of the online redo log groups called the

current online redo log group by the LGWR process under the following

situations:

• When a commit occurs

• When the redo log buffer pool becomes one-third full

• When an LGWR timeout occurs (every three seconds)

• Before the DBWR writes modified blocks in the database buffers cache

to the data files

Log Switches

LGWR writes to the online redo log files sequentially—that is, when the

current online redo log group is filled, LGWR begins writing to the next

group When the last available online redo log file is filled, LGWR returns to

7-5 Copyright  Oracle Corporation, 1998 All rights reserved.

Oracle Architecture

Database

Instance SGA

DBWR

Database buffer cache

Control files

files

Redo log buffer

ARCH

Archived log files

Parameter file Password file

Trang 2

A log switch is the event during which LGWR stops writing to one online

redo log group and starts writing to another

The database administrator can also force log switches (see subsequent

sections) Each time a log switch occurs and LGWR begins writing to a new

log group, the Oracle server assigns a number known as the log sequence

number to identify the set of redo entries

When a log switch occurs, an event called a checkpoint is initiated

Checkpoints

During a checkpoint:

• All dirty database buffers covered by the log being checkpointed are

written to the data files by DBWR

• The checkpoint background process CKPT updates the headers of all

data files and control files to reflect that it has successfully completed

Checkpoints can occur for all data files in the database or for only specific

data files

A checkpoint occurs, for example, in the following situations:

• At every log switch

• When an instance has been shut down with the normal, transactional, or

immediate option

• When forced by setting the initialization parameters,

LOG_CHECKPOINT_INTERVAL and

LOG_CHECKPOINT_TIMEOUT (see subsequent sections)

• When manually requested by the database administrator (see subsequent

sections)

Information about each checkpoint is recorded in the ALERT file if the

initialization parameter LOG_CHECKPOINTS_TO_ALERT is set to

TRUE The default value of FALSE for this parameter does not log

checkpoints

Instructor Note

Mention that there are additional situations in which checkpoints occur; for

example when taking a tablespace offline or making it read only

Trang 3

Archiving Redo Log Files

Archiving Redo Log Files

7-6 Copyright  Oracle Corporation, 1998 All rights reserved.

files

100 101

Archived redo logs

99

Trang 4

Archiving Redo Log Files

One of the important decisions that a database administrator has to make is

whether the database is configured to operate in ARCHIVELOG or in

NOARCHIVELOG mode

NOARCHIVELOG Mode

In NOARCHIVELOG mode, the online redo log files are overwritten each

time an online redo log file is filled, and log switches occur LGWR will not

overwrite a redo log group until the checkpoint for that group is completed

ARCHIVELOG Mode

If the database is configured to run in ARCHIVELOG mode, inactive groups

of filled online redo log files must be archived Since all changes made to the

database are recorded in the online redo log files, the database administrator

can use the physical backup and the archived online redo log files to recover

the database without losing any committed data due to any kind of failure

There are two ways in which online redo log files can be archived:

• Manually

• Automatically

The initialization parameter LOG_ARCHIVE_START indicates whether

archiving should be automatic or manual when the instance starts up

TRUE indicates that archiving is automatic ARCH will initiate

archiving of the filled log group at every log switch

• FALSE, the default value, indicates that the database administrator will

archive filled redo log files manually A Server Manager command must

be executed each time you want to archive an online redo log file All or

specific online redo log files can be archived manually

Note

This is covered in more detail in the course Oracle8: Backup and Recovery

Workshop.

Instructor Note

Point out that ARCHIVELOG mode is a database setting, whereas

automatic archiving is a characteristic of the instance

Trang 5

Obtaining Log and Archive Information

Obtaining Log and Archive Information

The following Server Manager command shows the database log mode and

if the automatic archival is enabled

SVRMGR> ARCHIVE LOG LIST

7-8 Copyright  Oracle Corporation, 1998 All rights reserved.

• Server Manager command:

ARCHIVE LOG LIST;

Trang 6

Query the dynamic performance views V$DATABASE and V$INSTANCE

to show the database log mode and the archiving mode

SVRMGR> SELECT name, log_mode

Trang 7

Obtaining Log and Archive Information

To see the number of online redo log groups, the current log group, and the

sequence number, query the dynamic performance view V$THREAD This

is of particular interest for Parallel Server administrators

SVRMGR>SELECT groups, current_group#,sequence#

Trang 8

The following query returns information about the online redo log file from

the control file:

The following items are the most common values for the STATUS column:

• UNUSED indicates that the online redo log group has never been

written This is the state of an online redo log file that was just added

• CURRENT indicates the current online redo log group This implies that

the online redo log group is active

7-10 Copyright  Oracle Corporation, 1998 All rights reserved.

Obtaining Information About

Groups and Members

Trang 9

Obtaining Log and Archive Information

• ACTIVE indicates that the online redo log group is active but is not the

current online redo log group It is needed for crash recovery It may or

may not be archived

• INACTIVE indicates that the online redo log group is no longer needed

for instance recovery It may or may not be archived

Trang 10

To obtain the names of all the members of a group, query the dynamic

performance view V$LOGFILE in which the value of the STATUS column

could be:

• INVALID indicates that the file is inaccessible

• STALE indicates that contents of the file are incomplete; for example,

adding a log file member

• DELETED indicates that the file is no longer used

• NULL indicates that the file is in use

7-11 Copyright  Oracle Corporation, 1998 All rights reserved.

Obtaining Information About

Groups and Members

V$LOGFILE:

• GROUP#

• STATUS

• MEMBER

Trang 11

Controlling Log Switches and Checkpoints

Controlling Log Switches and Checkpoints

Log switches and the checkpoints are events that happen automatically, for

example, when the current online log file group is filled But log switches

can be forced

Forcing Log Switches

You can force a log switch using the following SQL command:

SVRMGR>ALTER SYSTEM SWITCH LOGFILE;

OEM

1 Use Backup Manager

2 Choose Subsystem

3 Select Logfile—>Switch Logfile

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

• Force log switches with the command:

• Control checkpoints with the

initialization parameters:

Log Switches and Checkpoints

ALTER SYSTEM SWITCH LOGFILE;

Trang 12

Forcing Checkpoints

The database administrator can manually force a checkpoint by using:

ALTER SYSTEM CHECKPOINT;

OEM

1 Use Oracle Backup Manager

2 Choose Subsystem

3 Select Logfile—>Force Checkpoint

Setting Database Checkpoint Intervals

When the database uses large online redo log files you can set additional

database checkpoints by setting the initialization parameters:

• LOG_CHECKPOINT_INTERVAL

• LOG_CHECKPOINT_TIMEOUT

LOG_CHECKPOINT_INTERVAL

A checkpoint is initiated as soon as the LGWR writes the number of blocks

specified by the parameter LOG_CHECKPOINT_INTERVAL

The value of LOG_CHECKPOINT_INTERVAL is specified in operating

system blocks and not Oracle database blocks

Regardless of this value, a checkpoint always occurs when switching from

one online redo log file to another

If the value exceeds the actual online redo log file size, checkpoints occur

only when switching logs

Note that specifying a value of 0 for the interval might cause checkpoints to

be initiated very frequently since a new request will be started even if a

single redo log buffer has been written since the last request was initiated

LOG_CHECKPOINT_TIMEOUT

The value of this initialization parameter specifies the maximum amount of

time before another checkpoint occurs The value is specified in seconds

The time begins at the start of the previous checkpoint, and then a

checkpoint occurs after the amount of time specified by this parameter

Specifying a value of 0 for the timeout disables time-based checkpoints

Trang 13

Multiplexing and Maintaining Members and Groups

Multiplexing and Maintaining Members and Groups

In some cases you might need to create additional log file groups For

example, adding groups can solve availability problems To create a new

group of online redo log files, use the following SQL command:

ALTER DATABASE [database]

ADD LOGFILE [GROUP integer] filespec

You specifiy the name and location of the members with the file

specification The value of the GROUP parameter can be chosen for each

redo log file group If you omit this parameter, the Oracle server generates

its value automatically

OEM

1 Use Backup Manager

2 Choose Subsystem

3 Select Logfile—>Add Logfile Group

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

log3a.rdoAdding Online Redo Log Groups

ALTER DATABASE ADD LOGFILE

(‘/DISK3/log3a.rdo’,

‘/DISK4/log3b.rdo’) size 1M;

log3b.rdo log1a.rdo

log1b.rdo log2b.rdo

Trang 14

You can add new members to existing redo log file groups using the

following ALTER DATABASE ADD LOGFILE MEMBER command:

ALTER DATABASE [database]

ADD LOGFILE MEMBER

[, 'filename' [REUSE]]

TO {GROUP integer

|('filename'[, 'filename'] ) }

]

Use the fully-specified name of the log file members, otherwise the files will

be created in a default directory of the database server

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

Adding Online Redo Log Members

Group 2 Group 1

ALTER DATABASE ADD LOGFILE MEMBER

‘/DISK4/log1b.rdo’ TO GROUP 1,

‘/DISK4/log2b.rdo’ TO GROUP 2;

log2b.rdo log2a.rdo

log1b.rdo log1a.rdo

Trang 15

Multiplexing and Maintaining Members and Groups

If the file already exists, it must have the same size and you must specify the

REUSE option You can identify the target group either by specifying one or

more members of the group or by specifying the group number

Trang 16

Relocating Online Redo Log Files

The locations of the online redo log files can be changed by renaming the

online redo log files Before renaming the online redo log files, ensure that

the new online redo log file exists The Oracle server changes only the

pointers in the control files, but does not physically rename or create any

operating system files

The following ALTER DATABASE RENAME FILE command changes the

name of the online redo log file:

ALTER DATABASE [database]

RENAME FILE 'filename'[, 'filename']

TO 'filename'[, 'filename']

OEM

1 Use Backup Manager

2 Choose Subsystem

3 Expand the Logfile Group node

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

How to Relocate Online Redo Log Files

1 Shut down the database.

2 Copy the online redo log files to the

new location.

3 Mount the database.

4 Execute the ALTER DATABASE

RENAME FILE command.

5 Open the database.

Trang 17

Dropping Online Redo Log Groups and Members

Dropping Online Redo Log Groups and Members

To increase or decrease the size of online redo log groups, add new online

redo log groups (with the new size) and then drop the old one

An entire online redo log group can be dropped with the following ALTER

DATABASE DROP LOGFILE command:

ALTER DATABASE [database]

DROP LOGFILE

{GROUP integer|('filename'[, 'filename'] )}

[,{GROUP integer|('filename'[, 'filename'] )}]

OEM

1 Use Backup Manager

2 Choose Subsystem

3 Expand the Logfile Group node

4 Select the log file group

5 Select Logfile—>Drop Logfile Group

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

Dropping Online Redo

Log Groups

ALTER DATABASE DROP LOGFILE

GROUP 3;

log1a.rdo log2a.rdo

log3b.rdo log3a.rdo log1b.rdo log2b.rdo

Trang 18

• An instance requires at least two groups of online redo log files

• An active group cannot be dropped

• If the database is running in ARCHIVELOG mode and the log file group

is not archived, then the group cannot be dropped

• When an online redo log group is dropped, the operating system files are

not deleted

Trang 19

Dropping Online Redo Log Groups and Members

You may want to drop an online redo log member, because it is INVALID

Use the following ALTER DATABASE DROP LOGFILE MEMBER

command, if you want to drop one or more specific online redo log

members:

ALTER DATABASE [database]

DROP LOGFILE MEMBER 'filename'[, 'filename']

OEM

1 Use Backup Manager

2 Choose Subsystem

3 Expand the Logfile Member node

4 Select the log file member

5 Select Logfile—>Drop Logfile Member

6 Click OK

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

Dropping Online Redo

Log Members

Group 2 Group 1

ALTER DATABASE DROP LOGFILE MEMBER

‘/DISK4/log2b.dbf’;

log1a.rdo

log2b.rdo log1b.rdo log2a.rdo

Trang 20

• If the member you want to drop is the last valid member of the group,

you cannot drop that member

• If the group is active, you must force a log file switch before you can

drop the member

• If the database is running in ARCHIVELOG mode and the log file group

to which the member belongs is not archived, then the member cannot be

dropped

• When an online redo log member is dropped, the operating system file is

not deleted

Trang 21

Clearing Online Redo Log Files

Clearing Online Redo Log Files

If a redo log file is corrupted in all members, the database administrator can

solve this problem by reinitializing these log files

The SQL command ALTER DATABASE CLEAR LOGFILE reinitializes

online redo log files:

ALTER DATABASE [database]

CLEAR [UNARCHIVED] LOGFILE

{GROUP integer|('filename'[, 'filename'] )}

[,{GROUP integer|('filename'[, 'filename'] )}]

Using this command is equivalent to adding and dropping an online redo log

file But you can issue this command even if there are only two log groups

with one file each and even if the cleared group is available but not archived

Restrictions

You can clear an online redo log file whether it is archived or not However,

when it is not archived, you must include the keyword UNARCHIVED This

will make backups unusable if the online redo log file is needed for recovery

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

Clearing Online Redo Log Files

ALTER DATABASE CLEAR LOGFILE

‘/DISK3/log2a.rdo’;

Example

Trang 22

Planning Online Redo Logs

Number of Online Redo Log Files

To determine the appropriate number of online redo log files for a database

instance you have to test different configurations

In some cases, a database instance may require only two groups In other

situations, a database instance may require additional groups to guarantee

that the groups are always available to LGWR For example, if messages in

the LGWR trace file or in the ALERT file indicate that LGWR frequently

has to wait for a group because a checkpoint has not completed, or a group

has not been archived, you need to add groups

Although the Oracle server allows multiplexed groups to contain different

numbers of members, try to build up a symmetric configuration An

asymmetric configuration should only be the temporary result of an unusual

situation such as a disk failure

Instructor Note

Ask the students to identify problems with the configuration shown in the

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

Online Redo Log Configuration

Member

Member

Disk 3 Disk 2

Disk 1

Member

Member Member

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

TỪ KHÓA LIÊN QUAN