Saturday, August 18, 2012

Oracle 11g - Changing to ARCHIVELOG mode

There are several blogs and writeups on this topic. This is one of the most fundamental topic in Oracle database administration. This post describes my experience in AWS Oracle instance.
I created the Oracle instance using AWS EC2 instance. By default (in this instance) the DB instance was in NOARCHIVELOG mode.
This can be verified by using SQL plus or EM interface.
 
01SQL> exit;
02Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
03With the Partitioning, OLAP, Data Mining and Real Application Testing options
04oracle@domU-12-31-39-03-BD-92:[/home/oracle]
05$ sqlplus / as sysdba
06
07SQL*Plus: Release 11.2.0.1.0 Production on Tue May 8 19:40:28 2012
08
09Copyright (c) 1982, 2009, Oracle. All rights reserved.
10
11
12Connected to:
13Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
14With the Partitioning, OLAP, Data Mining and Real Application Testing options
15
16SQL> select name, log_mode from v$database;
17
18NAME LOG_MODE
19--------- ------------
20ODMDB NOARCHIVELOG
21
22SQL>
23SQL> archive log list;
24Database log mode No Archive Mode
25Automatic archival Disabled
26Archive destination USE_DB_RECOVERY_FILE_DEST
27Oldest online log sequence 44
28Current log sequence 46
29SQL>
Let us issue the command to enable the archive mode.
 
1SQL> alter system set log_archive_start=TRUE scope=spfile;
2
3System altered.
4
5SQL>
Now we shutdown the database.
 
1SQL> shutdown immediate;
2Database closed.
3Database dismounted.
4ORACLE instance shut down.
Resart the database.
 
01SQL> startup;
02ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instanceRACLE instance started.
03Total System Global Area 711430144 bytes
04Fixed Size 1338896 bytes
05Variable Size 536871408 bytes
06Database Buffers 167772160 bytes
07Redo Buffers 5447680 bytes
08Database mounted.
09Database opened.
10SQL>
OOOPS... That did NOT seem to work!!!
 
1SQL> archive log list;
2Database log mode No Archive Mode
3Automatic archival Disabled
4Archive destination USE_DB_RECOVERY_FILE_DEST
5Oldest online log sequence 134
6Current log sequence 136
7SQL>
... So what went wrong? We set log_archive_start=TRUE parameter. This is an OBSOLETE parameter since 10g. Well what do we do then?
Lets try again...
 
01SQL> shutdown immediate;
02Database closed.
03Database dismounted.
04ORACLE instance shut down.
05SQL> startup mount;
06ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
07ORACLE instance started.
08
09Total System Global Area 711430144 bytes
10Fixed Size 1338896 bytes
11Variable Size 536871408 bytes
12Database Buffers 167772160 bytes
13Redo Buffers 5447680 bytes
14Database mounted.
15SQL> alter database archivelog;
16
17Database altered.
18
19SQL> alter database open;
20
21Database altered.
22
23SQL> archive log list;
24Database log mode Archive Mode
25Automatic archival Enabled
26Archive destination USE_DB_RECOVERY_FILE_DEST
27Oldest online log sequence 134
28Next log sequence to archive 136
29Current log sequence 136
30SQL>
Well now the database is in ARCHIVELOG Mode :-)

No comments:

Post a Comment