rman在归档与非归档时备份数据库的简单示例

oracle10g

如果数据库是非归档模式只有数据库在mount状态下才能进行备份

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 6442450944 bytes
Fixed Size                  2030368 bytes
Variable Size            1090520288 bytes
Database Buffers         5335154688 bytes
Redo Buffers               14745600 bytes

在nomount状态下是不能备份的

RMAN> backup database;

Starting backup at 31-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 10/31/2012 14:22:22
ORA-01507: database not mounted

在mount状态下能进行备份

SQL> alter database mount;

Database altered.

RMAN> backup database;

Starting backup at 31-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/u01/app/oracle/oradata/jytest/hygeia.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jytest/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jytest/undotbs01.dbf
input datafile fno=00001 name=/u01/app/oracle/oradata/jytest/system01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jytest/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_nnndf_TAG20121031T142300_891jy4yv_.bkp tag=TAG20121031T142300 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:25
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 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_ncsnf_TAG20121031T142300_891k8co4_.bkp tag=TAG20121031T142300 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 31-OCT-12

如果数据库是归档模式数据库能在open和mount状态下能进行备份

SQL> startup
ORACLE instance started.

Total System Global Area 6442450944 bytes
Fixed Size                  2030368 bytes
Variable Size            1090520288 bytes
Database Buffers         5335154688 bytes
Redo Buffers               14745600 bytes
Database mounted.
Database opened.

RMAN> backup database;

Starting backup at 31-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/u01/app/oracle/oradata/jytest/hygeia.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jytest/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jytest/undotbs01.dbf
input datafile fno=00001 name=/u01/app/oracle/oradata/jytest/system01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jytest/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_nnndf_TAG20121031T142300_892jy4yv_.bkp tag=TAG20121031T142301 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:25
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 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_ncsnf_TAG20121031T142300_891k8co4_.bkp tag=TAG20121031T142300 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 31-OCT-12

SQL> startup mount
ORACLE instance started.

Total System Global Area 6442450944 bytes
Fixed Size                  2030368 bytes
Variable Size            1090520288 bytes
Database Buffers         5335154688 bytes
Redo Buffers               14745600 bytes
Database mounted.


RMAN> backup database;

Starting backup at 31-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/u01/app/oracle/oradata/jytest/hygeia.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jytest/sysaux01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jytest/undotbs01.dbf
input datafile fno=00001 name=/u01/app/oracle/oradata/jytest/system01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jytest/users01.dbf
channel ORA_DISK_1: starting piece 1 at 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_nnndf_TAG20121031T142300_893jy4yv_.bkp tag=TAG20121031T142302 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:05:25
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 31-OCT-12
channel ORA_DISK_1: finished piece 1 at 31-OCT-12
piece handle=/u01/app/oracle/flash_recovery_area/JYTEST/backupset/2012_10_31/o1_mf_ncsnf_TAG20121031T142300_891k8co4_.bkp tag=TAG20121031T142300 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 31-OCT-12

发表评论

电子邮件地址不会被公开。