7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.

Slides:



Advertisements
Similar presentations
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Advertisements

Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Oracle Architecture. Instances and Databases (1/2)
ITEC474 Control File Maintenance
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
1 - Oracle Server Architecture Overview
Oracle Architectural Components
RMAN Restore and Recovery
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Harvard University Oracle Database Administration Session 11 Database Recovery.
ITEC474 Redo Log Files.
Database Backup & Recovery David Konopnicki. Introduction A major responsibility of the database administrator is to prepare for the possibility of hardware,
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
Oracle Architecture. Database instance When a database is started the current state of the database is given by the data files, a set of background (BG)
Oracle9i Database Administrator: Implementation and Administration
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Log File Waits  Redo is written to disk when  User commits  Log Buffer.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.
Using RMAN to Perform Recovery
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
1 Copyright © 2009, Oracle. All rights reserved. Exploring the Oracle Database Architecture.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Basic Oracle Architecture
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
4 Copyright © 2006, Oracle. All rights reserved. Recovering from Noncritical Losses.
7202ICT – Database Administration
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
CHAPTER 5 Managing Control Files and Online Redo Logs.
Chapter 8Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 8 Complete Recovery with Recovery Manager.
Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.
Database Administration 3.Using Administration Tools.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
8 Copyright © Oracle Corporation, All rights reserved. Configuring the Database Archiving Mode.
44 Creating a Database. 4-2 Objectives Preparing the operating system Preparing the parameter file Creating the database Preparing the operating system.
11 Copyright © 2006, Oracle. All rights reserved. Checkpoint and Redo Tuning.
Creating an Oracle Database. Considerations before creating a DB Planning for Database Creation –Select the standard database block size. –Use an undo.
Instance and Media Recovery Structures Supinfo Oracle Lab. 7.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Configuring the Database Archiving Mode
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Backup and Recovery Part 2. Online backup Online backup requirements: Backup all data files (file system copy) Backup all redo information produced during.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
16 Copyright © 2005, Oracle. All rights reserved. Performing Database Recovery.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
Transactional Recovery and Checkpoints. Difference How is this different from schedule recovery? It is the details to implementing schedule recovery –It.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
1 Copyright © 2006, Oracle. All rights reserved. Introduction.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
Copyright  Oracle Corporation, All rights reserved. 3 Oracle Backup and Recovery Configuration.
Control File Information The database name The timestamp of database creation The names and locations of associated datafiles and redo log files Tablespace.
Oracle Database Architectural Components
Transactional Recovery and Checkpoints
Maintaining Online Redo Log Files
Instance and Media Recovery Structures
Oracle9i Database Administrator: Implementation and Administration
Recovering from Noncritical Losses
Performing Database Recovery
Chapter 5 The Redo Log Files.
Presentation transcript:

7 Maintaining Redo Log Files

7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches and checkpoints Multiplexing and maintaining online redo log files Planning online redo log files Troubleshooting common redo log file problems Explaining the use of online redo log files Obtaining log and archive information Controlling log switches and checkpoints Multiplexing and maintaining online redo log files Planning online redo log files Troubleshooting common redo log file problems

7-3 Using Redo Log Files Redo log files Database Control files Data files Record all Record all changes made to the database Used only for Used only forrecovery

7-4 Introduction to Online Redo Log Files Components: Redo log group Online redo log file or member Archived redo log file ARCn

7-5 Introduction to Online Redo Log Files Components: Redo log buffer LGWR CKPT

7-6 Introduction to Online Redo Log Files File 1 is written to File A by the ARCn process after the log switch is complete

7-7 Introduction to Online Redo Log Files File 1 and File 3 are written to by the LGWR process simultaneously until both are full

7-8 Redo Log Groups and Members Group 2 Group 3 Group 1 Member Member Disk 1 Disk 2 Member Member Member Member Min. 2 groups Min. 1 and up to 5 members/group

7-9 Redo Log Groups and Members LGWR concurrently writes to all members of a group Log Sequence numbers are written to the group Log Sequence number is assigned to a group by Oracle each time: unique id Current log number is stored in control file LGWR concurrently writes to all members of a group Log Sequence numbers are written to the group Log Sequence number is assigned to a group by Oracle each time: unique id Current log number is stored in control file

