Vous êtes sur la page 1sur 3

RMAN Quick Ref

RMAN> crosscheck archivelog all;


RMAN> delete noprompt expired archivelog all;
RMAN videos:
http://vimeo.com/10516745
RMAN> list backup summary; # If you look at LV column, A=archivelog, 0=increment
al level #, F=file backup.
# RMAN Data Recovery Advisor
RMAN>
RMAN>
RMAN>
RMAN>

list failure;
list failure <failure id="id"> detail;
advice failure <failure id="id">;
repair failure preview;</failure></failure>

alter database backup controlfile to '/tmp/rplrepos/cntrlrplrepos.dbf';


alter database backup controlfile to trace as '/tmp/rplrepos/cntrlrplrepos_trace
.sql';
RMAN Script: http://www.oracle.com/technetwork/issue-archive/2009/09-sep/o59reco
very-085185.html
-----------------------------------------------------------------------------------------Parameter-driven command file

connect target /
connect catalog rman/secretpass@rmancat
run {
allocate channel c1 type disk format '&1/%U';
backup tablespace &2;
}
A shell script, named backup_ts_generic.sh, calls the backup_ts_generic.rman com
mand file with the values /tmp as the backup location (for parameter &1) and USE
RS as the tablespace name (for parameter &2):

$ORACLE_HOME/bin/rman <<EOF
@backup_ts_generic.rman "/tmp" USERS
EOF
You can make this shell script even more generic, so that the parameters are pas
sed from the command line of the file system itself. For example, if you modify
the second line in the backup_ts_generic.sh shell script so it reads

@backup_ts_generic.rman "/tmp" $1
you will be able to call the backup_ts_generic.rman command file, provide /tmp a
s the backup location, and pass the tablespace name in the command line. For ins
tance, if you want to back up the MYTS1 tablespace, you can issue

backup_ts_generic.sh MYTS1
================================================================================
================================================================================
==========
RMAN Scripts
Running RMAN script from command line:
nohup rman @bkpdb.rman > /dev/null 2>&1 &
cat bkpdb.rman
spool log to bkupinc0.log
connect target;
show all;
run {
set command id to "INC0";
set controlfile autobackup format for device type disk to '/slot
/ems7499/oracle/rman_apexdb1/%d_%F';
allocate channel d1 device type disk format '/slot/ems7499/oracl
e/rman_apexdb1/%d_%I_%T_%U.inc0' maxopenfiles 1;
backup as compressed backupset
incremental level 0 check logical database
filesperset 1 tag="INC0"
include current controlfile
plus archivelog not backed up 1 times
filesperset 8 tag="INC0"
;
backup spfile tag="INC0";
}
exit
To check the syntax of RMAN script
rman checksyntax @bkptest.rman
bash-3.00$ rman checksyntax @rman_test.rman
Recovery Manager: Release 11.2.0.2.0 - Production on Tue Jun 25
03:05:11 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rig
hts reserved.
RMAN>
2>
3>
4>
5>

spool log to bkptest.log


connect target;
show all;
run {
set command id to "INC0";

6>
set controlfile autobackup format for device typ
e disk to '/slot/ems7499/oracle/rman_apexdb1/%d_%F';
7>
allocate channel d1 device type disk format '/sl
ot/ems7499/oracle/rman_apexdb1/%d_%I_%T_%U.inc0' maxopenfiles 1;
8>
backup as compressed backupset
9>
incremental level 0 check logical database
10>
filesperset 1 tag="INC0"
11>
include current controlfile
12>
plus archivelog not backed up 1 times
13>
filesperset 8 tag="INC0"
14>
;
15>
backup spfile tag="INC0";
16>
}
17>
exitbash-3.00$
bash-3.00$
bash-3.00$ cat bkptest.log
The cmdfile has no syntax errors
Recovery Manager complete.
bash-3.00$
List backup by file tag inc0
RMAN> list backup by file tag inc1;
Restore Preview:
$ cat restore_preview.rman
connect target;
restore database preview;
restore database preview until time 'TRUNC(sysdate)';
Validate backup:
$ cat validate.rman
connect target;
backup validate check logical database;
restore validate database;
restore validate archivelog from time 'sysdate-7';
.

Vous aimerez peut-être aussi