Archive

Archive for the ‘RMAN’ Category

Oracle – RMAN Restore Database


If you have a current controlfile, spfile, but all datafiles have been lost or damaged, then you must restore and recover the entire database.

RMAN> STARTUP MOUNT

You can use the show all command to check which channels are configured for access to backup devices. If none are configured then you will need to manually allocate one or more channels.

RMAN> SHOW ALL

Restore the database using the restore database command:

RMAN> RESTORE DATABASE;

If you have any read-only tablespaces you will need to force RMAN to restore any missing datafiles belonging to them. This is because RMAN typically skips read-only tablespaces on a restore.

To do this you can issue the following instead of the restore command above:

RMAN> RESTORE DATABASE CHECK READONLY;

Recover the database using the recover database command:

RMAN> RECOVER DATABASE;

NB. You can also recover the database appending delete archivelog maxsize <number> this will delete archivelogs after they have been applied and will prevent them from being bigger than the maxsize indicated. It should be noted that if the maxsize of the archivelogs is greater than the size given here, then the statement will give an error and you will need to increase the maxsize in the statement.

Once you have successfully recovered the database, you can open it from RMAN:

RMAN> ALTER DATABASE OPEN;

Further Reading

Basic Database Restore and Recovery Scenarios – Oracle Documentation 10.1

Advertisements

Oracle – Backup Controlfile

August 20, 2011 1 comment

It is necessary, from time to time, to backup the controlfile. This can be done when the database is open or mounted.

Backup controlfile using SQL

If you wish to backup the controlfile using SQLPLUS then you can issue the following to backup the controlfile to a binary file:

SQL> ALTER DATABASE BACKUP CONTROLFILE TO '/oracle/backup/control.bkp';

This create a duplicate of the current controlfile.

However, if you wish to produce SQL statements that can later be used to re-create the controlfile, you can issue the following:

SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

Backup controlfile using RMAN

RMAN will automatically backup the controlfile and server parameter file after every backup and after structural database changes, if CONFIGURE CONTROLFILE AUTOBACKUP is set to ON. It is set to OFF by default.

The controlfile autobackup contains metadata about the previous backup, which is essential for database recovery.

Manually backup controlfile

RMAN> BACKUP CURRENT CONTROLFILE;

It should be noted that a manual backup of the controlfile cannot be automatically restored. This is because it only contains RMAN repository data for backups within the current RMAN session. However, if controlfile autobackup is set to on, RMAN will manually backup the controlfile then it will create an autobackup of the controlfile and server parameter file after the manual backup has completed so it can record the latest backup information.

If you wish to include the current controlfile in a backup then you can perform something like the following:

RMAN> BACKUP DEVICE TYPE sbt TABLESPACE emp INCLUDE CURRENT CONTROLFILE;

If autobackup is enabled then RMAN performs and autobackup of the controlfile after the backup, so the controlfile backup contains details of the latest backup taken.

Backup controlfile as copy

You can also backup the controlfile as a copy. You can use either of the below commands for creating a backup controlfile copy:

RMAN> BACKUP AS COPY CURRENT CONTROLFILE FORMAT '/tmp/controlfile_copy.ctl';

RMAN> BACKUP DEVICE TYPE sbt CONTROLFILECOPY  '/tmp/controlfile_copy.ctl';

Futher Reading

Managing Control Files – Oracle Documentation

Backing Up Database Files and Archived Logs With RMAN – Oracle Documentation

Oracle – RMAN backup example


RMAN can be used to backup a database. You can perform a hot backup if the database is in archivelog mode, or a cold backup if it is not. You can either perform a full backup or an incremental backup. RMAN is particularly useful because it only backs up used space.

An RMAN backup will backup the datafiles, controlfile, server parameter file, and archivelogs (where applicable).

To backup a database using RMAN with a level 0 backup you can perform the following:

$ ORACLE_SID = <oracle_sid>
$ORACLE_HOME = <oracle_home>
$ rman
RMAN> CONNECT TARGET /
RMAN> BACKUP DATABASE; # Cold backup without archivelogs
RMAN> BACKUP DATABASE PLUS ARCHIVELOG; # Cold backup with archivelogs

