| General | ||||||||||||||||
| Data Dictionary Objects |
|
|||||||||||||||
Status Privileges |
|
|||||||||||||||
| Related Privileges |
|
|||||||||||||||
| init File Parameters | log_checkpoint_timeout … set to 0 | |||||||||||||||
| Log Files Without Redundancy | LOGFILE GROUP 1 ‘/u01/oradata/redo01.log’SIZE 50M, GROUP 2 ‘/u02/oradata/redo02.log’SIZE 50M, GROUP 3 ‘/u03/oradata/redo03.log’SIZE 50M, GROUP 4 ‘/u04/oradata/redo04.log’SIZE 50M |
|||||||||||||||
| Log Files With Redundancy (Group with multiple members) |
LOGFILE GROUP 1 (‘/u01/oradata/redo1a.log’,'/u05/oradata/redo1b.log’) SIZE 50M, GROUP 2 (‘/u02/oradata/redo2a.log’,'/u06/oradata/redo2b.log’) SIZE 50M, GROUP 3 (‘/u03/oradata/redo3a.log’,'/u07/oradata/redo3b.log’) SIZE 50M, GROUP 4 (‘/u04/oradata/redo4a.log’,'/u08/oradata/redo4b.log’) SIZE 50M |
|||||||||||||||
| Related Queries | ||||||||||||||||
| 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 |
|||||||||||||||
| Clear A Log File If It Has Become Corrupt | ALTER DATABASE CLEAR LOGFILE GROUP <group_number>; This statement overcomes two situations where dropping redo logs is not possible: If there are only two log groups The corrupt redo log file belongs to the current group. | |||||||||||||||
| 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; | ||||||||||||||||
| Managing Log File Groups | ||||||||||||||||
| Adding a redo log file group | ALTER DATABASE ADD LOGFILE (‘<log_member_path_and_name>’, ‘<log_member_path_and_name>’) SIZE <integer> <K|M>; |
|||||||||||||||
| ALTER DATABASE ADD LOGFILE (‘/oracle/dbs/log1c.rdo’, ‘/oracle/dbs/log2c.rdo’) SIZE 500K; |
||||||||||||||||
| Adding 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>; |
|||||||||||||||
| ALTER DATABASE ADD LOGFILE GROUP 4 (‘c:\temp\newlog1.log’) SIZE 100M; | ||||||||||||||||
Relocating redo log files |
ALTER DATABASE RENAME FILE ‘<existing_path_and_file_name>’ TO ‘<new_path_and_file_name>’; |
|||||||||||||||
| conn / as sysdba
SELECT member SHUTDOWN; host $ cp /u03/logs/log1a.log /u04/logs/log1a.log $ exit startup mount ALTER DATABASE RENAME FILE ‘/u03/logs/log1a.log’ ALTER DATABASE RENAME FILE ‘/u04/logs/log1b.log’ ALTER DATABASE OPEN host $ rm /u03/logs/log1a.log $ exit SELECT member |
||||||||||||||||
| Drop a redo log file group | ALTER DATABASE DROP LOGFILE GROUP <group_number>; | |||||||||||||||
| ALTER DATABASE DROP LOGFILE GROUP 4; | ||||||||||||||||
| Managing Log File Members | ||||||||||||||||
| Adding log file group members | ALTER DATABASE ADD LOGFILE MEMBER ‘<log_member_path_and_name>’ TO GROUP <group_number>; |
|||||||||||||||
| ALTER DATABASE ADD LOGFILE MEMBER ‘/oracle/dbs/log2b.rdo’ TO GROUP 2; | ||||||||||||||||
| Dropping log file group members | ALTER DATABASE DROP LOGFILE MEMBER ‘<log_member_path_and_name>’; | |||||||||||||||
| ALTER DATABASE DROP LOGFILE MEMBER ‘/oracle/dbs/log3c.rdo’; | ||||||||||||||||
| 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>’ |
|||||||||||||||
| conn uwclass/uwclass
alter session set nls_date_format=’MM/DD/YYYY HH24:MI:SS’; SELECT SYSDATE CREATE TABLE test AS INSERT INTO test COMMIT; conn / as sysdba SELECT ((SYSDATE-1/1440)-TO_DATE(‘01/01/2007′,’MM/DD/YYYY’))*86400 ssec ALTER SYSTEM DUMP LOGFILE ‘c:\oracle\product\oradata\orabase\redo01.log’ TIME MIN 579354757; |
||||||||||||||||
| Disable Log Archiving | ||||||||||||||||
Stop log file archiving |
The following is undocumented and unsupported and should be used only with great care and following through tests. One might consider this for loading a data warehouse. Be sure to restart logging as soon as the load is complete or the system will be at extremely high risk.
The rest of the database remains unchanged. The buffer cache works in exactly the same way, old buffers get overwritten, old dirty buffers get written to disk. It’s just the process of physically flushing the redo buffer that gets disabled. I used it in a very large test environment where I wanted to perform a massive amount of changes (a process to convert blobs to clobs actually) and it was going to take days to complete. By disabling logging, I completed the ~ the above paraphrased from a private email from Richard Foote. |
|||||||||||||||
| conn / as sysdba
SHUTDOWN; STARTUP MOUNT EXCLUSIVE; ALTER DATABASE NOARCHIVELOG; ALTER DATABASE OPEN; ALTER SYSTEM SET “_disable_logging”=TRUE; |
||||||||||||||||
Archive for the ‘Oracle’ Category
Oracle Log Files 11g
Posted by ebenze on August 6, 2008
Posted in Oracle | Leave a Comment »
Oracle Archive Log Mode 11g
Posted by ebenze on August 6, 2008
| General | |
| Note: Archive logging is essential for production databases where the loss of a transaction might be fatal. It is generally considered unnecessary in development and test environments. | |
| Init.ora Parameters | |
Configure for multiple archiver processes |
log_archive_max_processes=<integer>; |
| SELECT value FROM gv$parameter WHERE name = ‘log_archive_max_processes’; ALTER SYSTEM SET log_archive_max_processes=3; SELECT value |
|
| Startup The Database In Archivelog Mode | |
Steps Required To Take A Database Not In Archive Log Mode And Alter It To Archive Log Mode |
SELECT log_mode FROM gv$database; SHUTDOWN; STARTUP MOUNT EXCLUSIVE; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN; SELECT log_mode |
| Startup The Database In NoArchivelog Mode | |
Steps Required To Take A Database In Archive Log Mode And Alter It To No Archive Log Mode |
SELECT log_mode FROM gv$database; SHUTDOWN; STARTUP MOUNT EXCLUSIVE; ALTER DATABASE NOARCHIVELOG; ALTER DATABASE OPEN; SELECT log_mode |
| Restart After Archiving Logging Failure | |
| Archive Logging Restart | SHUTDOWN;
STARTUP; ARCHIVE LOG START; ARCHIVE LOG ALL; |
| Archive Log Related Commands | |
| Start Archive Logging | alter system archive log start; |
| Stop Archive Logging | alter system archive log stop; |
| Force archiving of all log files | alter system archive log all; |
| Force archiving of the current log file | alter system archive log current; |
| Shell Scripts | |
Move Archive Logs |
export ARCH_DIR=”/tmp/rim” NEW_DIR =”/tmp/rim/new_dir” export FILE_EXT=”arc” export MOVELIST=”/tmp/move.list” export CALF=”/tmp/calc.tmp” export TMPF=”/tmp/workfile.tmp” CMD=”ls -ltr $ARCH_DIR/*.$FILE_EXT | awk {‘print $9′} | sort -r > $TMPF” export FILE_COUNT=” echo “Number of files foundis $FILE_COUNT” cho “Moving file $FILE to $NEW_DIR” |
Posted in Oracle | Leave a Comment »