Aside

How To Take Backup Through RMAN

1.       Create a tablespace for storing recovery catalog information in recovery catalog database.

SQL> create tablespace rman datafile ‘/u01/app/oracle/oradata/TEST/rman01.dbf’ size 100m;

Tablespace created.

 2.       Create a user for recovery catalog and assign a tablespace and resources to that user.

SQL> create user ashu identified by ashu123 default tablespace rman quota unlimited on rman;

User created.

SQL> grant connect, resource, recovery_catalog_owner to ashu;

Grant succeeded.

3.       Connect rman to target database. Go to Linux command prompt $

 [oracle@noida ~]$ rman target/

Recovery Manager: Release 11.2.0.1.0 – Production on Wed Sep 25 21:48:56 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TEST (DBID=2111598425)

4.    Connect user to catalog database.

RMAN> connect catalog ashu/ashu123;

connected to recovery catalog database

 5.  Create recovery catalog.

RMAN> create catalog;

recovery catalog created

 6.  Register database.

 RMAN> register database;

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

 7. We can get information about schema.

RMAN> report schema;

Report of database schema for database with db_unique_name TEST

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

—- ——– ——————– ——- ————————

1    670      SYSTEM               YES     /u01/app/oracle/oradata/TEST/system01.dbf

2    490      SYSAUX               NO      /u01/app/oracle/oradata/TEST/sysaux01.dbf

3    45       UNDOTBS1             YES     /u01/app/oracle/oradata/TEST/undotbs01.dbf

4    5        USERS                NO      /u01/app/oracle/oradata/TEST/users01.dbf

5    200      SYSTEM               YES     /u01/app/oracle/oradata/TEST/system02.dbf

6    100      RMAN                 NO      /u01/app/oracle/oradata/TEST/rman01.dbf

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

—- ——– ——————– ———– ——————–

1    20       TEMP                 32767       /u01/app/oracle/oradata/TEST/temp01.dbf

8. Run backup comman to take backup (%t for time, %s for sequence number, %p for piece number).

run

{

allocate channel c1 type disk

format’/u01/app/oracle/oradata/TEST/backup_dir/test_full_%t_%s_%p.bkp’;

backup database plus archivelog;

      }

allocated channel: c1

channel c1: SID=36 device type=DISK

Starting backup at 25-SEP-13

current log archived

channel c1: starting archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=2 RECID=1 STAMP=813452259

input archived log thread=1 sequence=3 RECID=2 STAMP=813496334

input archived log thread=1 sequence=4 RECID=3 STAMP=813582899

input archived log thread=1 sequence=5 RECID=4 STAMP=813587494

input archived log thread=1 sequence=6 RECID=5 STAMP=813588624

input archived log thread=1 sequence=7 RECID=6 STAMP=813588627

input archived log thread=1 sequence=8 RECID=7 STAMP=813611211

input archived log thread=1 sequence=9 RECID=8 STAMP=813611213

input archived log thread=1 sequence=10 RECID=9 STAMP=813622195

input archived log thread=1 sequence=11 RECID=10 STAMP=813677118

input archived log thread=1 sequence=12 RECID=11 STAMP=813677119

input archived log thread=1 sequence=13 RECID=12 STAMP=814010314

input archived log thread=1 sequence=14 RECID=13 STAMP=814010316

input archived log thread=1 sequence=15 RECID=14 STAMP=814041768

input archived log thread=1 sequence=16 RECID=15 STAMP=814041770

input archived log thread=1 sequence=17 RECID=16 STAMP=814094564

input archived log thread=1 sequence=18 RECID=17 STAMP=814094565

input archived log thread=1 sequence=19 RECID=18 STAMP=814731338

input archived log thread=1 sequence=20 RECID=19 STAMP=814731340

input archived log thread=1 sequence=21 RECID=20 STAMP=816356166

input archived log thread=1 sequence=22 RECID=21 STAMP=816356167

input archived log thread=1 sequence=23 RECID=22 STAMP=825976266

