RMAN基础
登录RMAN
[oracle@dcm ~]$ rman target /
Recovery Manager: Release 11.1.0.6.0 - Production on Wed May 13 13:25:30 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: O11G (DBID=140043054)
或
[oracle@dcm ~]$ rman
Recovery Manager: Release 11.1.0.6.0 - Production on Thu Jun 18 13:28:07 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: O11G (DBID=140043054)
因为数据库是Open的,且又是非归档模式,所以无法进行在线全备份
RMAN> backup database;
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
关了,整成mount状态
RMAN> shutdown
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
开始数据库全备份
RMAN> backup database;
Starting backup at 13-MAY-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=154 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=/u01/app/oracle/oradata/o11g/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/o11g/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/o11g/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/o11g/undotbs01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/o11g/testspace2.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/o11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAY-09
channel ORA_DISK_1: finished piece 1 at 13-MAY-09
piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp tag=TAG20090513T153229 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
input datafile file number=00006 name=/u01/app/oracle/oradata/o11g/testspace.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAY-09
channel ORA_DISK_1: finished piece 1 at 13-MAY-09
piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13 /o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp tag=TAG20090513T153229 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 13-MAY-09
Starting Control File and SPFILE Autobackup at 13-MAY-09
piece handle= /home/oracle/myo11g/autobackup/c-140043054-20090513-00 comment=NONE
Finished Control File and SPFILE Autobackup at 13-MAY-09
查看备份信息
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.15G DISK 00:01:33 13-MAY-09
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20090513T153229
Piece Name: /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/system01.dbf
2 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/sysaux01.dbf
3 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/undotbs01.dbf
4 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/users01.dbf
5 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/example01.dbf
7 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/testspace2.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 252.00K DISK 00:00:07 13-MAY-09
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20090513T153229
Piece Name: /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
6 Full 1565621 13-MAY-09 /u01/app/oracle/oradata/o11g/testspace.dbf
RMAN> list backup of controlfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 9.36M DISK 00:00:08 13-MAY-09
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20090513T161909
Piece Name: /home/oracle/myo11g/autobackup/c-140043054-20090513-01
Control File Included: Ckp SCN: 1568079 Ckp time: 13-MAY-09
删除指定(BS Key)的备份集
RMAN> delete backupset 1;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1 1 1 1 AVAILABLE DISK /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp RECID=1 STAMP=686763156
Deleted 1 objects
删除所有备份集
RMAN> delete backup;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
2 2 1 1 AVAILABLE DISK /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp
3 3 1 1 AVAILABLE DISK /home/oracle/myo11g/autobackup/c-140043054-20090513-00
Do you really want to delete the above objects (enter YES or NO)? YES
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp RECID=2 STAMP=686763258
deleted backup piece
backup piece handle=/home/oracle/myo11g/autobackup/c-140043054-20090513-00 RECID=3 STAMP=686763268
Deleted 2 objects