# su - oracle
[oracle@xy ~]$ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 20 12:01:22 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: JHTPAYDB (DBID=1069987867)
RMAN> run{allocate channel cha1 type disk;
2> backup
3> format '/oracledir/mybackup/full_%U_%T'
4> database;
5> release channel cha1;}
allocated channel: cha1
channel cha1: sid=153 devtype=DISK
Starting backup at 20-JAN-10
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/jhtpaydb/system01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/jhtpaydb/sysaux01.dbf
input datafile fno=00005 name=/opt/oracle/oradata/jhtpaydb/example01.dbf
input datafile fno=00006 name=/home/oracle/jhtpaydf01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/jhtpaydb/users01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/jhtpaydb/undotbs01.dbf
channel cha1: starting piece 1 at 20-JAN-10
released channel: cha1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on cha1 channel at 01/20/2010 12:28:23
ORA-19504: failed to create file "/oracledir/mybackup/full_08l3ubv6_1_1_20100120"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory
错误原因:需要在/oracledir文件夹下创建mybackup文件夹,并给出用户写权限:
[oracle@xy oracledir]$ chown oracle:oinstall /oracledir
[oracle@xy oracledir]$ chmod 777 /oracledir
[oracle@xy /]$ cd oracledir/
[oracle@xy oracledir]$ mkdir mybackup
[oracle@xy oracledir]$ chmod 777 mybackup
再次执行RMAN备份命令:
RMAN> run{allocate channel cha1 type disk;
2> backup
3> format '/oracledir/mybackup/full_%U_%T'
4> database;
5> release channel cha1;}
allocated channel: cha1
channel cha1: sid=153 devtype=DISK
Starting backup at 20-JAN-10
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/jhtpaydb/system01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/jhtpaydb/sysaux01.dbf
input datafile fno=00005 name=/opt/oracle/oradata/jhtpaydb/example01.dbf
input datafile fno=00006 name=/home/oracle/jhtpaydf01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/jhtpaydb/users01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/jhtpaydb/undotbs01.dbf
channel cha1: starting piece 1 at 20-JAN-10
channel cha1: finished piece 1 at 20-JAN-10
piece handle=/oracledir/mybackup/full_0al3uc68_1_1_20100120 tag=TAG20100120T123208 comment=NONE
channel cha1: backup set complete, elapsed time: 00:01:16
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel cha1: starting piece 1 at 20-JAN-10
channel cha1: finished piece 1 at 20-JAN-10
piece handle=/oracledir/mybackup/full_0bl3uc8k_1_1_20100120 tag=TAG20100120T123208 comment=NONE
channel cha1: backup set complete, elapsed time: 00:00:03
Finished backup at 20-JAN-10
released channel: cha1
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 727.13M DISK 00:01:12 20-JAN-10
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20100120T123208
Piece Name: /oracledir/mybackup/full_0al3uc68_1_1_20100120
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/system01.dbf
2 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/undotbs01.dbf
3 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/sysaux01.dbf
4 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/users01.dbf
5 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/example01.dbf
6 Full 680453 20-JAN-10 /home/oracle/jhtpaydf01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 6.80M DISK 00:00:02 20-JAN-10
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20100120T123208
Piece Name: /oracledir/mybackup/full_0bl3uc8k_1_1_20100120
Control File Included: Ckp SCN: 680483 Ckp time: 20-JAN-10
SPFILE Included: Modification time: 20-JAN-10
备份成功
[oracle@xy ~]$ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jan 20 12:01:22 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: JHTPAYDB (DBID=1069987867)
RMAN> run{allocate channel cha1 type disk;
2> backup
3> format '/oracledir/mybackup/full_%U_%T'
4> database;
5> release channel cha1;}
allocated channel: cha1
channel cha1: sid=153 devtype=DISK
Starting backup at 20-JAN-10
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/jhtpaydb/system01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/jhtpaydb/sysaux01.dbf
input datafile fno=00005 name=/opt/oracle/oradata/jhtpaydb/example01.dbf
input datafile fno=00006 name=/home/oracle/jhtpaydf01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/jhtpaydb/users01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/jhtpaydb/undotbs01.dbf
channel cha1: starting piece 1 at 20-JAN-10
released channel: cha1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on cha1 channel at 01/20/2010 12:28:23
ORA-19504: failed to create file "/oracledir/mybackup/full_08l3ubv6_1_1_20100120"
ORA-27040: file create error, unable to create file
Linux Error: 2: No such file or directory
错误原因:需要在/oracledir文件夹下创建mybackup文件夹,并给出用户写权限:
[oracle@xy oracledir]$ chown oracle:oinstall /oracledir
[oracle@xy oracledir]$ chmod 777 /oracledir
[oracle@xy /]$ cd oracledir/
[oracle@xy oracledir]$ mkdir mybackup
[oracle@xy oracledir]$ chmod 777 mybackup
再次执行RMAN备份命令:
RMAN> run{allocate channel cha1 type disk;
2> backup
3> format '/oracledir/mybackup/full_%U_%T'
4> database;
5> release channel cha1;}
allocated channel: cha1
channel cha1: sid=153 devtype=DISK
Starting backup at 20-JAN-10
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/jhtpaydb/system01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/jhtpaydb/sysaux01.dbf
input datafile fno=00005 name=/opt/oracle/oradata/jhtpaydb/example01.dbf
input datafile fno=00006 name=/home/oracle/jhtpaydf01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/jhtpaydb/users01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/jhtpaydb/undotbs01.dbf
channel cha1: starting piece 1 at 20-JAN-10
channel cha1: finished piece 1 at 20-JAN-10
piece handle=/oracledir/mybackup/full_0al3uc68_1_1_20100120 tag=TAG20100120T123208 comment=NONE
channel cha1: backup set complete, elapsed time: 00:01:16
channel cha1: starting full datafile backupset
channel cha1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel cha1: starting piece 1 at 20-JAN-10
channel cha1: finished piece 1 at 20-JAN-10
piece handle=/oracledir/mybackup/full_0bl3uc8k_1_1_20100120 tag=TAG20100120T123208 comment=NONE
channel cha1: backup set complete, elapsed time: 00:00:03
Finished backup at 20-JAN-10
released channel: cha1
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 727.13M DISK 00:01:12 20-JAN-10
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20100120T123208
Piece Name: /oracledir/mybackup/full_0al3uc68_1_1_20100120
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/system01.dbf
2 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/undotbs01.dbf
3 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/sysaux01.dbf
4 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/users01.dbf
5 Full 680453 20-JAN-10 /opt/oracle/oradata/jhtpaydb/example01.dbf
6 Full 680453 20-JAN-10 /home/oracle/jhtpaydf01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 6.80M DISK 00:00:02 20-JAN-10
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20100120T123208
Piece Name: /oracledir/mybackup/full_0bl3uc8k_1_1_20100120
Control File Included: Ckp SCN: 680483 Ckp time: 20-JAN-10
SPFILE Included: Modification time: 20-JAN-10
备份成功