How To Take Backup Through RMAN
1. Create a tablespace for storing recovery catalog information in recovery catalog database.
SQL> create tablespace rman datafile ‘/u01/app/oracle/oradata/TEST/rman01.dbf’ size 100m;
Tablespace created.
2. Create a user for recovery catalog and assign a tablespace and resources to that user.
SQL> create user ashu identified by ashu123 default tablespace rman quota unlimited on rman;
User created.
SQL> grant connect, resource, recovery_catalog_owner to ashu;
Grant succeeded.
3. Connect rman to target database. Go to Linux command prompt $
[oracle@noida ~]$ rman target/
Recovery Manager: Release 11.2.0.1.0 – Production on Wed Sep 25 21:48:56 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST (DBID=2111598425)
4. Connect user to catalog database.
RMAN> connect catalog ashu/ashu123;
connected to recovery catalog database
5. Create recovery catalog.
RMAN> create catalog;
recovery catalog created
6. Register database.
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
7. We can get information about schema.
RMAN> report schema;
Report of database schema for database with db_unique_name TEST
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 670 SYSTEM YES /u01/app/oracle/oradata/TEST/system01.dbf
2 490 SYSAUX NO /u01/app/oracle/oradata/TEST/sysaux01.dbf
3 45 UNDOTBS1 YES /u01/app/oracle/oradata/TEST/undotbs01.dbf
4 5 USERS NO /u01/app/oracle/oradata/TEST/users01.dbf
5 200 SYSTEM YES /u01/app/oracle/oradata/TEST/system02.dbf
6 100 RMAN NO /u01/app/oracle/oradata/TEST/rman01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
—- ——– ——————– ———– ——————–
1 20 TEMP 32767 /u01/app/oracle/oradata/TEST/temp01.dbf
8. Run backup comman to take backup (%t for time, %s for sequence number, %p for piece number).
run
{
allocate channel c1 type disk
format’/u01/app/oracle/oradata/TEST/backup_dir/test_full_%t_%s_%p.bkp’;
backup database plus archivelog;
}
allocated channel: c1
channel c1: SID=36 device type=DISK
Starting backup at 25-SEP-13
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=813452259
input archived log thread=1 sequence=3 RECID=2 STAMP=813496334
input archived log thread=1 sequence=4 RECID=3 STAMP=813582899
input archived log thread=1 sequence=5 RECID=4 STAMP=813587494
input archived log thread=1 sequence=6 RECID=5 STAMP=813588624
input archived log thread=1 sequence=7 RECID=6 STAMP=813588627
input archived log thread=1 sequence=8 RECID=7 STAMP=813611211
input archived log thread=1 sequence=9 RECID=8 STAMP=813611213
input archived log thread=1 sequence=10 RECID=9 STAMP=813622195
input archived log thread=1 sequence=11 RECID=10 STAMP=813677118
input archived log thread=1 sequence=12 RECID=11 STAMP=813677119
input archived log thread=1 sequence=13 RECID=12 STAMP=814010314
input archived log thread=1 sequence=14 RECID=13 STAMP=814010316
input archived log thread=1 sequence=15 RECID=14 STAMP=814041768
input archived log thread=1 sequence=16 RECID=15 STAMP=814041770
input archived log thread=1 sequence=17 RECID=16 STAMP=814094564
input archived log thread=1 sequence=18 RECID=17 STAMP=814094565
input archived log thread=1 sequence=19 RECID=18 STAMP=814731338
input archived log thread=1 sequence=20 RECID=19 STAMP=814731340
input archived log thread=1 sequence=21 RECID=20 STAMP=816356166
input archived log thread=1 sequence=22 RECID=21 STAMP=816356167
input archived log thread=1 sequence=23 RECID=22 STAMP=825976266
input archived log thread=1 sequence=24 RECID=23 STAMP=825976267
input archived log thread=1 sequence=25 RECID=24 STAMP=825979501
input archived log thread=1 sequence=26 RECID=25 STAMP=827097501
input archived log thread=1 sequence=27 RECID=26 STAMP=827097504
input archived log thread=1 sequence=28 RECID=27 STAMP=827100100
input archived log thread=1 sequence=29 RECID=28 STAMP=827100276
channel c1: starting piece 1 at 25-SEP-13
channel c1: finished piece 1 at 25-SEP-13
piece handle=/u01/app/oracle/oradata/TEST/backup_dir/test_full_827100279_1_1.bkp tag=TAG20130925T220438 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:35
Finished backup at 25-SEP-13
Starting backup at 25-SEP-13
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=30 RECID=29 STAMP=827100427
channel c1: starting piece 1 at 25-SEP-13
channel c1: finished piece 1 at 25-SEP-13
piece handle=/u01/app/oracle/oradata/TEST/backup_dir/test_full_827100430_4_1.bkp tag=TAG20130925T220710 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-SEP-13
released channel: c1
9. List backup summary
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
——- — — – ———– ————— ——- ——- ———- —
99 B A A DISK 25-SEP-13 1 1 NO TAG20130925T220438
100 B F A DISK 25-SEP-13 1 1 NO TAG20130925T220515
101 B F A DISK 25-SEP-13 1 1 NO TAG20130925T220515
152 B A A DISK 25-SEP-13 1 1 NO TAG20130925T220710
10. If you want to list of all backups.
RMAN> list backup;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— —————
99 278.32M DISK 00:00:35 25-SEP-13
BP Key: 103 Status: AVAILABLE Compressed: NO Tag: TAG20130925T220438
Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100279_1_1.bkp
List of Archived Logs in backup set 99
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——— ———- ———
1 2 757371 22-APR-13 768126 22-APR-13
1 3 768126 22-APR-13 792227 23-APR-13
1 4 792227 23-APR-13 815800 24-APR-13
1 5 815800 24-APR-13 819378 24-APR-13
1 6 819378 24-APR-13 820741 24-APR-13
1 7 820741 24-APR-13 820851 24-APR-13
1 8 820851 24-APR-13 854644 24-APR-13
1 9 854644 24-APR-13 854667 24-APR-13
1 10 854667 24-APR-13 870786 24-APR-13
1 11 870786 24-APR-13 895744 25-APR-13
1 12 895744 25-APR-13 895752 25-APR-13
1 13 895752 25-APR-13 922523 29-APR-13
1 14 922523 29-APR-13 922548 29-APR-13
1 15 922548 29-APR-13 940297 29-APR-13
1 16 940297 29-APR-13 940305 29-APR-13
1 17 940305 29-APR-13 943672 30-APR-13
1 18 943672 30-APR-13 943679 30-APR-13
1 19 943679 30-APR-13 980395 06-MAY-13
1 20 980395 06-MAY-13 980403 06-MAY-13
1 21 980403 06-MAY-13 986383 25-MAY-13
1 22 986383 25-MAY-13 986390 25-MAY-13
1 23 986390 25-MAY-13 987562 12-SEP-13
1 24 987562 12-SEP-13 987569 12-SEP-13
1 25 987569 12-SEP-13 997911 12-SEP-13
1 26 997911 12-SEP-13 997975 25-SEP-13
1 27 997975 25-SEP-13 997982 25-SEP-13
1 28 997982 25-SEP-13 1009198 25-SEP-13
1 29 1009198 25-SEP-13 1009417 25-SEP-13
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
100 Full 991.45M DISK 00:01:36 25-SEP-13
BP Key: 104 Status: AVAILABLE Compressed: NO Tag: TAG20130925T220515
Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100316_2_1.bkp
List of Datafiles in backup set 100
File LV Type Ckp SCN Ckp Time Name
—- — —- ———- ——— —-
1 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/system01.dbf
2 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/sysaux01.dbf
3 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/undotbs01.dbf
4 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/users01.dbf
5 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/system02.dbf
6 Full 1009486 25-SEP-13 /u01/app/oracle/oradata/TEST/rman01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
101 Full 9.36M DISK 00:00:03 25-SEP-13
BP Key: 105 Status: AVAILABLE Compressed: NO Tag: TAG20130925T220515
Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100422_3_1.bkp
SPFILE Included: Modification time: 25-SEP-13
SPFILE db_unique_name: TEST
Control File Included: Ckp SCN: 1009579 Ckp time: 25-SEP-13
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— —————
152 109.00K DISK 00:00:00 25-SEP-13
BP Key: 155 Status: AVAILABLE Compressed: NO Tag: TAG20130925T220710
Piece Name: /u01/app/oracle/oradata/TEST/backup_dir/test_full_827100430_4_1.bkp
List of Archived Logs in backup set 152
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——— ———- ———
1 30 1009417 25-SEP-13 1009588 25-SEP-13