RMAN> connect target /
connected to target database: DB2 (DBID=1852673443)
RMAN> shutdown immediate;
RMAN> startup mount;
#
开
始
备
份
RMAN> backup database format='/oracle/rmanback/%d_%s.dbf';
Starting backup at 12-JUN-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=35 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/home/oracle/oracle/oradata/db2/system01.dbf
input datafile fno=00003 name=/home/oracle/oracle/oradata/db2/sysaux01.dbf
input datafile fno=00002 name=/home/oracle/oracle/oradata/db2/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/oracle/oradata/db2/usertbs.dbf
channel ORA_DISK_1: starting piece 1 at 12-JUN-09
channel ORA_DISK_1: finished piece 1 at 12-JUN-09
piece handle=/oracle/rmanback/DB2_1.dbf tag=TAG20090612T071426 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 12-JUN-09
channel ORA_DISK_1: finished piece 1 at 12-JUN-09
piece handle=/oracle/rmanback/DB2_2.dbf tag=TAG20090612T071426 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 12-JUN-09
RMAN> sql 'alter database open';
RMAN> sql 'alter system archive log current';
|
[oracle@oracle rmanback]$ pwd
/oracle/rmanback
[oracle@oracle rmanback]$ ls
DB2_1.dbf DB2_2.dbf
|
RMAN> connect target sys/123456
RMAN> backup database format='/oracle/rmanback/%d_%s.dbf';
[oracle@oracle rmanback]$ ls
DB2_1.dbf DB2_2.dbf DB2_3.dbf DB2_4.dbf
|
RMAN> connect target sys/123456
RMAN> backup tablespace chenxy format='/oracle/rmanback/%N_%s.dbf';
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/home/oracle/oracle/oradata/db2/chenxy.dbf
input datafile fno=00005 name=/home/oracle/oracle/oradata/db2/chen
p
y.dbf
channel ORA_DISK_1: starting piece 1 at 12-JUN-09
Finished backup at 12-JUN-09
[oracle@oracle rmanback]$ ls
CHENXY_6.dbf CHENXY_7.dbf
DB2_1.dbf DB2_2.dbf DB2_3.dbf DB2_4.dbf
|
RMAN> connect target sys/123456
RMAN> backup datafile 5 format='/oracle/rmanback/%N_%f_%s.dbf';
|
#
备
份控制文件
RMAN> backup current controlfile format='/oracle/rmanback/%d_%s.ctl';
#
备
份前一天的
备
档日志
RMAN> backup format='/oracle/rmanback/%d_%s.arc'
2> archivelog from time='sysdate-1' until time='sysdate';
#
同
时备
份数据文件和
归
档日志
RMAN> backup format '/oracle/rmanback/%d_%s.bak' tablespace chenxy plus archivelog;
|
RMAN> backup as copy format='/oracle/rmanback/df_5.dbf' datafile 5;
|
RMAN> copy current controlfile to '/oracle/rmanback/db2.ctl';
[oracle@oracle rmanback]$ ls
db2.ctl df_5.dbf
|
RMAN> backup as copy format='/oracle/rmanback/arc30.log' archivelog sequence 30;
RMAN> copy archivelog '/home/oracle/oracle/oradata/db2/arch/1_31_689217827.dbf'
2> to '/oracle/rmanback/arc31.log';
[oracle@oracle rmanback]$ ll
total 678288
-rw-r----- 1 oracle oinstall 23883776 Jun 12 08:16 arc30.log
-rw-r----- 1 oracle oinstall 1024 Jun 12 08:18 arc31.log
|
RMAN> configure device type disk parallelism 3;
RMAN> backup as copy format='/oracle/rmanback/df_%f.dbf' datafile 2,3,4;
|
RMAN>report schema;
RMAN>report need backup incremental 3;
RMAN>report need backup days 3 tablespace chenxy;
RMAN>report need backup redundancy 2 database;
RMAN>report obsolete redundancy 2;
RMAN>report unrecoverable;
|
RMAN>list backup of tablespace chenxy;
RMAN>list backup of controlfile;
RMAN>list backup of archivelog all;
RMAN>list backup of spfile;
RMAN>list copy of datafile 5;
RMAN>list copy of controlfile;
RMAN>list copy of archivelog;
RMAN>list incarnation of database;
|
RMAN>crosscheck backup;
RMAN>crosscheck backup of database;
RMAN>crosscheck backup of tablespace system;
RMAN>crosscheck backup of datafile 4;
RMAN>crosscheck backup of controlfile;
RMAN>crosscheck backup of spfile;
RMAN>crosscheck backup of archivelog sequence 3;
RMAN>crosscheck backup of copy;
RMAN>crosscheck backup of database;
RMAN>crosscheck backup of tablespace users;
|
RMAN>delete obsolete;
RMAN>delete noprompt expired backup;
RMAN>delete noprompt expired copy;
RMAN>delete noprompt backupset 12;
RMAN>delete noprompt backuppiece ‘/oracle/rmanback/ctl.bak’;
RMAN>delete noprompt backup;
RMAN>delete noprompt datafilecopy ‘/oracle/rmanback/*.bak’;
RMAN>delete noprompt copy;
RMAN>backup archivelog all delete input;
|
RMAN>change backupset 2 unavailable;
RMAN>change datafilecopy ‘/oracle/rmanback/*.bak’ unavailable;
RMAN>change backupset 10 keep forerer logs;
RMAN>change backupset 200 keep until time ‘sysdate+60’ logs;
RMAN>change backupset 20 nokeep;
|
RMAN>catalog datafilecopy ‘/oracle/rmanback/chenxy01.bak’;
RMAN>catalog backuppiece ‘/oracle/rmanback/chenxy_10.dbf’;
RMAN>catalog start with ‘/oracle/rmanback’;
#
注
销
RMAN>change datafilecopy ‘/oracle/rmanback/chenxy01.bak’ uncatalog;
RMAN>change controlfilecopy ‘‘/oracle/rmanback/db2.ctl’ uncatalog;
RMAN>change backuppiece ‘/oracle/rmanback/chenxy02.bak’ uncatalog;
|