input archived log thread=1 sequence=24 RECID=23 STAMP=825976267

input archived log thread=1 sequence=25 RECID=24 STAMP=825979501

input archived log thread=1 sequence=26 RECID=25 STAMP=827097501

input archived log thread=1 sequence=27 RECID=26 STAMP=827097504

input archived log thread=1 sequence=28 RECID=27 STAMP=827100100

input archived log thread=1 sequence=29 RECID=28 STAMP=827100276

channel c1: starting piece 1 at 25-SEP-13

channel c1: finished piece 1 at 25-SEP-13

piece handle=/u01/app/oracle/oradata/TEST/backup_dir/test_full_827100279_1_1.bkp tag=TAG20130925T220438 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:35

Finished backup at 25-SEP-13

Starting backup at 25-SEP-13

current log archived

channel c1: starting archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=30 RECID=29 STAMP=827100427

channel c1: starting piece 1 at 25-SEP-13

channel c1: finished piece 1 at 25-SEP-13

piece handle=/u01/app/oracle/oradata/TEST/backup_dir/test_full_827100430_4_1.bkp tag=TAG20130925T220710 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 25-SEP-13

released channel: c1

9. List backup summary

RMAN> list backup summary;

List of Backups

===============

Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag

——- — — – ———– ————— ——- ——- ———- —

99      B  A  A DISK        25-SEP-13       1       1       NO         TAG20130925T220438

100     B  F  A DISK        25-SEP-13       1       1       NO         TAG20130925T220515

101     B  F  A DISK        25-SEP-13       1       1       NO         TAG20130925T220515

152     B  A  A DISK        25-SEP-13       1       1       NO         TAG20130925T220710

10.  If you want to list of all backups.

 RMAN> list backup;

List of Backup Sets

===================

BS Key  Size       Device Type Elapsed Time Completion Time

——- ———- ———– ———— —————

99      278.32M    DISK        00:00:35     25-SEP-13

BP Key: 103   Status: AVAILABLE  Compressed: NO  Tag: TAG20130925T220438

Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100279_1_1.bkp

List of Archived Logs in backup set 99

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

—- ——- ———- ——— ———- ———

1    2       757371     22-APR-13 768126     22-APR-13

1    3       768126     22-APR-13 792227     23-APR-13

1    4       792227     23-APR-13 815800     24-APR-13

1    5       815800     24-APR-13 819378     24-APR-13

1    6       819378     24-APR-13 820741     24-APR-13

1    7       820741     24-APR-13 820851     24-APR-13

1    8       820851     24-APR-13 854644     24-APR-13

1    9       854644     24-APR-13 854667     24-APR-13

1    10      854667     24-APR-13 870786     24-APR-13

1    11      870786     24-APR-13 895744     25-APR-13

1    12      895744     25-APR-13 895752     25-APR-13

1    13      895752     25-APR-13 922523     29-APR-13

1    14      922523     29-APR-13 922548     29-APR-13

1    15      922548     29-APR-13 940297     29-APR-13

1    16      940297     29-APR-13 940305     29-APR-13

1    17      940305     29-APR-13 943672     30-APR-13

1    18      943672     30-APR-13 943679     30-APR-13

1    19      943679     30-APR-13 980395     06-MAY-13

1    20      980395     06-MAY-13 980403     06-MAY-13

1    21      980403     06-MAY-13 986383     25-MAY-13

1    22      986383     25-MAY-13 986390     25-MAY-13

1    23      986390     25-MAY-13 987562     12-SEP-13

1    24      987562     12-SEP-13 987569     12-SEP-13

1    25      987569     12-SEP-13 997911     12-SEP-13

1    26      997911     12-SEP-13 997975     25-SEP-13

1    27      997975     25-SEP-13 997982     25-SEP-13

1    28      997982     25-SEP-13 1009198    25-SEP-13

1    29      1009198    25-SEP-13 1009417    25-SEP-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

——- —- — ———- ———– ———— —————

