Thursday, April 9, 2020

RMAN COMMANDS

t will be run in the database, not the catalog.

Login as sysdba –

This script will report on all backups – full, incremental and archivelog backups –

col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;
This script will report all on full and incremental backups, not archivelog backups –

col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
order by session_key;



3.
You can also check historical backup status with the help of following script:

set linesize 500 pagesize 2000
col Hours format 9999.99
col STATUS format a10
select SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm-dd-yyyy hh24:mi:ss') as RMAN_Bkup_start_time,
to_char(END_TIME,'mm-dd-yyyy hh24:mi:ss') as RMAN_Bkup_end_time,
elapsed_seconds/3600 Hours from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

4.
This script will report on all currently running RMAN backups like full, incremental & archivelog backups:

col STATUS format a9
col hrs format 999.99

select SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi') end_time,
elapsed_seconds/3600 hrs from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

6.

RMAN> backup validate datafile 8;
backup validate database;---THIS ONE IS COMPLETE.
backup validate archivelog all;
backup validate spfile;
backup validate current control file;
list backup
sql>show parameter DB_RECOVERY_FILE_DEST
RMAN> VALIDATE DATABASE;----

To check backup of the control file, use the following command:

RMAN> restore control file validate;

To check backup of the spfile, use the following command:

RMAN> restore spfile validate;

To check backup of tablespace users, use the following command:

RMAN> restore tablespace users validate;

To check backup of a datafile, use the following command:

RMAN> restore datafile 4 validate;

To check backup of all archived redo log files, use the following command:

RMAN> restore archivelog all validate;

RMAN> validate backupset 2;
RMAN> validate spfile
------------
 RMAN> run
{
allocate channel c1 devide type disk;
allocate channel c2 devide type disk;
allocate channel c3 devide type disk;
validate database section size 300m;
}
------------

rman target/

Validate RMAN Backup
**********************

Use BACKUP VALIDATE command to validate backup files:

The command for only physical corruption check:

RMAN> BACKUP VALIDATE
DATABASE
ARCHIVELOG ALL;

The command for the physical and logical corruption check:

RMAN> BACKUP VALIDATE
CHECK LOGICAL
DATABASE
ARCHIVELOG ALL;

RMAN> BACKUP VALIDATE DATABASE;

RESTORE DATABASE PREVIEW ;
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG FROM sequence xx UNTIL SEQUENCE yy THREAD nn VALIDATE;
RESTORE CONTROLFILE VALIDATE;
RESTORE SPFILE VALIDATE;

http://reneantunez.blogspot.com/2012/09/rman-how-to-verify-i-have-consistant.html



888888888

Use RESTORE command to validate backup:

RMAN> RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG ALL VALIDATE;

RMAN> RESTORE DATABASE PREVIEW;

https://www.softwaretestinghelp.com/testing-oracle-database-backups/

https://oracleracdba1.wordpress.com/2012/10/22/how-to-checkvalidate-that-rman-backups-are-good/

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

RMAN Delete Command

To delete all backups for the target database use:
RMAN> DELETE BACKUP;

Delete Backupset
To delete a backup set specify the set number e.g. 23:
RMAN> DELETE BACKUPSET 23;


NOPROMPT keyword
By default the DELETE command will prompt for confirmation before deleting any backup files
Do you really want to delete the above objects (enter YES or NO)?
To suppress the prompt specify the NOPROMPT keyword. For example:
RMAN> DELETE NOPROMPT BACKUP;


Image Copies
To delete all datafile copies:
RMAN> DELETE DATAFILECOPY ALL;

To delete an individual datafile copy use:
RMAN> DELETE DATAFILECOPY <key>;
RMAN> DELETE DATAFILECOPY 26;
Alternatively specify the datafile image copy name. For example:
RMAN> DELETE DATAFILECOPY '/u01/app/oracle/copy/users01.dbf';


To delete a specific controlfile copy use:

RMAN> DELETE CONTROLFILECOPY <key>;
For example:
RMAN> DELETE CONTROLFILECOPY 20;
Alternatively specify the control file copy name e.g.:
RMAN> DELETE CONTROLFILECOPY '/u01/app/oracle/copy/cf_D-TEST_id-2066695660_1tqek8bd';


To delete all backups of the USERS tablespace use:
RMAN> DELETE BACKUP OF TABLESPACE USERS;


Expired Backups
To delete any expired backups detected by the CROSSCHECK command use:
RMAN> DELETE EXPIRED BACKUP;
To delete all expired archive logs detected by the CROSSCHECK command use:
RMAN> DELETE EXPIRED ARCHIVELOG ALL;


Obsolete Backups
To delete backups that have become obsolete based on the retention policy.
RMAN> DELETE OBSOLETE;

No comments:

Post a Comment

[ERROR]: The value of s_patch_service_name is not set correctly in atleast one of the context files.

[ERROR]: The value of s_patch_service_name is not set correctly in atleast one of the context files. I got the issue below wh...