Week 3 Lecture 1 The Redo Log Files and Diagnostic Files.

Slides:



Advertisements
Similar presentations
Chapter 14 Handling Online Redo Log Failures. Background RMAN doesn’t back up online redo logs You don’t use RMAN to recover from online redo log failures.
Advertisements

Overview of Database Administrator (DBA) Tools
Oracle Architecture. Instances and Databases (1/2)
ITEC474 Control File Maintenance
Recovery CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Backup and recovery Basics of Backup and restoration Types of recovery Defining strategy Starting up and shutting down 80/20 rule SLA’s.
Managing an Oracle Instance
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
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
7 Maintaining Redo Log Files. 7-2 Objectives Explaining the use of online redo log files Obtaining log and archive information Controlling log switches.
Redo Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Redo REDO Lib Cache Buffer Cache Locks Network I/O.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
20 Copyright © 2004, Oracle. All rights reserved. Database Recovery.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
PPOUG, 05-OCT-01 Agenda RMAN Architecture Why Use RMAN? Implementation Decisions RMAN Oracle9i New Features.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
16 Copyright © 2007, Oracle. All rights reserved. Performing Database Recovery.
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.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
7202ICT – Database Administration
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.
By Lecturer / Aisha Dawood 1.  Dedicated and Shared Server Processes  Configuring Oracle Database for Shared Server  Oracle Database Background Processes.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
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.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives  Learn the steps for creating a database  Understand the prerequisites for creating.
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.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Backup and Recovery Concepts.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
16 Copyright © 2005, Oracle. All rights reserved. Performing Database Recovery.
18 Copyright © 2004, Oracle. All rights reserved. Recovery Concepts.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
9 Copyright © 2004, Oracle. All rights reserved. Incomplete Recovery.
14 Copyright © 2007, Oracle. All rights reserved. Backup and Recovery Concepts.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
3 Copyright © Oracle Corporation, All rights reserved. 管理数据库事例.
Maintaining Online Redo Log Files
Instance and Media Recovery Structures
Oracle 10g Database Administrator: Implementation and Administration
Oracle9i Database Administrator: Implementation and Administration
Recovering from Noncritical Losses
Performing User-Managed Backup and Recovery
Performing Database Recovery
Chapter 5 The Redo Log Files.
Presentation transcript:

Week 3 Lecture 1 The Redo Log Files and Diagnostic Files

Learning Objectives  Learn to describe redo log files, groups, and members  Manage redo log groups and members  Learn to describe and configure diagnostic files

Introduction to Online Redo Log Files Online redo log files store details as the database is used including: Checkpoints Data Changes (DML) Structural changes (DDL) Data file changes

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

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

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

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

The Purpose of Redo Log Files Redo log files aid in recovery from short term data loss such as brief power outage: Store changes that may not be written to the data files yet Store checkpoints to allow recovery to resynchronize data files with correct changes Cannot completely handle recovery from major loss such as an entire data file

The Purpose of Redo Log Files Recovery procedures (overview): Prior to failure: Perform full database backup regularly Run database in ARCHIVELOG mode After failure: Restore from full backup Apply archived redo log files (oldest to newest) Apply online redo log file

The Structure of Redo Log Files Redo log buffer is flushed to the redo log file when: A transaction COMMITS The redo log buffer becomes 1/3 full The redo log buffer contains >1 M of updated records A checkpoint occurs

The Structure of Redo Log Files Redo log file components: Redo record (also called redo entry) Relates to one data block Made up of one or more change vectors

Managing Redo Log Files The COMMIT command tells the database to log the changes to the redo log file

Log Switches and Checkpoints To manually signal a log switch: ALTER SYSTEM SWITCH LOGFILE; A log switch triggers a checkpoint Checkpoint is a signal to write all dirty buffers to the appropriate files Checkpoint increments the SCN

Log Switches and Checkpoints How the SCN is used: SCN is recorded in the redo log buffer SCN is recorded in the header of each data file that was written to During recovery, SCN of each datafile is compared to the SCN in the redo log file If a match, the data file is up to date If redo log file has higher SCN, changes are reapplied to the data file from the redo log file

Multiplexing and Other Maintenance Multiplexed redo log files requires multiple members in each group A log group continues to function as long as it has at least one good member If all members of the current group become damaged, the database forces a log switch The database shuts down immediately if a log switch fails

Adding a Member to a Group Add members to groups while the database is running Do not specify SIZE because new members are automatically assigned the same size as other members in the group Command syntax: ALTER DATABASE ADD LOGFILE MEMBER ' \ ' TO GROUP ;

Adding a New Group Add a new group while the database is running Specify SIZE and group number List all members to be created with the group (must be at least one) Command syntax: ALTER DATABASE ADD LOGFILE GROUP ( ' \ ', ' \ ') SIZE ;

Renaming or Moving a Redo Log File Must be done while the group is not ACTIVE Steps: 1. Shut down the database: SHUTDOWN IMMEDIATE 2. Rename or relocate files using the operating system 3. Mount the database STARTUP MOUNT

Renaming or Moving a Redo Log File Steps (continued): 4. Inform database of changed file name: ALTER DATABASE RENAME FILE ' \ ', ' \ ' TO ' \ ', ' \ '; 5. Open the database: ALTER DATABASE OPEN;