Incremental backups save time, bandwidth and reduce backup sizes. Incremental backups abck up all the blocks changed since the last level 0 incremental backup. If no level 0 backup has been run when you try to run a level 1 backup, then RMAN automatically makes a level 0 incremental backup.

To backup a database using RMAN with a level 1 incremental backup, and skipping inaccessible files, you can perform the following:

RMAN> BACKUP
INCREMENTAL LEVEL 1 CUMULATIVE
SKIP INACCESSIBLE
DATABASE;

Further Reading

http://download.oracle.com/docs/cd/B28359_01/backup.111/b28273/rcmsynta007.htm#RCMRF107

Oracle – Recover database to point in time


Recovering an Oracle database involves applying redo logs to roll it forward. You can roll forward to a specific point-in-time, or until the latest transaction.

Point-in-time recovery is only available when the database is in ARCHIVELOG mode.

You can use either SQLPLUS or RMAN when recovering a database:

$ sys '/as sysdba'
SQL> RECOVER DATABASE UNTIL TIME '2011-08-08:16:16:16' USING BACKUP CONTROLFILE;

or

RMAN> run {
SET UNTIL TIME to_date('08-Aug-2011 16:16:16', 'DD-MON-YYYY HH24:MI:SS');
restore database;
recover database;
}

Oracle – ORA-19502, ORA-27072 During RMAN Backup

August 2, 2011 2 comments

While executing and RMAn backup the following error occurs:

channel ORA_DISK_1: starting piece 1 at 17-JUN-10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 06/17/2010 03:27:42
ORA-19502: write error on file "/ocfs2/data07/oracle/oraback/OASSTBY/rman/OASLIVE_20100617_9072_1.rbak", blockno 8842241 (blocksize=8192)
ORA-27072: File I/O error
Linux-x86_64 Error: 9: Bad file descriptor
Additional information: 4
Additional information: 8842241
Additional information: 159744
Recovery Manager complete.

If you review the “disk free” section from the RDA report, the mount point will show as almost full. You can also check this from a df on Linux. The backup will be attempting to write to a larger disk space than is available.

The reason for this error is tha there is not enough disk space on the drive to complete the backup.

To resolve this error, clean up unnecessary files on the disk, or add disk space to the disk then re-run the backup.

Oracle – Create Logical Standby Database 10g RAC


Backup primary database OASLIVE

(If using ASM then you must use RMAN to create the backup)

$ export ORACLE_SID=OASLIVE1
$ rman
RMAN> CONNECT TARGET /
connected to target database: OASLIVE (DBID=3404061247)
RMAN> BACKUP DATABASE FORMAT ‘/c04/oracle/oraback/OASLIVE/rman/OASLIVE_%U.rbak’

Copy control file from primary database for standby

RMAN> COPY CURRENT CONTROLFILE FOR STANDBY TO '/home/oracle/kerri/OASREP.stby';

Copy backup file and control file to standby node (Node11)

$ cd /home/oracle/kerri
$ scp OASREP.stby node11:/home/oracle/.
$ cd /c04/oracle/oraback/OASLIVE/rman/
$ scp OASLIVE_*.rbak node11:/c04/oracle/oraback/OASLIVE/rman/.

Whilst waiting for the backup to copy across, create standby redo logs in the primary database OASLIVE

(Amount of standby logs per thread = no. of redo logs +1)

node 1$ sqlplus ‘/as sysdba’
SQL> SELECT *
FROM v$log;
SQL> SELECT group#
,           thread#
,           sequence#
,           status
FROM v$standby_log;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1('+REPDATA') SIZE 256M;
SQL> /
SQL> /
SQL> /
SQL> /
SQL> SELECT group#
,           thread#
,           sequence#
,           status
FROM v$standby_log;

Copy the server details of the standby node to the primary node tnsnames.ora

node 11$ cd $TNS_ADMIN

