Redo redo logs are as important to Oracle as the liver, and are an important part of Oracle's function of detoxifying and restoring health !!
Related Basic concepts:
1. SCN
2. Log serial number
3. Log groups and log members, especially the size of log files (which affects the automatic issuance of ckpt); log write wait;
4. lgwr
5. ckpt
6. dbwr
7. initialize log_buffer, fast_start_mttr_target, log_checkpoint_interval, and log_checkpoit_timeout parameters.
Basic Management
1. Switch logs: Alter system switch logfile;
2. Manually send the checkpoint: Alter sysem checkpoit;
3. Add a log group: Alter database add logfile [group N]File-spec
4. Add members to the log group: Alter database add logfile MemberFile-specTo group N
5. delete a log group: Alter database drop logfile group N
6. Delete the members of the log group: Alter database drop logfile MemberFile-spec
7. reinitialize the log group or log group member: Alter database clear logfile {group N |File-spec|(File-spec,File-spec...)}
8. view the current log file group and members: Select * from V $ logfile; select * from V $ log;
9. Move or | and rename the log group member file: Alter database rename FileFile-specTo File-spec
Archivelog and noarchivelog Modes
The noarchivelog mode is the default Oracle mode, which is equivalent to the "simple" mode of the sqlserver recovery model. It can only be used to prevent failure of routine and start recovery of SMON.
Noarchivelog features:
1. Simple. The redo log group is not archived. You do not need to consider the occupation of redo log space as long as enough size is required.
2. database backup requirements: Database consistency must be ensured, and the shutdown abort mode cannot be used. It must be backed up together with the control file.
3. The database cannot be restored to an SCN, time, or log sequence.
The archivelog mode is the most important and main mode. In general, we should adopt this mode.
Features of archivelog:
1. There are additional archiving processes and the corresponding archiving directory and disk space are required
2. Full database protection: as long as there are backup and subsequent redo archiving logs, you can restore the logs to a certain SCN, time, or log sequence.
3. Easy management: When the database is in the open state, it can be backed up and restored !!!
Switching between archivelog and noarchivelog: in the Mount state, alter database {archivelog | noarchivelog}
Configure the location of archivelog logs
The default location is % ORACLE_HOME % \ RDBMS.
The default file format is: arc % S _ % R. % T (the format is consistent with the log serial number, resetlogs ID, and arch thread number)
You can modify the initialization parameters to customizeLocalLocation of archived logs: log_archive_dest and log_archive_duplex_dest
You can modify the initialization parameters to customizeLocal or remoteLocation of the archived log: log_archive_dest_n (1-10 ). Note that it is mutually exclusive with the above configuration method!
Special: In this configuration, you must specify the location or service: {location = path_name | service = SERVICE_NAME} in the Set string value}
There are also a lot of options
Log_archive_dest _ [1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10] =
{ Null_string | Location = path_name | service = SERVICE_NAME} -- path_name can be set to use_db_recovery_file_dest.
[{Mandatory | Optional }] -- Use MandatoryYes Force the RTS service process to switch logs only after the target standby archive log is successfully transferred
[Reopen [= seconds] -- specifies the minimum number of seconds before the archiver processes (arcn) or the log writer process (lgwr) shocould try again to access a previusly failed destination. the default is 300 seconds.
[Delay [= minutes] -- cannot set the delay attribute for a logical standby database destination, default is 30 minutes
[Noregister]
[Template = TEMPLATE]
[Alternate = destination] -- format: log_archive_dest_n
[Dependency = destination] ---- format: log_archive_dest_n
[Max_failure = count]
[ Arch | Lgwr]
[Sync | Async ] -- Network I/O is to be done synchronously or asynchronously when archival is already med using the log writer process (lgwr) and the network server (lnsn) processes.
[Affrem | Noaffrem ] -- Synchronous or asynchronous disk I/O
[Net_timeout = seconds] -- the default value is 180 seconds.
[Valid_for = (redo_log_type, database_role)]
[{ Db_unique_name }] -- Speci distinct es a unique name for the database at this destination.
[Verify] -- indicates if an archiver (arcn) process shocould scan and verify the correctness of the contents of a completed archived redo log file, either local or remote, after successfully completing the archival operation. by default, archived redo log files are not verified.
}
Log_archive_dest_n in combination with log_archive_dest_state_n is used to determine the availability of the archive location: Enable (available), defer (unavailable), and alternate (alternate)
We can use the log_archive_config initialization parameter to configure whether Oracle sends and accepts transaction logs from remote ORACLE servers, and define data guard. This parameter may affect the server performance!
Log_archive_config =
{
[Send| Nosend]
[Receive| Noreceive]
[Dg_config = (remote_db_unique_name1 [,... remote_db_unique_name9) |Nodg_config]
}
View information about archivelog Mode
1. Under sqlplus: archive log list
2. Display archiving history: Select * from V $ archived_log; select * from V $ loghist;
3. Select * from V $ archive_dest. You can use show parameters log_archive;