Dropping Redo Log Members or Groups Reasons for dropping members or groups: Bad disk, so must recreate member Tuning recommendation calls for reducing members or groups Corrupted members can be deleted and replaced later

Dropping Redo Log Members or Groups Rules when dropping redo log members: Each group must have at least one member The group affected must not be ACTIVE and (if in ARCHIVELOG mode) must be archived Rule when dropping groups: Database requires at least two groups The group affected must not be ACTIVE and (if in ARCHIVELOG mode) must be archived

Dropping Redo Log Members or Groups Steps to drop redo log member: 1. Query V$LOG to confirm that group is inactive 2. Drop redo log member: ALTER DATABASE DROP LOGFILE MEMBER ' \ '; 3. Delete associated file in the operating system

Dropping Redo Log Members or Groups Steps to drop redo log group: 1. Query V$LOG to confirm that group is inactive 2. Drop redo log group: ALTER DATABASE DROP LOGFILE GROUP ; 3. Delete associated file(s) in the operating system

Dropping Redo Log Members or Groups Additional notes: If group is ACTIVE, force log switch: ALTER SYSTEM SWITCH LOGFILE; If group still active, force checkpoint: ALTER SYSTEM CHECKPOINT; An alternative to dropping a corrupt group and recreating the members: ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP ;

Archiving a Redo Log Group Advantages of archiving redo log groups: Point-in-time recovery to a point earlier than online redo log files contain The ability to query archived log files with LogMiner The ability to set up and maintain a standby database

Archiving a Redo Log Group Ways to start archiving: 1. When creating a new database: Set initialization parameter: LOG_ARCHIVE_DEST_1= Add ARCHIVELOG to the command: CREATE DATABASE TEST03 …. ARCHIVELOG;

Archiving a Redo Log Group 2. Prior to opening the database: Set initialization parameters: LOG_ARCHIVE_DEST_1= LOG_ARCHIVE_START=TRUE Mount database: STARTUP MOUNT Alter database to begin archiving: ALTER DATABASE ARCHIVELOG; Open the database: ALTER DATABASE OPEN;

Archiving a Redo Log Group 3. On command while database is running: Set initialization parameters: LOG_ARCHIVE_DEST_1= Mount database: STARTUP MOUNT Alter database to prepare for archiving: ALTER DATABASE ARCHIVELOG; Open the database: ALTER DATABASE OPEN; Begin archiving (archiving ends when database shuts down or when you reset the parameter): ALTER SYSTEM SET LOG_ARCHIVE_START=TRUE

Archiving a Redo Log Group The most important initialization parameters for archiving

Archiving a Redo Log Group Additional initialization parameters for archiving

Archiving a Redo Log Group Additional initialization parameters for archiving

Using OMF to Manage Online Redo Log Files To create database with OMF log files: Set initialization parameters: DB_CREATE_ONLINE_LOG_DEST_1 = ' ' DB_CREATE_ONLINE_LOG_DEST_2 = ' ' Omit LOGFILE clause in CREATE DATABASE: CREATE DATABASE NEWDB92 … ; Or, include only the SIZE clause in the LOGFILE clause: CREATE DATABASE NEWDB92 … LOGFILE SIZE 20M;

Using OMF to Manage Online Redo Log Files To add an OMF log group: Set initialization parameters: DB_CREATE_ONLINE_LOG_DEST_1 = ' ' DB_CREATE_ONLINE_LOG_DEST_2 = ' ' Use this command to create the new group: ALTER DATABASE ADD LOGFILE GROUP;

Finding Redo Log Information in Data Dictionary Views States of a redo log group: UNUSED CURRENT ACTIVE CLEARING CLEARING_CURRENT INACTIVE

Viewing Control File Data

Overview of Diagnostic Files The three main types of diagnostic files: Alert log file: internal errors, deadlocks, time stamp of start up and shut down Background trace file: files generated by background processes when they have an error User trace file: files generated by user processes when they have an error

Overview of Diagnostic Files Initialization parameters that affect the diagnostic files: Location and size of the files: BACKGROUND_DUMP_DEST USER_DUMP_DEST MAX_DUMP_FILE_SIZE Level of detail: SQL_TRACE TIMED_STATISTICS STATISTICS_LEVEL

Overview of Diagnostic Files Discover the location of the diagnostic files in SQL*Plus with this command: SHOW PARAMETERS DUMP Diagnostic files are used with: Enterprise Manager Diagnostics Pack TKPROF Third party software

Lecture Summary Redo log files primarily contain information on database changes A database has at least two redo log groups A redo log group has at least one member Redo log files support automatic recovery from minor failures A redo log group with multiple files is multiplexed

Lecture Summary The SCN is incremented at a checkpoint Maintenance you can do with redo log files and groups: Add a new file (member) to a group Add a new group Rename or relocate a member Drop a member Drop a group Clear a group

Lecture Summary Placing a database in ARCHIVELOG mode causes redo log files to be archived after a log switch Many initialization parameters set the behavior of the archiving function The V$LOG and V$LOGFILES dynamic performance views display information about redo log groups and members

Lecture Summary Diagnostic files include the alert log file, background trace files, and user trace files BACKGROUND_DUMP_DEST and USER_DUMP_DEST set the location where diagnostic files are written Several other initialization parameters set the size and level of detail stored in diagnostic files