Copy the following from OASSTBY tnsnames.ora to OASLIVE tnsnames.ora

OASSTBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgoh-data-11-vip)(PORT = 1511))
(CONNECT_DATA =
(UR=A)
(SERVER = DEDICATED)
(SERVICE_NAME = OASSTBY.dudleygoh-tr.wmids.nhs.uk)
)
)

Log into ASM and delete all pre-existing OASSTBY files

Check that both OASLIVE nodes have sysdba rman privileges if they don’t then run the following:

node 1$ sqlplus ‘/as sysdba’
SQL> GRANT sysdba TO rman;

Create spfile for physical standby using modified pfile

(see appendix A at bottom of post for pfile details)

node 11$ sqlplus ‘/as sysdba’
SQL> STARTUP NOMOUNT PFILE='/home/oracle/kerri/OASSTBYpfile.ora.bkup';
SQL> CREATE SPFILE FROM PFILE='/home/oracle/kerri/OASSTBYpfile.ora.bkup';
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP NOMOUNT

Log into RMAN and recover the standby database

node 11$ rman
RMAN> CONNECT TARGET rman/o45rm4n@OASLIVE
RMAN> CONNECT AUXILIARY rman/o45rm4n@OASSTBY
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY;

Copy the server details of the standby node to the primary node tnsnames.ora

node 11$ cd $TNS_ADMIN

Copy the following from OASREP tnsnames.ora to OASLIVE tnsnames.ora

OASREP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgoh-data-11-vip)(PORT = 1511))
(CONNECT_DATA =
(UR=A)
(SERVER = DEDICATED)
(SERVICE_NAME = OASREP.dudleygoh-tr.wmids.nhs.uk)
)
)

Log into ASM and delete all pre-existing OASREP files

Create spfile for logical standby using modified pfile

(see appendix B for pfile details)

node 11$ sqlplus ‘/as sysdba’
SQL> STARTUP NOMOUNT PFILE='/home/oracle/kerri/OASREPpfile.ora.bkup';
SQL> CREATE SPFILE FROM PFILE='/home/oracle/kerri/OASREPpfile.ora.bkup';
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP NOMOUNT

Log into RMAN and recover the standby database

node 11$ rman
RMAN> CONNECT TARGET rman/o45rm4n@OASLIVE
RMAN> CONNECT AUXILIARY rman/o45rm4n@OASREP
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY;

Copy across the password file to the standby database

$ scp orapwOASLIVE node11:/u01/oracle/ora102/dbs/orapwOASREP

Recover standby database

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Switch logfile on the Primary database

SQL> ALTER SYSTEM SWITCH LOGFILE;

On the standby verify that redo data has been received and applied

