Thursday, 22 October 2015

Backup whole database in oracle 11g


Check the datafiles present in database

RMAN> report schema;

Report of database schema for database with db_unique_name TESTDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     +DATA/testdb/datafile/system.256.892594189
2    530      SYSAUX               ***     +DATA/testdb/datafile/sysaux.257.892594189
3    55        UNDOTBS1          ***     +DATA/testdb/datafile/undotbs1.258.892594189
4    100      USERS                  ***     +DATA/testdb/datafile/users.259.892594189

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       +DATA/testdb/tempfile/temp.268.892594713

RMAN> 

Take the backup of database. 

Note that the RMAN takes the backup of datafiles in decreasing order of its size. Also, the temp tablespace is not include in the backup strategy.

[oracle@oel6 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Oct 22 22:18:07 2015

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

connected to target database: TESTDB (DBID=2675922698)

RMAN> backup database;

Starting backup at 22-OCT-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 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=+DATA/testdb/datafile/system.256.892594189
input datafile file number=00002 name=+DATA/testdb/datafile/sysaux.257.892594189
input datafile file number=00004 name=+DATA/testdb/datafile/users.259.892594189
input datafile file number=00003 name=+DATA/testdb/datafile/undotbs1.258.892594189
channel ORA_DISK_1: starting piece 1 at 22-OCT-15
channel ORA_DISK_1: finished piece 1 at 22-OCT-15
piece handle=/u01/app/backup/TESTDB_63_%1.bak tag=TAG20151022T221825 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01: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 22-OCT-15
channel ORA_DISK_1: finished piece 1 at 22-OCT-15
piece handle=/u01/app/backup/TESTDB_64_%1.bak tag=TAG20151022T221825 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 22-OCT-15

RMAN>

Backup of controlfile and spfile is always included in a full database backup.

Use the below command to list the available backups of database.

RMAN> list backup;

using target database control file instead of recovery catalog

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


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
61      Full    1.01G      DISK        00:01:34     22-OCT-15      
        BP Key: 61   Status: AVAILABLE  Compressed: NO  Tag: TAG20151022T221825
        Piece Name: /u01/app/backup/TESTDB_63_%1.bak
  List of Datafiles in backup set 61
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1031184    22-OCT-15 +DATA/testdb/datafile/system.256.892594189
  2       Full 1031184    22-OCT-15 +DATA/testdb/datafile/sysaux.257.892594189
  3       Full 1031184    22-OCT-15 +DATA/testdb/datafile/undotbs1.258.892594189
  4       Full 1031184    22-OCT-15 +DATA/testdb/datafile/users.259.892594189

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
62      Full    9.55M      DISK        00:00:17     22-OCT-15      
        BP Key: 62   Status: AVAILABLE  Compressed: NO  Tag: TAG20151022T221825
        Piece Name: /u01/app/backup/TESTDB_64_%1.bak
  SPFILE Included: Modification time: 22-OCT-15
  SPFILE db_unique_name: TESTDB
  Control File Included: Ckp SCN: 1031225      Ckp time: 22-OCT-15

RMAN> 


No comments:

Post a Comment