100     Full    991.45M    DISK        00:01:36     25-SEP-13

BP Key: 104   Status: AVAILABLE  Compressed: NO  Tag: TAG20130925T220515

Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100316_2_1.bkp

List of Datafiles in backup set 100

File LV Type Ckp SCN    Ckp Time  Name

—- — —- ———- ——— —-

1       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/system01.dbf

2       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/sysaux01.dbf

3       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/undotbs01.dbf

4       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/users01.dbf

5       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/system02.dbf

6       Full 1009486    25-SEP-13 /u01/app/oracle/oradata/TEST/rman01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

——- —- — ———- ———– ———— —————

101     Full    9.36M      DISK        00:00:03     25-SEP-13

BP Key: 105   Status: AVAILABLE  Compressed: NO  Tag: TAG20130925T220515

Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100422_3_1.bkp

SPFILE Included: Modification time: 25-SEP-13

SPFILE db_unique_name: TEST

Control File Included: Ckp SCN: 1009579      Ckp time: 25-SEP-13

BS Key  Size       Device Type Elapsed Time Completion Time

——- ———- ———– ———— —————

152     109.00K    DISK        00:00:00     25-SEP-13

BP Key: 155   Status: AVAILABLE  Compressed: NO  Tag: TAG20130925T220710

Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100430_4_1.bkp

List of Archived Logs in backup set 152

Thrd Seq     Low SCN    Low Time  Next SCN   Next Time

—- ——- ———- ——— ———- ———

1    30      1009417    25-SEP-13 1009588    25-SEP-13

How To Take Backup Through RMAN

Create New Control File

How do we create new control file and why?

1. In Production we always have multiple control files which reside in different locations (e.g. one copy  in oradata and another copy in flash_recovery_area by default).

We can delete corrupt control file and replace it with right one.

2. If we take backup of control file from RMAN using (configure controlfile autobackup on;) then we can restore control file from the RMAN backup. Bydefault this parameter is off in RMAN.

RMAN> restore controlfile from autobackup;

3. If all backup of control files are damaged or we want to change the name of database then we can create control file by CREATE CONTROLFILE command. (logfile group location, datafiles locations, maxlogfiles, maxlogmembers, maxloghistory, maxdatafiles, maxinstances parameter.)

 

CREATE CONTROLFILE
SET DATABASE prod
LOGFILE GROUP 1 (‘/u01/oracle/prod/redo01_01.log’,
‘/u01/oracle/prod/redo01_02.log’),
GROUP 2 (‘/u01/oracle/prod/redo02_01.log’,
‘/u01/oracle/prod/redo02_02.log’),
GROUP 3 (‘/u01/oracle/prod/redo03_01.log’,
‘/u01/oracle/prod/redo03_02.log’)
RESETLOGS
DATAFILE ‘/u01/oracle/prod/system01.dbf’ SIZE 3M,
‘/u01/oracle/prod/rbs01.dbs’ SIZE 5M,
‘/u01/oracle/prod/users01.dbs’ SIZE 5M,
‘/u01/oracle/prod/temp01.dbs’ SIZE 5M
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXLOGHISTORY 400
MAXDATAFILES 200
MAXINSTANCES 6
ARCHIVELOG;

Oracle Core Interview Questions & Answers

How can you see the Current SCN number of the database?

Select current_scn from v$database;

 

How can you see the current log sequence number the log writer is writing in to?

Select * from v$log;

 

If you are given a database, how will you know how many datafiles each tablespace contain?

Select distinct tablespace_name, file_name from dba_data_files;

 

How will you know which temporaray tablepsace is allocated to which user?

Select temporary_tablespace from dba_users where username=’SCOTT’;

 

If you are given a database,how will you know whether it is locally managed or dictionary managed?

Select extent_management from dba_tablespaces where tablespace_name=’USERS’;

 

How will you list all the tablespaces and their status in a database?

Select tablespace_name, status from dba_tablespaces;

 

