Saturday, July 13, 2013

DATABASE ARCHIVE ENABLED

In order to  enable archive log mode in the database.  Lets take a look at the steps needed to place the database into archivelog mode. using below option today i had keep my one db on archive mode .


Daily we used to ask Oem team ”Tablespace Space Used (%)” metric is giving me wrong data ,. After doing some resource and googling it  i found below
First we want to connect to the database as SYSDBA.

sqlplus / as sysdba

Lets see what  mode we are currently in.  The archive log list command will provide feedback on the current mode of the database.

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 393
Current log sequence 395
Now that we  know the database is in noarchivelog mode, we need to identify a location for the archive logs.  In current releases of the database we can store archive logs in the fast_recovery_area.  For example purposes we are going to put the archive logs in a different area.

SQL> alter system set log_archive_dest_1=’LOCATION /oracle/archivelogs’ scope=spfile;

Once we set our destination for archive logs, we need to shutdown the database.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

Before we can switch the mode of the database, we need to mount the database.

SQL> startup mount
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2232640 bytes
Variable Size 524291776 bytes
Database Buffers 268435456 bytes
Redo Buffers 6742016 bytes
Database mounted.
Now we can switch the mode of the database by using the alter database command.

SQL> alter database archivelog;

Database altered.
Once the mode has been switch to archive log, we can open the database.

SQL> alter database open;

Database altered.
Lets verify that the database is in archive log mode now.

SQL> archive log list 
Database log mode Archive Mode
Automatic archival Enabled
Archive destination //oracle/archivelogs
Oldest online log sequence 393
Next log sequence to archive 395
Current log sequence 395
And additional test to make sure that archive logs are going to the correct location we can switch the log file.

SQL> alter database switch logfile;
System altered.
SQL> !ls -ltr /oracle/archivelogs
total 7432
-rw-rw—-. 1 oracle oracle 7607296 May 22 09:15 1_395_809518082.dbf


No comments:

Post a Comment