Monday , September 25 2017
Home / Oracle DBA / Compressed Backups

Compressed Backups

1.Compressed Backups

RMAN has been enhanced to provide binary compression for backup sets, reducing the amount of disk space required to make a backup. In many cases, the additional overhead required to compress the backup set is offset by the reduced I/O load when writing the backup set to disk. In addition, the binary compression algorithm used by RMAN is optimized for use with oracle datafiles, making it a better alternative than using operation system file system or tape device compression schemes.

RMAN> BACKUP AS COMPRESSED BACKUPSET TABLESPACE users2;

This example backs up the entire database and archived logs, producing compressed backupsets:

RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;

2.Configuring Compressed Backupsets as Default for Tape or Disk

It’s easy to make compression the default for disk or tape using the CONFIGURE command.

RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET; RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;

3.Image Copies

An image copy is a bit-for-bit identical copy of a database file. In previous versions of RMAN, the COPY command made image copies of datafiles. COPY command is deprecated in oracle 10g’s version. RMAN can create image copies of datafiles and datafile copies, control files and control file copies, archived redo logs, and backup pieces. RMAN creates image copies when the AS COPY option is used with the BACKUP command.

Using BACKUP AS COPY command to make an image copy of both SYSTEM and SYSAUX tablespaces.

RMAN> BACKUP AS COPY TABLESPACE system, sysaux;

4.Drop Database in RMAN

Deletes the target database and, if RMAN is connected to a recovery catalog, unregisters it. RMAN removes all datafiles, online logs, and control files belonging to the target database.
Restriction

  • Execute this command only at the RMAN prompt.
  • You must be connected to the target database, which must either mounted exclusive and not open.
  • If you want RMAN to delete archived logs, copies, and backups belonging to the database, then you must use the DROP DATABASE INCLUDING BACKUPS form of the command.In this example you connect to test1 database and delete the database files as well as all backup copies, and archived logs associated with the database:

$rman TARGET sys/sys_pwd@ORCL catalog rman/rman@catdb
RMAN> DROP DATABASE INCLUDING BACKUPS;

5.Incrementally Updated Backups: Rolling Forward Image Copy Backups

Oracle’s incrementally Updated Backups feature lets you avoid the overhead of taking full image copy backups of data files, which providing the same recovery advantages as image copy backups. at the beginning of a backup strategy, RMAN creates an image copy backup of the data file. Then, at regular intervals, such as daily, level 1 incremental backups are taken, and applied to the image copy backup, rolling it forward to the point in time when the level 1 incremental was created. During restore and recovery of the database, RMAN can restore from this incrementally updated copy and then apply changes from the redo log, with the same results as restoring the database from a full backup taken at the SCN of the most recently applied incremental level 1 backup. A backup strategy based on incrementally updated backups can help minimize time required for media recovery of you DB.
10. RMAN Recovery catalog views

Recovery catalog views                                  Corresponding V$Views RC_ARCHIVED_LOGS                                   V$ARCHIVED_LOG RC_BACKUP_CONTROL FILE                     V$ BACKUP_CONTROL FILE RC_BACKUP_DATA FILE                               V$ BACKUP_DATA FILE RC_BACKUP_PIECE                                         V$BACKUP_PIECE RC_BACKUP_REDO LOG                                  V$ BACKUP_REDO LOG RC_BACKUP_SET                                                V$ BACKUP_SET RC_DATABASE                                                     V$DATABASE RC_DATA FILE V$DATA FILE RC_RMAN_CONFIGURATION                      V$RMAN_CONFIGURATION RC_LOG_HISTORY                                            V$ LOG_HISTORY

LAB SESSION

SYS@dev>>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination           /disk1/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence     14
Next log sequence to archive   16
Current log sequence           16
SYS@dev>>show parameter spfile

NAME                                 TYPE       VALUE

———————————— ———– ——————————

spfile                               string     /disk1/app/oracle/product/11.2

.0/dbhome_1/dbs/spfiledev.ora
SYS@dev>>alter system set log_archive_dest=/disk1/dev/arch;
alter system set log_archive_dest=/disk1/dev/arch
*
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM
SYS@dev>>alter system set log_archive_dest=’/disk1/dev/arch’;
alter system set log_archive_dest=/disk1/dev/arch
*
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM

SYS@dev>>alter system set log_archive_dest=’/disk1/dev/arch’;

System altered.