7-10 Oracle Architecture Database Instance SGA CKPT LGWR DBWR Database buffer cache Control files Data files Redo log files Redo log buffer ARCH Parameter file Password file Archived log files

7-11 LGWR, Log Switches and Checkpoints LGWR writes from buffer to file when: A transaction commits Redo buffer is one-third full >1MB of changed records Timeout occurs (every 3 secs) Before DBWR writes buffer to data files LGWR writes from buffer to file when: A transaction commits Redo buffer is one-third full >1MB of changed records Timeout occurs (every 3 secs) Before DBWR writes buffer to data files

7-12 LGWR, Log Switches and Checkpoints Log switch: event when LGWR switches to a new group; Oracle then assigns a new sequence number DBA can force a switch Checkpoint: Dirty DB buffers written to data files Updates headers of data and control files Occurs when Every log switch Instance shuts down Manually by DBA Log switch: event when LGWR switches to a new group; Oracle then assigns a new sequence number DBA can force a switch Checkpoint: Dirty DB buffers written to data files Updates headers of data and control files Occurs when Every log switch Instance shuts down Manually by DBA

7-13 Without Archiving Backup Disk failure t1 t2 Data files Control files 5051

With Archiving Backup Disk failure Data files Control files Archived redo logs t1t2 99

7-15 To Archive Or Not? Oracle can be configured to operate in: ARCHIVELOG or NOARCHIVELOG mode Two ways to archive redo log files: Manually or Automatically LOG_ARCHIVE_START parameter indicates if manual or automatic Oracle can be configured to operate in: ARCHIVELOG or NOARCHIVELOG mode Two ways to archive redo log files: Manually or Automatically LOG_ARCHIVE_START parameter indicates if manual or automatic

7-16 Server Manager command: V$DATABASE: – NAME (select name, log_mode from v$databse) – LOG_MODE V$INSTANCE – ARCHIVER (select archiver from v$instance) Server Manager command: V$DATABASE: – NAME (select name, log_mode from v$databse) – LOG_MODE V$INSTANCE – ARCHIVER (select archiver from v$instance) Obtaining Information About Archiving SQL>ARCHIVE LOG LIST;

7-17 Obtaining Information About Groups V$THREAD: GROUPS CURRENT_GROUP# SEQUENCE# select groups, current_group#, sequence# from v$thread; V$THREAD: GROUPS CURRENT_GROUP# SEQUENCE# select groups, current_group#, sequence# from v$thread;

7-18 Obtaining Information About Groups and Members V$LOG: GROUP# MEMBERS STATUS SEQUENCE# BYTES select group#, sequence#, bytes, members, status from v$log;

7-19 Obtaining Information About Groups and Members V$LOGFILE: GROUP# STATUS MEMBER select * from v$logfile; STATUS for groups(G) and members (M): UNUSED(G): never been written to CURRENT(G): current group ACTIVE(G): active but not current; needed for recovery INACTIVE(G): no longer needed for recovery INVALID(M): file is inaccessible BLANK(M): file is in use

7-20 Force log switches with the command: Control checkpoints with the initialization parameters: – LOG_CHECKPOINT_INTERVAL – LOG_CHECKPOINT_TIMEOUT SQL> ALTER SYSTEM CHECKPOINT Force log switches with the command: Control checkpoints with the initialization parameters: – LOG_CHECKPOINT_INTERVAL – LOG_CHECKPOINT_TIMEOUT SQL> ALTER SYSTEM CHECKPOINT Log Switches and Checkpoints SQL> ALTER SYSTEM SWITCH LOGFILE;

7-21 log3a.rdo Adding Online Redo Log Groups Group 1 Group 2 Group 3 ALTER DATABASE ADD LOGFILE (‘/DISK3/log3a.rdo’, ‘/DISK4/log3b.rdo’) size 1M; ALTER DATABASE ADD LOGFILE (‘/DISK3/log3a.rdo’, ‘/DISK4/log3b.rdo’) size 1M; log3b.rdo log1a.rdo log1b.rdo log2b.rdo

7-22 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; 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

