在数据库做Rman备份时,如果数据库没有开启Archivelog模式,数据库将不能使用Rman备份。
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/04/2015 04:08:13
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode。
所以如果备份策略是Rman备份是必须开启归档模式,下面主要介绍oracle数据库开启归档模式和关闭归档模式的步骤:
1. SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
2.启动数据库到mount状态
SQL> startup mount;
ORACLE instance started.
Total System Global Area 101782828 bytes
Fixed Size 451884 bytes
Variable Size 37748736 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
3.启用或停止归档模式
如果要启用归档模式,此处使用
alter database archivelog 命令。
SQL>alter database archivelog;Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log modeArchive ModeAutomatic archival Enabled
Archive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 148
Next log sequence to archive 151
Current log sequence 151
如果需要停止归档模式,此处使用:
alter database noarchivelog命令。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 101782828 bytes
Fixed Size 451884 bytes
Variable Size 37748736 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL>alter database noarchivelog;Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 81
Next log sequence to archive 83
Current log sequence 83
4.修改相应的初始化参数
Oracle10g之前,你还需要修改初始化参数使数据库处于自动归档模式。
在pfile/spfile中设置如下参数:
log_archive_start = true
重启数据库此参数生效,此时数据库处于自动归档模式。
也可以在数据库启动过程中,手工执行:
archive log start
使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。
Rman 备份的过程:
[oracle@catt ~]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jan 4 04:27:42 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11G (DBID=4257365136)
RMAN> backup database;
Starting backup at 04-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 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=/collect/oracle/oradata/ora11g/system01.dbf
input datafile file number=00003 name=/collect/oracle/oradata/ora11g/undotbs01.dbf
input datafile file number=00002 name=/collect/oracle/oradata/ora11g/sysaux01.dbf
input datafile file number=00005 name=/collect/oracle/oradata/ora11g/test_space.dbf
input datafile file number=00004 name=/collect/oracle/oradata/ora11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 04-JAN-15
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/04/2015 04:28:56
ORA-19502: write error on file "/collect/oracle/ORA11G/backupset/2015_01_04/o1_mf_nnndf_TAG20150104T042831_bbjn7hpx_.bkp", block number 27392 (block size=8192)
ORA-27072: File I/O error
Linux-x86_64 Error: 25: Inappropriate ioctl for device
Additional information: 4
Additional information: 27392
Additional information: 143360