How will you find the current users who are using temporary tablespace segments?

V$TEMSEG_USAGE

 

How will you convert the locally managed tablespace to dictionay managed? What are the limitations?

Exec dbms_space_admin.tablespace_migrate_from_local(‘tablespace name’);

SYSTEM tablespace should be dictionary.

 

Which parameter defines the max number of datafile in database?

DB_FILES and MAXDATAFILES in control file.

 

How will you check if a datafile is Autoextinsible?

Select autoextensible from dba_data_files where file_name=’’;

 

Write command to make all datafiles of a tablespace offline without making the tablspace offline itself?

Alter database  datafile ‘/u01/app/oracle/oaradata/<name_datafile>’ offline normal;

 

What is the common column between dba_tablespaces and dba_datafiles?

Tablespace_name

Write a query to display the names of all dynamic performance views?

Select table_name from dictionary where table_name like ‘v$%’;

 

Name the script that needs to be executed to create the data dictionary views after database creation?

Catalog.sql

 

Which dynamic performance view gives you information about all privileged users who have been granted sysdba or sysoper roles? Query the view?

SQL> desc v$pwfile_users

 

Write the statement to display the size of the System Global Area (SGA)?

Show parameter sga

Or

Show sga

 

Which dynamic performance view displays information about the active transactions in the database? Which view returns session related information?

V$transaction, v$session

 

Which dynamic performance view is useful for killing user sessions? Which columns of the view will you require to kill a user session? Write the statement to kill any of the currently active sessions in your database?

Alter system kill session ‘SID,SERIAL#’;

 

What is the difference between the ALTER SYSTEM and ALTER SESSION commands?

Changes performed using Alter system are either permanent for the memory or database. But for alter session, its only for session.

 

In which Oracle subdirectory are all the SQL scripts such as catalog.sql/ catproc.sql /utlexcpt.sql etc…? Located?

$ORACLE_HOME/rdbms/admin/

 

Which two types of tablespace cannot be taken offline or dropped?

SYSTEM and UNDO

 

Which parameter specifies the percentage of space in each data block that is reserved for future updates?

PCTFREE

 

Query the DBA_CONSTRAINTS view and display the names of all the constraints that are created on the CUSTOMER table?

Select constraint_name from dba_constraints where table_name=’CUSTOMER’;

 

Write a command to display the names of all BITMAP indexes created in the database?

Select index_name from dba_indexes where index_type=’BITMAP’;

 

How to compile a view? How to compile a table?

Alter view <view name> compile;

Table cannot be compiled.

 

At one time you lost parameter file accidentally and you don’t have any backup. How you will recreate a new parameter file with the parameters set to previous values?

We can recover it from alert log file which contains non-default values.

 

You want to retain only last 3 backups of datafiles. How do you go for it in RMAN?

RMAN> configure retention policy to redundancy 3;

Interview Questions & Answer on RMAN

 

What is RMAN?

Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recovery activities.

What is the difference between using recovery catalog and control file?

When new incarnation happens, the old backup information in control file will be lost. It will be preserved in recovery catalog.

In recovery catalog we can store scripts.

Recovery catalog is central and can have information of many databases.

Can we use same target database as catalog?

No, The recovery catalog should not reside in the target database (database should be backed up), because the database can’t be recovered in the mounted state.

How do you know that how much RMAN task has been completed?

By querying v$rman_status or v$session_longops

From where list & report commands will get input?

Both the commands command quering v$ and recovery catalog views. V$BACKUP_FILES or many of the recovery catalog views such asRC_DATAFILE_COPY or RC_ARCHIVED_LOG.

Command to delete archive logs older than 7days?

RMAN> delete archivelog all completed before sysdate-7;

How many times does oracle ask before dropping a catalog?

The default is two times one for the actual command, the other for confirmation.

How to view the current defaults for the database.

RMAN> show all;

What is the use of crosscheck command in RMAN?

Crosscheck will be useful to check whether the catalog information is intact with OS level information. This command only updates repository records with the status of the backups.

