Friday, July 18, 2014

RMAN Commands List

RMAN Commands List

--To Connect in rman tool
rman target/
[oracle@]$ rman target/

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jul 19 01:20:04 2014

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: CRMPRD (DBID=382866142)

-- Check the RMAN configuration
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters 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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/db_1/dbs/snapcf_sync.f'; # default

--To check backup detail  :
RMAN> list backup;

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    163.90M    DISK        00:00:28     07-JUL-14    
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20140707T003026
        Piece Name: /shared/sync/backup/07july/0epcokp2_1_1.bkp
  List of Datafiles in backup set 11
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 716451     07-JUL-14 /shared/sync/data/undo01.dbf
  7       Full 716451     07-JUL-14 /shared/sync/data/system04.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    290.83M    DISK        00:00:32     07-JUL-14    
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20140707T003026
        Piece Name: /shared/sync/backup/07july/0dpcokp2_1_1.bkp

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
11      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
12      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
13      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
14      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
15      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
16      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T003026
17      B  F  A DISK        07-JUL-14       1       1       NO         TAG20140707T004125
18      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
19      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
20      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
21      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
22      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
23      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T071838
24      B  F  A DISK        13-JUL-14       1       1       NO         TAG20140713T115629
25      B  F  A DISK        14-JUL-14       1       1       NO         TAG20140714T021344
26      B  F  A DISK        18-JUL-14       1       1       NO         TAG20140718T091235

-- To check datafile details via rman
RMAN> report schema;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    325      SYSTEM               ***     /shared/sync/data/system01.dbf
2    200      UNDOTBS              ***     /shared/sync/data/undo01.dbf
3    400      SYSAUX               ***     /shared/sync/data/sysaux01.dbf
4    200      TBS_1                ***     /shared/sync/data/users.dbf
5    4096     USERS                ***     /shared/sync/data/users01.dbf
6    4096     USERS                ***     /shared/sync/data/users02.dbf
7    500      SYSTEM               ***     /shared/sync/data/system04.dbf
8    2048     TMP                  ***     /shared/sync/data/tmp.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMPTS1              20          /shared/sync/data/temp_tbs.dbf
2    1024     TEMP                 1024        /shared/sync/data/temp01.dbf

Retention poilcy command
For all your daily backups maintain a normal retention policy i.e
Rman > configure retention policy for recovery window of 35 days

--- Taking full db backup if db is no archive mode please run it from mount state.
Backup Commands

run
{
allocate channel d1 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d2 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d3 device type disk format '/shared/sync/backup/07july/%U.bkp';
allocate channel d4 device type disk format '/shared/sync/backup/07july/%U.bkp';
BACKUP DATABASE ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
}
--By default rman will not take arch file and control file backup . in using below signal command we can take all 3 file backup
RMAN> backup database include current controlfile plus archive log;
The above command backs up the target database and the current control file and archive log files
--- Controlfile backup
RMAN> BACKUP CURRENT CONTROLFILE;
-- Here we are going to take  INCREMENTAL LEVEL 0 and 1 backup . by default rman will take  differential backup.we can take this type backup if db is archive log mode only .
RMAN> BACKUP INCREMENTAL LEVEL=0 DATABASE;
RMAN> BACKUP INCREMENTAL LEVEL=1 DATABASE;

-- The below command verifies all file available if any backup file is not available it will make  as unavailable.
RMAN> crosscheck backup;

Recover and restore commands.
RMAN> restore database;
RMAN> recover database

Delete arch file which was created 1 hours before .

DELETE ARCHIVELOG ALL COMPLETED BEFORE "SYSDATE-1/24";

No comments:

Post a Comment

How to create user in MY SQL

Create  a new MySQL user Account mysql > CREATE USER ' newuser '@'localhost' IDENTIFIED BY ' password '...