SYS@dev>>archive log list
Database log mode             Archive Mode
Automatic archival             Enabled
Archive destination           /disk1/dev/arch
Oldest online log sequence     14
Next log sequence to archive   16
Current log sequence           16
SYS@dev>>alter system switch log file;

System altered.

SYS@dev>>/
System altered.

SYS@dev>>/
System altered.

SYS@dev>>archive log list
Database log mode             Archive Mode
Automatic archival             Enabled
Archive destination           /disk1/dev/arch
Oldest online log sequence     17
Next log sequence to archive   19
Current log sequence           19

SYS@dev>>exit
$cd $ORACLE_HOME/network/admin
$vi listener.ora
dev =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = appsinc5.ora.com)(PORT = 1539))
)
)
SID_LIST_dev=
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /disk1/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = dev)
)
)

ADR_BASE_dev = /disk1/app/oracle
:wq!
$lsnrctl start dev
$cd $ORACLE_HOME/dbs
$orapwd file=orapwdev password=sys force=y

#########################CATALOG DATABASE SIDE##############################

$export ORACLE_SID=prani
$sqlplus / as sysdba
SYS@prani>>startup
ORACLE instance started.

Total System Global Area 146472960 bytes
Fixed Size                 1335080 bytes
Variable Size             92274904 bytes
Database Buffers           50331648 bytes
Redo Buffers               2531328 bytes
Database mounted.
Database opened.
SYS@prani>>
SYS@prani>>grant connect,resource,recovery_catalog_owner to sasi identified by sasi;

Grant succeeded.

SYS@prani>>create tablespace tsasi datafile ‘/disk1/prani/tsasi.dbf’ size 50m;
Tablespace created.

SYS@prani>>alter user sasi default tablespace tsasi;

User altered.

GOTO—->HOST

$cd $ORACLE_HOME/dbs
$vi tnsnames.ora
dev_s =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =appsinc5.ora.com)(PORT = 1539))
)
(CONNECT_DATA =
(SERVICE_NAME = dev)
)
)
:wq!
$tnsping dev_s
[oracle@idba154 admin]$ rman catalog sasi/sasi

Recovery Manager: Release 11.2.0.1.0 – Production on Thu Dec 27 15:46:30 2012

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

connected to recovery catalog database

RMAN> create catalog;

recovery catalog created
RMAN>exit
[oracle@idba154 admin]$ rman catalog sasi/sasi target sys/sys@dev_s

Recovery Manager: Release 11.2.0.1.0 – Production on Thu Dec 27 15:53:51 2012

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

connected to target database: DEV (DBID=3880803650)
connected to recovery catalog database
RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> show all;

RMAN configuration parameters for database with db_unique_name DEV are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/disk1/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_dev.f’; # default
RMAN> spool log to rman.sql
RMAN> show all;
RMAN> exit
[oracle@idba154 ~]$ vi rman.sql

CONFIGURE RETENTION POLICY TO REDUNDANCY 2; # default
CONFIGURE BACKUP OPTIMIZATION ON; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘/disk1/rbkp/rman_%F.ctl’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATA FILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVE LOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT ‘/disk1/rbkp/rman_%U.dbf’;
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT ‘/disk1/rbkp/rman_%U.dbf’;
CONFIGURE MAXSET SIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVE LOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROL FILE NAME TO ‘/disk1/rbkp/snapcf_dev.f’; # default

:wq!
e@idba154 ~]$ rman catalog sasi/sasi target sys/sys@dev_s

RMAN> @rman.sql

RMAN> exit
[oracle@idba154 ~]$ rman catalog sasi/sasi target sys/sys@dev_s

RMAN> backup database plus archivelog;
RMAN> list backup summary;
List of Backups

===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag

——- — — – ———– ————— ——- ——- ———- —

222     B A A DISK       27-DEC-12       1       1       NO         TAG20121227T165601

223     B F A DISK       27-DEC-12       1       1       NO         TAG20121227T165603

224     B F A DISK       27-DEC-12       1       1       NO         TAG20121227T165603

248     B A A DISK       27-DEC-12       1       1       NO         TAG20121227T165812

259     B F A DISK       27-DEC-12       1       1       NO         TAG20121227T165815

Read More:
Recovery Manager
Backup & Recovery Scenario
Oracle database Hot Backups

Comments

comments

Check Also

How to switch on primary database to physical standby database

After configuration data guard then data is switching  into primary database  to standby database : …

Leave a Reply

Your email address will not be published. Required fields are marked *