SQL> SELECT thread#
,           sequence#
,           name
,   TO_CHAR(first_time, 'dd-mon-yyyy hh24:mi:ss') First_time
,           applied
,           status
FROM v$archived_log
--WHERE applied='YES'
ORDER BY 3;
SQL> SELECT thread#
,           sequence#
,           applied
,           status
FROM v$archived_log
ORDER BY 1;
SQL> SELECT thread#
,       MAX(sequence#)
FROM v$archived_log
GROUP BY thread#;
SQL> SELECT group#
,           thread#
,           sequence#
,           status
FROM v$standby_log;
SQL> SELECT group#
,           thread#
,           sequence#
,           status
FROM v$log;
SQL> SELECT thread#
,    MAX(al.sequence#) Arch
FROM v$archived_log al
GROUP BY thread#;
SQL> SELECT thread#
,    MAX(lh.sequence#) App
FROM v$log_history lh
GROUP BY thread#;

Determine the latest archive redo log on the Primary

SQL> SELECT thread#
,           sequence#
,           Archived
,           Status
FROM v$log;
SQL> SELECT thread#
,           sequence#
,           Archived
,           Status
FROM v$standby_log;

Determine the most recent archive redo log file on the standby

SQL> SELECT thread#
,       max(sequence#)
FROM v$archived_log
GROUP BY thread#;

Determine the most recent archived logfile at each of the archive destinations on the primary.

SQL> SELECT destination
,           status
,           archived_thread#
,           archived_seq#
FROM v$archive_dest_status
WHERE status <> 'DEFFERED'
AND status <> 'INACTIVE';

Determine the most recent received and applied archived logfile at each of the archive destinations on the standby

SQL> SELECT thread#
,           sequence#
,           first_time
,           next_time
,           applied
FROM v$archived_log
ORDER BY thread#,sequence#;

Verify standby logs are created and running correctly on the standby. Invoke an archive log switch on the primary

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
SQL> Select GROUP#
,           THREAD#
,           SEQUENCE#
,           ARCHIVED
,           STATUS
,           BYTES/1048576
FROM v$standby_log;

Stop the apply on the physical standby to make it into a logical standby

SQL> ALTER DATABASE RECOVER MANAGED STANDBY CANCEL;

Find unsupported data types and skip them:

SQL> SELECT owner
,           table_name
FROM dba_logstdby_not_unique
WHERE (owner
,      table_name) NOT IN (SELECT DISTINCT owner, table_name FROM dba_logstdby_unsupported)
AND bad_column = 'Y';

EXECUTE DBMS_LOGSTDBY.SKIP(stmt => 'SCHEMA_DDL',-
schema_name => '<schema_name>', -
object_name => '<object_name>');

EXECUTE DBMS_LOGSTDBY.SKIP('DML','<schema_name>','<object_name>');

Build a dictionary in the redo data on the primary database

SQL> EXECUTE dbms_logstdby.build;

Convert the physical standby to a logical standby

SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY <db_name>;

Create new password file

node 11$ orapw file=$ORACLE_HOME/orapw<db_name> force=y entries=10 password=<password>

Open database

SQL> ALTER DATABASE OPEN RESETLOGS;

Open the logical standby database

SQL> ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Create scripts for reporting database (Optional)

Create a reporting user and their own tablespace on the logical standby

Create a script to refresh the datasets on a nightly basis

#!/bin/bash
export ORACLE_HOME=/u01/oracle/ora102
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=OASREP1
sqlplus '/as sysdba' << EOF
SET SERVEROUPUT ON
SPOOL /home/oracle/kerri/refresh_mviews.lst
SELECT TO_CHAR(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS') FROM DUAL;
EXEC oasis.refresh_mviews_proc;
SELECT TO_CHAR(SYSDATE, 'Dy DD-Mon-YYYY HH24:MI:SS') FROM DUAL;
SPOOL OFF;
EXIT;
EOF

Update the crontab to run at 5am each night

# Refresh Materialized Views on Reporting
00 05 * * * /home/oracle/kerri/refresh_mviews.sh > /home/oracle/kerri/test.txt

Create a trigger for the new user of the logical standby

CREATE OR REPLACE TRIGGER oasdba_LogStbyTrig
AFTER LOGON
ON database
DECLARE
cmmd VARCHAR2(64);
BEGIN
IF user = '<reporting user>' THEN
cmmd:='ALTER session disable guard';
EXECUTE IMMEDIATE cmmd;
INSERT INTO test VALUES(user
,                       SYSDATE
,               TO_CHAR(SYSDATE, 'hh24:mi:ss')
);
END IF;
END;
/

Create a procedure for refreshing materialized views

CREATE OR REPLACE PROCEDURE refresh_mviews_proc IS
CURSOR c1 IS SELECT owner, mview_name FROM dba_mviews;
dbname varchar2(10);
mview varchar2(250);
owner varchar2(250);
snap varchar2(250);
cmmd1 varchar2(64);
cmmd2 varchar2(64);
BEGIN
SELECT name INTO dbname FROM v$database;
cmmd1:='ALTER SESSION DISABLE GUARD';
cmmd2:='ALTER SESSION ENABLE GUARD';
IF dbname='OASREP'
THEN
EXECUTE IMMEDIATE cmmd1;
OPEN c1;
IF c1%ISOPEN THEN
LOOP
FETCH c1 INTO owner, mview;
snap := owner||'.'||mview;
dbms_mview.refresh(''||snap||'','C');
EXIT WHEN c1%NOTFOUND;
END LOOP;
END IF;
EXECUTE IMMEDIATE cmmd2;
END IF;
END;

Appendix A

Physical Standby spfile details for OASSTBY:

OASSTBY1.__db_cache_size=1191182336
OASSTBY.__java_pool_size=16777216
OASSTBY1.__java_pool_size=16777216
OASSTBY.__large_pool_size=16777216
OASSTBY1.__large_pool_size=16777216
OASSTBY.__shared_pool_size=352321536
OASSTBY1.__shared_pool_size=369098752
OASSTBY.__streams_pool_size=0
OASSTBY1.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/OASSTBY/adump'
*.background_dump_dest='/u01/oracle/admin/OASSTBY/bdump'
*.cluster_database=true
*.cluster_database_instances=2
*.compatible='10.2.0.4.0'
*.control_files='+LIVEDATA’
*.core_dump_dest='/u01/oracle/admin/OASSTBY/cdump'
*.db_block_size=8192
*.db_create_file_dest='+LIVEDATA'
*.db_domain='dudleygoh-tr.wmids.nhs.uk'
*.db_file_multiblock_read_count=8
*.db_file_name_convert='OASLIVE','OASSTBY'
*.db_name='OASLIVE'
*.db_unique_name='OASSTBY'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OASSTBYXDB)'
*.fal_client='OASSTBY1'
*.fal_server='OASLIVE1,OASLIVE2'
OASSTBY1.instance_number=1
OASSTBY2.instance_number=2
*.job_queue_processes=1
OASSTBY2.local_listener='LISTENER_OASSTBY2'
OASSTBY1.local_listener='LISTENER_OASSTBY1'
*.log_archive_config='DG_CONFIG=(OASLIVE,OASSTBY,OASREP)'
*.log_archive_dest_1='LOCATION=+LIVEARCH VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=OASSTBY'
*.log_archive_dest_2='SERVICE=OASLIVE VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=OASLIVE'
*.log_archive_dest_3='SERVICE=OASREP LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=OASREP'
*.log_archive_dest_state_2='enable'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=10
*.open_cursors=300
*.pga_aggregate_target=2503999488
*.processes=600
*.remote_listener='LISTENERS_OASSTBY'
*.remote_login_passwordfile='exclusive'
*.sga_target=1610612736
*.standby_file_management='AUTO'
OASSTBY2.thread=2
OASSTBY1.thread=1
*.undo_management='AUTO'
OASSTBY1.undo_tablespace='UNDOTBS1'
OASSTBY2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/oracle/admin/OASSTBY/udump'
*.utl_file_dir='*'

Appendix B

Logical Standby spfile details for OASREP:

OASREP1.__db_cache_size=1073741824
OASREP1.__java_pool_size=33554432
OASREP1.__large_pool_size=16777216
OASREP1.__shared_pool_size=469762048
OASREP1.__streams_pool_size=0
*.archive_lag_target=3600
*.audit_file_dest='/u01/oracle/admin/OASREP/adump'
*.background_dump_dest='/u01/oracle/admin/OASREP/bdump'
*.cluster_database_instances=1
*.cluster_database=FALSE
*.compatible='10.2.0.4.0'
*.control_files='+REPDATA’
*.core_dump_dest='/u01/oracle/admin/OASREP/cdump'
*.db_block_size=8192
*.db_create_file_dest='+REPDATA'
*.db_domain='dudleygoh-tr.wmids.nhs.uk'
*.db_file_multiblock_read_count=8
*.db_file_name_convert='OASLIVE','OASREP'
*.db_name='OASREP'#db_name
*.db_unique_name='OASREP'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OASREPXDB)'
*.fal_client='OASREP1'
*.fal_server='OASLIVE1,OASLIVE2'
OASREP1.instance_number=1
*.job_queue_processes=0
OASREP1.local_listener='LISTENER_OASREP1'
*.log_archive_config='DG_CONFIG=(OASLIVE,OASSTBY,OASREP)'
*.log_archive_dest_1='LOCATION=+LIVEARCH VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=OASREP'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=10
*.open_cursors=300
*.pga_aggregate_target=2503999488
*.processes=600
*.remote_listener='LISTENERS_OASREP'
*.remote_login_passwordfile='exclusive'
*.sga_target=1610612736
*.standby_file_management='AUTO'
OASREP1.thread=1
*.undo_management='AUTO'
OASREP1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/oracle/admin/OASREP/udump'
*.utl_file_dir='*'

Appendix C

Primary Database pfile details for OASLIVE

OASLIVE1.__db_cache_size=989855744
OASLIVE2.__db_cache_size=1291845632
OASLIVE2.__java_pool_size=16777216
OASLIVE1.__java_pool_size=33554432
OASLIVE2.__large_pool_size=16777216
OASLIVE1.__large_pool_size=16777216
OASLIVE1.__shared_pool_size=553648128
OASLIVE2.__shared_pool_size=268435456
OASLIVE2.__streams_pool_size=0
OASLIVE1.__streams_pool_size=0
*.archive_lag_target=900
*.audit_file_dest='/u01/oracle/admin/OASLIVE/adump'
*.background_dump_dest='/u01/oracle/admin/OASLIVE/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.4.0'
*.control_files='+LIVEDATA/oaslive/controlfile/current.289.724539179','+LIVEARCH/oaslive/controlfile/current.3794.724539179'
*.core_dump_dest='/u01/oracle/admin/OASLIVE/cdump'
*.db_block_size=8192
*.db_create_file_dest='+LIVEDATA'
*.db_domain='dudleygoh-tr.wmids.nhs.uk'
*.db_file_multiblock_read_count=8
*.db_name='OASLIVE'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OASLIVEXDB)'
*.fal_client='OASLIVE1,OASLIVE2'
*.fal_server='OASSTBY'
OASLIVE1.instance_number=1
OASLIVE2.instance_number=2
*.job_queue_processes=1
OASLIVE2.local_listener='LISTENER_OASLIVE2'
OASLIVE1.local_listener='LISTENER_OASLIVE1'
*.log_archive_config='DG_CONFIG=(OASLIVE,OASSTBY,OASREP)'
*.log_archive_dest_1='LOCATION=+LIVEARCH VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=OASLIVE'
*.log_archive_dest_2='SERVICE=OASSTBY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=OASSTBY'
*.log_archive_dest_3='SERVICE=OASREP LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=OASREP'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_dest_state_3='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=10
*.open_cursors=300
*.pga_aggregate_target=2503999488
*.processes=600
*.remote_listener='LISTENERS_OASLIVE'
*.remote_login_passwordfile='exclusive'
*.sga_target=1610612736
*.standby_file_management='AUTO'
OASLIVE2.thread=2
OASLIVE1.thread=1
*.undo_management='AUTO'
OASLIVE1.undo_tablespace='UNDOTBS1'
OASLIVE2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/oracle/admin/OASLIVE/udump'
*.utl_file_dir='*'

Oracle – RMAN Retention Policy


The RMAN retention policy doesn’t just keep the amount of days specified. It calculates the interval from the end of the current time and extends back in time for the number of days specifed.

So for example if you set the backup retention policy to 1 day today. Then RMAN will keep the backups for 15th July, 16th July.
Then on the 17th July, the 15th July backup will be obsolete.

I.e.

RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAY;

Current date  Status                        Recovery Point
------------  ------                        --------------
15th July     available                     15-1 = 14th July
16th July     available                     16-1 = 15th July
17th July     backup of 15th July obsolete  17-1 = 16th July

So your backup for today wouldn’t be marked as obsolete until the 17th July.

5 Configuring the RMAN Environment

However, if you have a fixed-date database then you should be setting the retention policy to redundancy instead of recovery window.

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;