e.g. If user removes archived logs from disk with an operating system command, the repository still indicates that the logs are on disk, when in fact they are not.

 

What are the differences between crosscheck and validate commands?

Validate command is to examine a backup set and report whether it can be restored. RMAN scans all of the backup pieces in the specified backup sets and looks at the checksum to verify that the contents are intact so that backup can be successfully restored if necessary.

Crosscheck command is to verify the status of backups and copies recorded in the RMAN repository against media such as disk or tape. The crosscheck command only processes files created on the same device type as the channel running crosscheck.

Which one is good, differential (incremental) backup or cumulative (incremental) backup?

A differential backup, which backs up all blocks changed after the most recent incremental backup at level 1 or 0

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;

A cumulative backup, which backs up all blocks changed after the most recent incremental backup at level 0

RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

Cumulative backups are preferable to differential backups when recovery time is more important than disk space, because during recovery each differential backup must be applied in succession. Use cumulative incremental backups instead of differential, if enough disk space is available to store cumulative incremental backups.

This is command for taking Level 0 backup.

RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE;

What is the difference between backup set and backup piece?

Backup set is logical and backup piece is physical.

RMAN command to backup for creating standby database

RMAN> duplicate target database

You loss one datafile and DB is running in ARCHIVELOG mode. You have full database backup of 1 week/day old and don’t have backup of this (newly created) datafile. How do you restore/recover file?

Create data file and recover datafile.

SQL> alter database create datafile ‘/u01/app/oracle/oradata/xyz.dbf’ size 2G;

RMAN> recover datafile file_id;

What is obsolete backup & expired backup?

A status of “expired” means that the backup piece or backup set is not found in the backup destination.

A status of “obsolete” means the backup piece is still available, but it is no longer needed. The backup piece is no longer needed since RMAN has been configured to no longer need this piece after so many days have elapsed, or so many backups have been performed.

What is the difference between hot backup & RMAN backup?

For hot backup, we have to put database in begin backup mode, then take backup.
RMAN won’t put database in backup mode.

 

How to put manual/user-managed backup in RMAN (recovery catalog)?

By using catalog command.

RMAN> CATALOG START WITH ‘/tmp/backup.ctl’;

What are the Architectural components of RMAN?

  1. RMAN Executables
  2. Sercer process
  3. Channels
  4. Target database
  5. Recovery catalog database (optional)
  6. Media management Layer (optional)
  7. Backups, backup sets and backup pieces

What are channels?

A channel is an RMAN server process started when there is a need to communicate with an I/O device, such as a disk or a tape. A channel is what reads and writes RMAN backup files. It is through the allocation of channels that you govern I/O characteristics:

  • Type of I/O device being read or written to, either a disk or an sbt_tape
  • Number of processes simultaneously accessing an I/O device
  • Maximize size of files created on I/O devices
  • Maximize rate at which database files are read
  • Maximize number of files open at a time

Why is the catalog optional?

Because RMAN manages backup and recovery operations, it requires a place to store necessary information about the database. RMAN always stores this information in the target database control file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database. The recovery catalog schema must be stored in a database other than the target database.

What is a Backup set?

A logical grouping of backup files — the backup pieces — that are created when you issue an RMAN backup command. A backup set is RMAN’s name for a collection of files associated with a backup. A backup set is composed of one or more backup pieces.

What are the benefits of using RMAN?

  1. Incremental backups that only copy data blocks that have changed since the last backup.
  2. Tablespaces are not put in backup mode, thus there is noextra redo log generation during online backups.
  3. Detection of corrupt blocks during backups.
  4. Parallelization of I/O operations.
  5. Automatic logging of all backup and recovery operations.
  6. Built-in reporting and listing commands.

What are the various reports available with RMAN

RMAN>list backup;

RMAN> list archive;

In catalog database, if some of the blocks are corrupted due to system crash, How will you recover?

using RMAN BLOCK RECOVER command

