Showing posts with label open_mode. Show all posts
Showing posts with label open_mode. Show all posts

Saturday, September 15, 2012

V$DATABASE OPEN_MODE

This was tested on Oracle 11.1.0.6.0 on Windows XP. You can see if your database is open or closed by querying open_mode from v$database:

C:\>sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Sat Sep 15 23:18:58 2012

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

Connected to an idle instance.

SQL> select open_mode from v$database;
select open_mode from v$database
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

SQL> startup nomount
ORACLE instance started.

Total System Global Area  535678976 bytes
Fixed Size                  1334320 bytes
Variable Size             201327568 bytes
Database Buffers          327155712 bytes
Redo Buffers                5861376 bytes
SQL> select open_mode from v$database;

select open_mode from v$database
                      *
ERROR at line 1:
ORA-01507: database not mounted

SQL> alter database mount
  2  /

Database altered.


SQL> select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SQL> alter database open;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SQL>

I will look at what all these open_mode values mean in another post.

Thursday, August 23, 2012

rman Backup and Recovery - example 3

This was tested on Oracle 11.2. The Oracle rman user guide says:  If a database runs in ARCHIVELOG mode, then you can back up the database while it is open. This suggests that if your database is running in NOARCHIVELOG mode, you cannot back it up while it is open. I decided to try this out. First I checked that the database was still in NOARCHIVELOG mode:
 
SQL> select log_mode, open_mode from v$database;
 
LOG_MODE     OPEN_MODE
------------ --------------------
NOARCHIVELOG READ WRITE
 
SQL>
 
Then I tried to back it up with rman:
 
RMAN> backup database;
 
Starting backup at 23-AUG-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=586 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 08/23/2012 18:42:22
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 23-AUG-12
channel ORA_DISK_1: finished piece 1 at 23-AUG-12
piece handle=/database/Andrew/ANDREW01/backupset/2012_08_23/o1_mf_ncnnf_TAG20120823T184221_83dtw1pb_.bkp tag=TAG20120823T184221 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
 
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 08/23/2012 18:42:22
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
 
RMAN>
 
It failed, as you might expect, so, if you see these messages yourself, you should know what to do. I will pick this up in future examples.