CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle Archive Log Mode
Version 11.1
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
FROM gv$parameter
WHERE name = 'log_archive_max_processes';
 
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 v$database;

SHUTDOWN;

STARTUP MOUNT EXCLUSIVE;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE OPEN;

SELECT log_mode
FROM v$database;
 
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 v$database;

SHUTDOWN;

STARTUP MOUNT EXCLUSIVE;

ALTER DATABASE NOARCHIVELOG;

ALTER DATABASE OPEN;

SELECT log_mode
FROM v$database;
 
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 found is $FILE_COUNT"
cat $TMPF
echo $FILE_COUNT< - 1" > $CALF
echo "quit" >> $CALF
MOVE ="/usr/bin/bc/ $CALF"
echo "Number of files to move is $MOVE"
/usr/bin/tail -$MOVE $TMPF > $MOVELIST
echo "File to be moved"
cat $MOVELIST
while read FILE
do

echo "Moving file $FILE to $NEW_DIR"
done < $MOVELIST
 
Related Topics
Flashback Database
Log Files
RMAN
RMAN Demos
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [236 users online]    © 2010 psoug.org