Upload
d2145
View
222
Download
0
Embed Size (px)
Citation preview
8/8/2019 DBAI Redo Files
1/30
Maintaining Redo Log Files
8/8/2019 DBAI Redo Files
2/30
Objectives
After completing this lesson, you should be able todo the following:
Explain the purpose of online redo log files
Outline the structure of online redo log files
Control log switches and checkpoints
Multiplex and maintain online redo log files
Manage online redo logs files with OMF
8/8/2019 DBAI Redo Files
3/30
Using Redo Log Files
Redo log files record all changes made to data andprovide a recovery mechanism from a system ormedia failure.
Redo log files are organized into groups.
An Oracle database requiresat least two groups.
Each redo log within agroup is called a member. Redo
log files
Database
8/8/2019 DBAI Redo Files
4/30
Structure of Redo Log Files
Group 2 Group 3Group 1
Member
Disk 1
Disk 2Member
Member Member
MemberMember
8/8/2019 DBAI Redo Files
5/30
8/8/2019 DBAI Redo Files
6/30
How Redo Logs Work
Redo logs are used in a cyclic fashion.
When a redo log file is full, LGWR will move to thenext log group.
This is called a log switch
Checkpoint operation also occurs
Information is written to the control file
8/8/2019 DBAI Redo Files
7/30
8/8/2019 DBAI Redo Files
8/30
Forcing Log Switches and Checkpoints
Log switches can be forced using theALTERSYSTEM SWITCH LOGFILE command.
Checkpoints can be forced using:
Setting FAST_START_MTTR_TARGET parameter
ALTER SYSTEM CHECKPOINT command
ALTER SYSTEM CHECKPOINT;
8/8/2019 DBAI Redo Files
9/30
log2b.rdolog1b.rdo
Adding Online Redo Log Groups
Group 1 Group 2 Group 3
ALTER DATABASE ADD LOGFILE GROUP 3('$HOME/ORADATA/u01/log3a.rdo','$HOME/ORADATA/u02/log3b.rdo')
SIZE 1M;
log3b.rdo
log2a.rdo log3a.rdolog1a.rdo
8/8/2019 DBAI Redo Files
10/30
Adding Online Redo Log Members
ALTER DATABASE ADD LOGFILE MEMBER'$HOME/ORADATA/u04/log1c.rdo' TO GROUP 1,'$HOME/ORADATA/u04/log2c.rdo' TO GROUP 2,'$HOME/ORADATA/u04/log3c.rdo' TO GROUP 3;
log2c.rdo
log2a.rdo
Group 1
log1c.rdo
log1b.rdo
log1a.rdo
Group 2
log2c.rdo
log2b.rdo
log2a.rdo
Group 3
log3c.rdo
log3b.rdo
log3a.rdo
8/8/2019 DBAI Redo Files
11/30
8/8/2019 DBAI Redo Files
12/30
8/8/2019 DBAI Redo Files
13/30
log1a.rdo log1a.rdo
Dropping Online Redo
Log Members
ALTER DATABASE DROP LOGFILE MEMBER
'$HOME/ORADATA/u04/log
3c.rdo
';
log2c.rdolog1c.rdo
Group 1 Group 2
log1b.rdo log1b.rdo
8/8/2019 DBAI Redo Files
14/30
8/8/2019 DBAI Redo Files
15/30
Clearing, Relocating, or Renaming
Online Redo Log Files
Clearing online redo log files:
Relocating or renaming online redo log files canbe accomplished by adding new members anddropping old members.
ALTER DATABASE CLEAR LOGFILE'$HOME/ORADATA/u01/log2a.rdo';
8/8/2019 DBAI Redo Files
16/30
8/8/2019 DBAI Redo Files
17/30
Online Redo Log Configuration
Group 2 Group 3Group 1
Member
Member
Member Member
Member
Disk 3Disk 2Disk 1
??
8/8/2019 DBAI Redo Files
18/30
8/8/2019 DBAI Redo Files
19/30
Managing Online Redo Logs with OMF
A complete group can be added with no filespecification:
If a group is dropped, all the corresponding OMFfiles are deleted at the OS level:
ALTER DATABASE ADD LOGFILE;
ALTER DATABASE DROP LOGFILE GROUP 3;
8/8/2019 DBAI Redo Files
20/30
8/8/2019 DBAI Redo Files
21/30
8/8/2019 DBAI Redo Files
22/30
Archived Redo Log Files
Filled online redo log files can be archived.
Two advantages exist to archiving redo logs:
Recovery: A database backup, together with online
and archived redo log files can guarantee recoveryof all committed transactions.
Backup: Can be performed while the database isopen.
By default a database is created inNOARCHIVELOG
mode.
8/8/2019 DBAI Redo Files
23/30
8/8/2019 DBAI Redo Files
24/30
Archived Redo Log Files
Archiving redo log files is accomplished byARCn(Archiver) or manually through SQL statements.
An entry in the control file recording the archive
log name, log sequence number, and high and lowSCN number is made whenever a redo log issuccessfully archived.
A filled redo log file cannot be reused until acheckpoint has taken place and the redo log file
has been backed up the ARCn process. Archived redo log files can be multiplexed.
Archived redo log files must be maintained by theDBA.
8/8/2019 DBAI Redo Files
25/30
8/8/2019 DBAI Redo Files
26/30
Summary
In this lesson, you should have learned how to:
Explain the use of online redo log files
Obtain redo log information
Control log switches and checkpoints
Multiplex and maintain online redo log files
Manage online redo log files with OMF
8/8/2019 DBAI Redo Files
27/30
8/8/2019 DBAI Redo Files
28/30
Practice 7 Overview
This practice covers the following topics:
Creating and adding redo log file groups andmembers.
Dropping redo log file groups and members.
8/8/2019 DBAI Redo Files
29/30
8/8/2019 DBAI Redo Files
30/30