Thursday, 22 October 2015

Convert the oracle database into archivelog mode

Suppose the database is currently running on noarchivelog mode. To ensure that all the changes in database are always protected one must enable archive logging of database. By converting the database mode, one must be able to perform media and instance recovery when required.

[oracle@oel6 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 22 21:35:38 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

Start the database in mount state

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  471830528 bytes
Fixed Size    2254344 bytes
Variable Size  197134840 bytes
Database Buffers  268435456 bytes
Redo Buffers    4005888 bytes
Database mounted.
SQL>

Set the archive destination and enable archiving

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/archive' scope=both;

System altered.

SQL> alter database archivelog;

Database altered.

Check that the archiving is enabled and destination is correct

SQL> archive log list
Database log mode       Archive Mode
Automatic archival       Enabled
Archive destination       /u01/app/oracle/archive
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence        1

Open the database

SQL> alter database open;

Database altered.

Perform a log switch and check the archivelog is generated at the location specified:-

SQL> alter system switch logfile;

System altered.

SQL> select name from v$archived_log;

NAME
----------------------------------------------------------
/u01/app/oracle/archive/1_1_892594586.dbf



No comments:

Post a Comment