How do you enable the autobackup for the controlfile using RMAN?

Issue command at RMAN prompt.

RMAN> configure controlfile autobackup on;

Also we can configure controlfile backup format.

RMAN> configure controlfile autobackup format for device type disk to

2> ‘$HOME/BACKUP/RMAN/ F.bkp’;

How do you identify what are the all the target databases that are being backed-up with RMAN database?

You don’t have any view to identify whether it is backed up or not. The only option is connect to the target database and give list backup this will give you the backup information with date and timing.

How do you identify the block corruption in RMAN database? How do you fix it?

Using v$block_corruption view you can find which blocks corrupted.

RMAN> block recover datafile <fileid> block <blockid>;

Using the above statement You recover the corrupted blocks. First check whether the block is corrupted or not by using this command

SQL>select file# block# from v$database_block_corruption;

file# block

2 507

the above block is corrupted…

conn to Rman

To recover the block use this command…

RMAN>blockrecover datafile 2 block 507;

the above command recover the block 507

Now just verify it…..

Rman>blockrecover corruption list;

How do you clone the database using RMAN software? Give brief steps? When do you use crosscheck command?

Check whether backup pieces proxy copies or disk copies still exist.

Two commands available in RMAN to clone database:

1) Duplicate

2) Restore.

List some of the RMAN catalog view names which contain the catalog information?

RC_DATABASE_INCARNATION RC_BACKUP_COPY_DETAILS

RC_BACKUP_CORRUPTION

RC_BACKUP-DATAFILE_SUMMARY

How do you install the RMAN recovery catalog?

Steps to be followed:

1) Create connection string at catalog database.

2) At catalog database create one new user or use existing user and give that user a recovery_catalog_owner privilege.

3) Login into RMAN with connection string

a) export ORACLE_SID

b) rman target catalog @connection string

4) rman> create catalog;

5) register database;

What is the difference between physical and logical backups?

In Oracle Logical Backup is “which is taken using either Traditional Export/Import or Latest Data Pump”. Where as Physical backup is known “when you take Physical O/s Database related Files as Backup”.

What is RAID? What is RAID0? What is RAID1? What is RAID 10?

RAID: It is a redundant array of independent disk

RAID0: Concatenation and stripping

RAID1: Mirroring

How to enable Fast Incremental Backup to backup only those data blocks that have changed?

SQL> ALTER DATABASE enable BLOCK CHANGE TRACKING;

How do you set the flash recovery area?

SQL> ALTER SYSTEM SET db_recovery_file_dest_size = 100G;

SQL> ALTER SYSTEM SET db_recovery_file_dest = ‘/u10/oradata/school’;

What is auxiliary channel in RMAN? When do you need this?

An auxiliary channel is a link to auxiliary instance. If you do not have automatic channels configured, then before issuing the DUPLICATE command, manually allocate at least one auxiliary channel within the same RUN command.

How do you use the V$RECOVERY_FILE_DEST view to display information regarding the flashrecovery area?

SQL> SELECT name, space_limit, space_used,space_reclaimable, number_of_filesFROM v$recovery_file_dest;

How can you display warning messages?

SQL> SELECT object_type, message_type,message_level, reason, suggested_actionFROM dba_outstanding_alerts;

How do you backup the entire database?

RMAN> BACKUP DATABASE;

How do you backup an individual tablespaces?

RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;

RMAN> BACKUP TABLESPACE system;

How do you backup datafiles and control files?

RMAN> BACKUP DATAFILE 3;

RMAN> BACKUP CURRENT CONTROLFILE;

Use a fast recovery without restoring all backups from their backup location to the location specified inthe controlfile.

RMAN> SWITCH DATABASE TO COPY;

Change Database to Archive Log Mode

Checking whether database in archivelog mode or not.

We can use two command for that

SQL> archive log list;

SQL> select log_mode from v$database;

If database not in archive log mode then we shutdown the database and open database into mount state then issue alter database archivelog command then startup again by alter database open command..