| Oracle Redo Log Files Version 11.2.0.3 |
|---|
| General Information | |||||||||||||||
| Data Dictionary Objects |
|
||||||||||||||
| init File Parameters | log_checkpoint_timeout ... set to 0 | ||||||||||||||
| Log Files With Redundancy (Group with multiple members) |
LOGFILE GROUP 1 ('/u01/oradata/redo1a.log','/u05/oradata/redo1b.log') SIZE 2G, GROUP 2 ('/u02/oradata/redo2a.log','/u06/oradata/redo2b.log') SIZE 2G, GROUP 3 ('/u03/oradata/redo3a.log','/u07/oradata/redo3b.log') SIZE 2G, GROUP 4 ('/u04/oradata/redo4a.log','/u08/oradata/redo4b.log') SIZE 2G |
||||||||||||||
| Log Files Without Redundancy | LOGFILE GROUP 1 '/u01/oradata/redo01.log'SIZE 2G, GROUP 2 '/u02/oradata/redo02.log'SIZE 2G, GROUP 3 '/u03/oradata/redo03.log'SIZE 2G, GROUP 4 '/u04/oradata/redo04.log'SIZE 2G; |
||||||||||||||
| Log File Sizing | As a rule-of-thumb one should try to balance archive logging between the following mutually exclusive criteria
Other advantages to consider in using the log file switch frequency recommended here, as opposed to fewer switches, are:
|
||||||||||||||
| Status Privileges |
|
||||||||||||||
| Related System Privileges |
|
||||||||||||||
| Managing Log File Groups | |||||||||||||||
| Add a redo log file group | ALTER DATABASE ADD LOGFILE ('<log_member_path_and_name>', '<log_member_path_and_name>') SIZE <integer> <K | M | G>; |
||||||||||||||
| ALTER DATABASE ADD LOGFILE ('/oracle/dbs/log1c.rdo', '/oracle/dbs/log2c.rdo') SIZE 500M; |
|||||||||||||||
| Add a redo log file group and specifying the group number | ALTER DATABASE ADD LOGFILE GROUP <group_number> ('<log_member_path_and_name>') SIZE <integer> <K | M | G>; |
||||||||||||||
| ALTER DATABASE ADD LOGFILE GROUP 4 ('c:\temp\newlog1.log') SIZE 500M; | |||||||||||||||
| Relocate redo log files | ALTER DATABASE RENAME FILE '<existing_path_and_file_name>' TO '<new_path_and_file_name>'; |
||||||||||||||
| conn / as sysdba SELECT member FROM v_$logfile; SHUTDOWN; host $ cp /u03/logs/log1a.log /u04/logs/log1a.log $ cp /u03/logs/log1b.log /u05/logs/log1b.log $ exit startup mount ALTER DATABASE RENAME FILE '/u03/logs/log1a.log' TO '/u04/oradata/log1a.log'; ALTER DATABASE RENAME FILE '/u04/logs/log1b.log' TO '/u05/oradata/log1b.log'; ALTER DATABASE OPEN; host $ rm /u03/logs/log1a.log $ rm /u03/logs/log1b.log $ exit SELECT member FROM v_$logfile; |
|||||||||||||||
| Drop a redo log file group | ALTER DATABASE DROP LOGFILE GROUP <group_number>; | ||||||||||||||
| ALTER DATABASE DROP LOGFILE GROUP 4; | |||||||||||||||
| Manage Log File Members | |||||||||||||||
| Adding a single log file group member | ALTER DATABASE ADD LOGFILE MEMBER '<log_member_path_and_name>' TO GROUP <group_number>; | ||||||||||||||
| ALTER DATABASE ADD LOGFILE MEMBER '/oracle/dbs/log2b.log' TO GROUP 2; | |||||||||||||||
| Add a log group containing two members | ALTER DATABASE ADD LOGFILE GROUP <integer> (<logfile_path_and_name>, <logfile_path_and_name>) SIZE <integer><K | M>; |
||||||||||||||
| ALTER DATABASE ADD LOGFILE GROUP 4 ('/u01/logs/redo4a.log', '/u02/logs/redo4b.log') SIZE 500M; | |||||||||||||||
| Drop Log File Group | ALTER DATABASE DROP [STANDBY] LOGFILE GROUP <integer>; | ||||||||||||||
| SELECT group#, status FROM gv$log; ALTER DATABASE DROP LOGFILE GROUP 2; |
|||||||||||||||
| Dropping log file group member | ALTER DATABASE DROP [STANDBY] LOGFILE MEMBER <logfile_member_path_and_name>; | ||||||||||||||
| SELECT * FROM gv$logfile WHERE group# IN ( SELECT group# FROM gv$log WHERE status = 'INACTIVE'); ALTER DATABASE DROP LOGFILE MEMBER '/oracle/dbs/log3c.log'; |
|||||||||||||||
| Drop Log File by Descriptor | ALTER DATABASE DROP [STANDBY] LOGFILE <file_name>; | ||||||||||||||
| ALTER DATABASE DROP LOGFILE '/oracle/dbs/log3c.log'; | |||||||||||||||
| Manage Log File Threads | |||||||||||||||
| Add a redo log containing two members to a thread | ALTER DATABASE ADD LOGFILE THREAD <integer>
GROUP <integer> (<logfile_path_and_name>, <logfile_path_and_name>); |
||||||||||||||
| ALTER DATABASE ADD LOGFILE THREAD 5 GROUP 3 ('/u03/oradabase/redo315.log', '/home/oracle/orabase/redo325.log'); |
|||||||||||||||
| Dumping Log Files | |||||||||||||||
| Dumping a log file to trace | ALTER SYSTEM DUMP LOGFILE '<logfile_path_and_name>' DBA MIN <file_number> <block_number> DBA MAX <file_number> <block_number>; or ALTER SYSTEM DUMP LOGFILE '<logfile_path_and_name>' TIME MIN <value> TIME MIN <value>; |
||||||||||||||
| conn uwclass/uwclass alter session set nls_date_format='MM/DD/YYYY HH24:MI:SS'; SELECT SYSDATE FROM dual; CREATE TABLE test AS SELECT owner, object_name, object_type FROM all_objects; INSERT INTO test (owner, object_name, object_type) VALUES ('UWCLASS', 'log_dump', 'TEST'); COMMIT; conn / as sysdba SELECT ((SYSDATE-1/1440)-TO_DATE('01/01/2007','MM/DD/YYYY'))*86400 ssec FROM dual; ALTER SYSTEM DUMP LOGFILE 'c:\oracle\product\oradata\orabase\redo01.log' TIME MIN 579354757; |
|||||||||||||||
| Related Queries | |||||||||||||||
| This query can be used to create a report giving a graphical view of dates and times of log file usage | set linesize 121 col 00 format 99 col 01 format 99 col 02 format 99 col 03 format 99 col 04 format 99 col 05 format 99 col 06 format 99 col 07 format 99 col 08 format 99 col 09 format 99 col 10 format 99 col 11 format 99 col 12 format 99 col 13 format 99 col 14 format 99 col 15 format 99 col 16 format 99 col 17 format 99 col 18 format 99 col 19 format 99 col 20 format 99 col 21 format 99 col 22 format 99 col 23 format 99 SELECT * FROM ( SELECT * FROM ( SELECT TO_CHAR(FIRST_TIME, 'DD/MM') AS "DAY" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '00', 1, 0)), '99') "00" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '01', 1, 0)), '99') "01" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '02', 1, 0)), '99') "02" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '03', 1, 0)), '99') "03" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '04', 1, 0)), '99') "04" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '05', 1, 0)), '99') "05" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '06', 1, 0)), '99') "06" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '07', 1, 0)), '99') "07" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '08', 1, 0)), '99') "08" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '09', 1, 0)), '99') "09" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '10', 1, 0)), '99') "10" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '11', 1, 0)), '99') "11" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '12', 1, 0)), '99') "12" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '13', 1, 0)), '99') "13" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '14', 1, 0)), '99') "14" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '15', 1, 0)), '99') "15" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '16', 1, 0)), '99') "16" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '17', 1, 0)), '99') "17" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '18', 1, 0)), '99') "18" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '19', 1, 0)), '99') "19" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '20', 1, 0)), '99') "20" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '21', 1, 0)), '99') "21" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '22', 1, 0)), '99') "22" , TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '23', 1, 0)), '99') "23" FROM V$LOG_HISTORY WHERE extract(year FROM FIRST_TIME) = extract(year FROM sysdate) GROUP BY TO_CHAR(FIRST_TIME, 'DD/MM')) ORDER BY TO_DATE(extract(year FROM sysdate) || DAY, 'YYYY DD/MM') DESC) WHERE ROWNUM < 8 ORDER BY 1; |
||||||||||||||
| Redo Log generation rate query from Jonathan Lewis [Click Here] | SELECT TO_CHAR(first_time,'dd hh24:mi:ss') first_time, ROUND(24 * 60 * (LEAD(first_time,1) OVER (ORDER BY first_time) - first_time),2) minutes FROM v$log_history v ORDER BY recid; |
||||||||||||||
| View information on log files | SELECT * FROM gv$log; |
||||||||||||||
| View information on log file history | SELECT thread#, first_change#, TO_CHAR(first_time,'MM-DD-YY HH12:MIPM'), next_change# FROM gv$log_history; |
||||||||||||||
| Forcing log file switches | ALTER SYSTEM SWITCH LOGFILE; or ALTER SYSTEM CHECKPOINT; |
||||||||||||||
| Clear a log file if it has become corrupt | ALTER DATABASE CLEAR LOGFILE GROUP <group_number>; |
||||||||||||||
| ALTER DATABASE CLEAR LOGFILE GROUP 4; | |||||||||||||||
| Clear A Log File If It Has Become Corrupt And Avoid Archiving | ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP <group_number>; Use this version of clearing a log file if the corrupt log file has not been archived. |
||||||||||||||
| ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 3; | |||||||||||||||
| Related Topics |
| Archive Log Mode |
| Backup & Restore |
| Control Files |
| DBMS_LOGMNR |
| Kevin Closson's Blog |
| This site is maintained by Dan Morgan. Last Updated: | This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2013 Daniel A. Morgan All Rights Reserved | |||||||||
|
|
||||||||||