7-23 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. ALTER DATBASE RENAME FILE ‘fname’ TO ‘fname’ 5. Open the database. 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. ALTER DATBASE RENAME FILE ‘fname’ TO ‘fname’ 5. Open the database.

7-24 Dropping Online Redo Log Groups Group 1 Group 2 Group 3 ALTER DATABASE DROP LOGFILE GROUP 3; ALTER DATABASE DROP LOGFILE GROUP 3; log1a.rdo log2a.rdo log3b.rdo log3a.rdo log1b.rdo log2b.rdo

7-25 Dropping Online Redo Log Members Group 2 Group 1 ALTER DATABASE DROP LOGFILE MEMBER ‘/DISK4/log2b.dbf’; ALTER DATABASE DROP LOGFILE MEMBER ‘/DISK4/log2b.dbf’; log1a.rdo log2b.rdo log1b.rdo log2a.rdo

7-26 Clearing Online Redo Log Files ALTER DATABASE CLEAR LOGFILE ‘/DISK3/log2a.rdo’; ALTER DATABASE CLEAR LOGFILE ‘/DISK3/log2a.rdo’; If it gets corrupted. Example

7-27 Online Redo Log Configuration Group 1 Group 2 Group 3 Member Member Disk 3 Disk 2 Disk 1 Member Member Member

7-28 Possible LGWR Errors One member of a group of two or more is not available. All members of the next group are not available. All members of the current group are not available. One member of a group of two or more is not available. All members of the next group are not available. All members of the current group are not available.

7-29 OMF and Log Files You can create as many redo log groups as you need, bounded by MAXLOGFILES setting (when database was created). You can multiplex each of those groups with up to five additional OMF members (bounded by the MAXLOGMEMBERS). D Different redo log group members are created in different locations, as defined by parameters such as db_create_online_log_dest_n You can create as many redo log groups as you need, bounded by MAXLOGFILES setting (when database was created). You can multiplex each of those groups with up to five additional OMF members (bounded by the MAXLOGMEMBERS). D Different redo log group members are created in different locations, as defined by parameters such as db_create_online_log_dest_n

7-30 OMF and Log Files (cont.) Examples ALTER DATABASE ADD LOGFILE; or ALTER DATABASE ADD LOGFILE GROUP 3 SIZE 300M; - to add a log group ALTER DATABASE DROP LOGFILE GROUP 1; - to drop a log group (may not be current log group) Not possible to add an additional log group member that is an OMF Can drop an OMF redo log member:ALTER DATABASE DROP LOGFILE MEMBER.... Oracle will remove the dropped redo log member. Examples ALTER DATABASE ADD LOGFILE; or ALTER DATABASE ADD LOGFILE GROUP 3 SIZE 300M; - to add a log group ALTER DATABASE DROP LOGFILE GROUP 1; - to drop a log group (may not be current log group) Not possible to add an additional log group member that is an OMF Can drop an OMF redo log member:ALTER DATABASE DROP LOGFILE MEMBER.... Oracle will remove the dropped redo log member.

7-31 OMF and Log Files (cont.) Example Create Database Command: CREATE DATABASE mydb DATAFILE SIZE 500M LOGFILE GROUP 1 SIZE 10M, GROUP 2 SIZE 10M DEFAULT TEMPORARY TABLESPACE temp TEMPFILE SIZE 100M UNDO TABLESPACE undotbs1 DATAFILE SIZE 50M MAXLOGFILES = 5 MAXLOGMEMBERS = 5 MAXDATAFILES = 600 NOARCHIVELOG; Example Create Database Command: CREATE DATABASE mydb DATAFILE SIZE 500M LOGFILE GROUP 1 SIZE 10M, GROUP 2 SIZE 10M DEFAULT TEMPORARY TABLESPACE temp TEMPFILE SIZE 100M UNDO TABLESPACE undotbs1 DATAFILE SIZE 50M MAXLOGFILES = 5 MAXLOGMEMBERS = 5 MAXDATAFILES = 600 NOARCHIVELOG;

7-32 Summary Controlling log switches and checkpoints Administering online redo log files Controlling log switches and checkpoints Administering online redo log files