Sunday, August 19, 2012

rman Backup and Recovery - example 2

Recovery Manager stores backups at the location specified by the db_recovery_file_dest initialisation parameter. At the start of this example, which I tested on Oracle 11.2, my database had no db_recovery_file_dest details:

SQL> l
  1  select name, nvl(value,'NULL')
  2  from v$parameter
  3* where name like 'db_recovery_file_dest%'
SQL> /

NAME                           NVL(VALUE,'NULL')
------------------------------ --------------------
db_recovery_file_dest          NULL
db_recovery_file_dest_size     0

SQL>

So, when I used rman to do a backup, Oracle put the files it produced in $ORACLE_HOME/dbs instead. This has the potential to fill up $ORACLE_HOME so you must not do it. Notice how you can use rman to shutdown and startup mount the database:

Solaris > rman nocatalog target /

Recovery Manager: Release 11.2.0.1.0 - Production on Fri Aug 17 14:48:59 2012

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

connected to target database: ANDREW01 (DBID=385736687)
using target database control file instead of recovery catalog

RMAN> shutdown

database closed
database dismounted
Oracle instance shut down

RMAN> startup mount

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     417669120 bytes

Fixed Size                     2148672 bytes
Variable Size                314578624 bytes
Database Buffers              96468992 bytes
Redo Buffers                   4472832 bytes

RMAN> backup database;

Starting backup at 17-AUG-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/database/Andrew/ANDREW01/system01.dbf
input datafile file number=00002 name=/database/Andrew/ANDREW01/sysaux01.dbf
input datafile file number=00005 name=/database/Andrew/ANDREW01/users2.dbf
input datafile file number=00003 name=/database/Andrew/ANDREW01/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 17-AUG-12
channel ORA_DISK_1: finished piece 1 at 17-AUG-12
piece handle=/oracle/app/oracle/product/11.2.0/dbs/03nisji9_1_1 tag=TAG20120817T145048 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 17-AUG-12
channel ORA_DISK_1: finished piece 1 at 17-AUG-12
piece handle=/oracle/app/oracle/product/11.2.0/dbs/04nisjjc_1_1 tag=TAG20120817T145048 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-AUG-12

RMAN>

I tried to set db_recovery_file_dest by itself but failed:

SQL> l
  1  alter system set
  2* db_recovery_file_dest = '/database/Andrew'
SQL> /
alter system set
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because
specified value is invalid
ORA-19802: cannot use DB_RECOVERY_FILE_DEST without
DB_RECOVERY_FILE_DEST_SIZE

SQL>

The ORA-02097 message is slightly misleading as the parameter supplied is not invalid. The real problem is shown by the ORA-19802 message. I set db_recovery_file_dest_size to an appropriate value:

SQL> l
  1  alter system
  2* set db_recovery_file_dest_size = 4g
SQL> /

System altered.

SQL>

Then I was able to set db_recovery_file_dest successfully:

SQL> l
  1  alter system set
  2* db_recovery_file_dest = '/database/Andrew'
SQL> /

System altered.

SQL>

No comments:

Post a Comment