среда, 24 августа 2016 г.

LIST, REPORT, and DELETE Commands in RMAN


The LIST, REPORT, and DELETE Commands in RMAN
List Command:
The LIST command uses RMAN repository information and provide lists of backups, archived logs, and database incarnations.

Output of LIST command can be filtered BY BACKUP and BY FILE option.

1)RMAN> list backup; #List all your backup sets.
2)RMAN>LIST BACKUPSET; #Lists only backup sets and proxy copies.
3)RMAN>LIST COPY; #Lists of Image copies and Archive Logs.
4)RMAN>LIST EXPIRED BACKUP; #Backups did not found after crosscheck. That is backup is manually moved or deleted from OS.
5)RMAN>LIST BACKUP BY FILE; #List backup by Datafile, controlfile, spfile.
6)RMAN>LIST BACKUP SUMMARY; #Lists backup sets, proxy copies, and disk copies.
7)LIST BACKUP OF DATABASE; LIST BACKUP LIKE '/tmp/%'; list backup of datafile 1; LIST ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;LIST COPY OF DATAFILE 2 COMPLETED BETWEEN '17-MAR-2008' AND '22-MAR-2008'; are also available.
8) LIST INCARNATION; LIST INCARNATION OF DATABASE; to see the incarnations of your database.

Report Command:
RMAN REPORT command analyzes the available backups and return results about while files need backup which files are obsolete etc.

Remember the result of REPORT command is based on repository data. So, if backups have been deleted from disk or tape outside of RMAN, reports generated by RMAN do not automatically reflect these changes.

So before report it is good to run CROSSCHECK of all backup in order to update repository.

1)REPORT NEED BACKUP; # Determine which database files need backup under a specific retention policy.

2)REPORT UNRECOVERABLE; #Report which database files require backup because they have been affected by some NOLOGGING operation.

3)REPORT SCHEMA; #Lists and displays information about the database files.

4)REPORT OBSOLETE; #REPORT OBSOLETE displays the backups that are obsolete according to the current retention policy.

5)REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE SKIP TABLESPACE data01;

If you use Recovery Catalog then past data can be shown.
Like, REPORT SCHEMA AT TIME 'SYSDATE-10';


Delete Command:
Delete commands is used to delete any backup or backupsets.
1)Delete all your backup sets RMAN> delete backupset all;
2)Delete all image copies. RMAN> delete copy all;
3)Delete obsolete Backups. RMAN>DELETE OBSOLETE;
4)Delete backup using BP Key from LIST output.
RMAN> list backup;


List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1       391.11M    DISK        00:00:24     25-SEP-11
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20110925T140027
        Piece Name: E:\01MNEFNS_1_1

  List of Archived Logs in backup set 1
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    114     4715501    08-SEP-11 4725766    08-SEP-11
  1    115     4725766    08-SEP-11 4737735    08-SEP-11
  1    116     4737735    08-SEP-11 4747351    08-SEP-11
  1    117     4747351    08-SEP-11 4753345    08-SEP-11
  1    118     4753345    08-SEP-11 4784439    11-SEP-11
  1    119     4784439    11-SEP-11 4814646    11-SEP-11
  1    120     4814646    11-SEP-11 4908843    12-SEP-11
  1    121     4908843    12-SEP-11 5000884    12-SEP-11
  1    122     5000884    12-SEP-11 5020912    13-SEP-11
  1    123     5020912    13-SEP-11 5057538    14-SEP-11
  1    124     5057538    14-SEP-11 5078712    25-SEP-11
  1    125     5078712    25-SEP-11 5079309    25-SEP-11
  1    126     5079309    25-SEP-11 5079467    25-SEP-11

RMAN> delete backuppiece 1;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   AVAILABLE   DISK        E:\01MNEFNS_1_1
Do you really want to delete the above objects (enter YES or NO)?

5) Delete backups by filename on disk: DELETE CONTROLFILECOPY '/tmp/ctl01.ctl';

6) Delete archive logs from disk based on sequence: DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 5;

7) Delete backups based on tags: DELETE BACKUP TAG='special_tag';

8) Delete expired RMAN backup using CROSSCHECK
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;

9) Delete obsolete RMAN backups. DELETE OBSOLETE;
You can also use the REDUNDANCY or RECOVERY WINDOW clauses with DELETE to delete backups obsolete under a specific retention policy instead of the configured default:

For example:
DELETE OBSOLETE REDUNDANCY = 2;
DELETE OBSOLETE RECOVERY WINDOW OF 4 DAYS;

Oracle Backup

     1.  Steps to configure Fast Recovery Area (FRA)

SQL> set ORACLE_SID=<ORACLE_SID_NAME> (this command not required if there is only one DB running on the server)
SQL> alter system set db_recovery_file_dest_size = 100G scope=both; (depends on the Disk space available)
SQL> alter system set db_recovery_file_deste = 'd:\fast_recovery_area' scope=both; (d:\fast_recovery_area must be created)

     2.  Steps to configure ARCHIVELOG mode

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL> alter database flashback on;
SQL> alter database open;
SQL> archive log list;
SQL> alter system switch logfile; (this will create the archive log files in FRA)

     3. Steps to configure RMAN parameters;

C:\> rman target /
RMAN> show all;
RMAN> configure retention policy to recovery window of 3 days; (you can specify 3 or 7 days as per the policy)
RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;

RMAN> show all;

Oracle Backup

     1.  Steps to configure Fast Recovery Area (FRA)

SQL> set ORACLE_SID=<ORACLE_SID_NAME> (this command not required if there is only one DB running on the server)
SQL> alter system set db_recovery_file_dest_size = 100G scope=both; (depends on the Disk space available)
SQL> alter system set db_recovery_file_deste = 'd:\fast_recovery_area' scope=both; (d:\fast_recovery_area must be created)

     2.  Steps to configure ARCHIVELOG mode

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL> alter database flashback on;
SQL> alter database open;
SQL> archive log list;
SQL> alter system switch logfile; (this will create the archive log files in FRA)

     3. Steps to configure RMAN parameters;

C:\> rman target /
RMAN> show all;
RMAN> configure retention policy to recovery window of 3 days; (you can specify 3 or 7 days as per the policy)
RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;

RMAN> show all;

Oracle UTF-8

Hello,

Most of times when we deployed our projects in some Cyrillic supported country we meet with problem to display properly. Thats why I am posting this solution here may be it saved your time.

Do not hesitate  to commenting :)

1) Enter from sqlplus / as sysdba
2)shutdown immediate

Database closed.
Database dismounted.
ORACLE instance shut down.
3) startup restrict
ORACLE instance started.

Total System Global Area 2.0602E+10 bytes
Fixed Size                  3842760 bytes
Variable Size            2751466808 bytes
Database Buffers         1.7784E+10 bytes
Redo Buffers               63262720 bytes
Database mounted.
Database opened.

4)alter database character set INTERNAL_USE AL32UTF8;

Database altered.

5)alter database character set AL32UTF8;

Database altered.

6) shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
7) startup
ORACLE instance started.

Total System Global Area 2.0602E+10 bytes
Fixed Size                  3842760 bytes
Variable Size            2751466808 bytes
Database Buffers         1.7784E+10 bytes
Redo Buffers               63262720 bytes
Database mounted.
Database opened.

Общее·количество·просмотров·страницы