Sunday, December 28, 2008

Oracle Log files

Redo log files record all changes made on the database
Used for recovery

Require at least
2 Groups
1 member

Should try and divide up I/O
Try and keep data file and log files on seperat drives.

Min size 50k
Max size OS dependant

Make larger for many changes

You must enable arch in pfile before you can use the archiver.

LOG_ARCHIVE_DEST_1='location=pathToArchiveFolder'
LOG_ARCHIVE_START=true

Then you must shutdown the database and startup in mount mode and run:
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

Switch log file online
ALTER SYSTEM SWITCH LOGFILE;

Forced check points
FAST_START_MTTR_TARGET = 600 -- 10min range

Alter system checkpoint
ALTER SYSTEM CHECKPOINT;

Adding online redo log file groups
ALTER DATABASE ADD LOGFILE GROUP 4
('PATH\log3a.rdo', 'PATH\log3b.rdo')SIZE 1M;

Adding online redo log file members
ALTER DATABASE ADD LOGFILE MEMBER
'PATH\log1c.rdo' TO GROUP 1,
'PATH\log2c.rdo' TO GROUP 2,
'PATH\log3c.rdo' TO GROUP 3;

Dropping redo log file groups
ALTER DATABASE DROP LOGFILE GROUP 4;

Dropping redo log file members
ALTER DATABASE DROP LOGFILE MEMBER
'PATH\log4c.rdo';

Relocate or rename redo log files
-Shutdown the database
-move the file to the new location
-Startup database in mount mode
-run script to rename file
ALTER DATABASE RENAME FILE
'PATH\log2a.rdo'
TO 'PATH\log3b.rdo';

Clearing online redo log files
ALTER DATABASE CLEAR LOGFILE GROUP 3;
-- might be used to reinitalize log file

ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP3;
-- used to avoid archiving corupt log file.

Data Dictionary views
V$LOG -- more for group info
Status types
-unused
-current
-active
-clearing
-clearing current
-inactive

V$LOGFILE -- more for member info
Status types
-invalid
-stale
-deleted"blank"

V$instance (archive) -- what mode is the archive in

archive log list -- gives info about log archive mode

No comments: