[20160421]backup as copy问题2.txt

简介: [20160421]backup as copy问题2.txt http://blog.itpub.net/267265/viewspace-2070878/ --前面提到使用backup as copy datafile 1 format '/home/orac...

[20160421]backup as copy问题2.txt

http://blog.itpub.net/267265/viewspace-2070878/

--前面提到使用backup as copy datafile 1 format '/home/oracle/backup/%b' ;这样的方式会报错
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 03/29/2016 09:24:29
ORA-19715: invalid format b for generated name
ORA-27302: failure occurred at: slgpn

--只要因为要system文件,会触发oracle自动备份spfile以及控制文件产生触发错误。
--可以使用DB_FILE_NAME_CONVERT来实现,不过很奇怪的是database必须放在最后。
BACKUP AS COPY DB_FILE_NAME_CONVERT=('/mnt/ramdisk/book/','/home/oracle/backup/') FORMAT='/home/oracle/backup/spfile_and_control_%U' database;
RMAN> BACKUP AS COPY DB_FILE_NAME_CONVERT=('/mnt/ramdisk/book/','/home/oracle/backup/') FORMAT='/home/oracle/backup/spfile_and_control_%U' datafile 1;

--实际上还可以这样操作:
copy datafile 1 to  '/home/oracle/backup/system01.dbf'
copy datafile 1 to  '/home/oracle/backup/system01.dbf' ,current controlfile to '/home/oracle/backup/control.bak';

RMAN> copy datafile 1 to  '/home/oracle/backup/system01.dbf' ,current controlfile to '/home/oracle/backup/control.bak';
Starting backup at 2016-04-21 08:38:52
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/home/oracle/backup/system01.dbf tag=TAG20160421T083852 RECID=35 STAMP=909736733
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/home/oracle/backup/control.bak tag=TAG20160421T083852 RECID=36 STAMP=909736735
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2016-04-21 08:38:56

--不过很奇怪的是如果写成如下:
RMAN> backup as copy datafile 1 to '/home/oracle/backup/system01.dbf';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "single-quoted-string": expecting one of: "destination"
RMAN-01007: at line 1 column 30 file: standard input

--不过感觉oracle会废除rman的copy命令.如果要copy整个数据库你可以发现

RMAN> copy
2>
3>

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "end-of-file": expecting one of: "archivelog, backup, check, controlfilecopy, current, datafilecopy, datafile, keep, level, nochecksum, nokeep, reuse, tag, ("
RMAN-01007: at line 3 column 1 file: standard input

--copy 命令并不支持database参数.要一个一个数据文件写.

SYS@book> select 'datafile '||file#||' to '''||replace(name,'/mnt/ramdisk/book/','/home/oracle/backup/')||''',' c60 from v$datafile;
C60
------------------------------------------------------------
datafile 1 to '/home/oracle/backup/system01.dbf',
datafile 2 to '/home/oracle/backup/sysaux01.dbf',
datafile 3 to '/home/oracle/backup/undotbs01.dbf',
datafile 4 to '/home/oracle/backup/users01.dbf',
datafile 5 to '/home/oracle/backup/example01.dbf',
datafile 6 to '/home/oracle/backup/sugar01.dbf',
datafile 7 to '/home/oracle/backup/tea01.dbf',
7 rows selected.

--这样写成如下:

copy
datafile 1 to '/home/oracle/backup/system01.dbf',
datafile 2 to '/home/oracle/backup/sysaux01.dbf',
datafile 3 to '/home/oracle/backup/undotbs01.dbf',
datafile 4 to '/home/oracle/backup/users01.dbf',
datafile 5 to '/home/oracle/backup/example01.dbf',
datafile 6 to '/home/oracle/backup/sugar01.dbf',
datafile 7 to '/home/oracle/backup/tea01.dbf',
current controlfile to '/home/oracle/backup/control.bak';

--打开并行会快一些.
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

目录
相关文章
|
6月前
|
C#
C# File.Copy介绍
C# File.Copy介绍
|
Oracle 关系型数据库 Shell
[20171121]rman backup as copy 2.txt
[20171121]rman backup as copy 2.txt --//昨天测试backup as copy ,备份时备份文件的文件头什么时候更新.是最后完成后还是顺序写入备份文件.
1011 0
|
Oracle 关系型数据库 Linux
[20171121]rman backup as copy.txt
[20171121]rman backup as copy.txt --//上个星期做数据文件块头恢复时,提到使用rman备份数据文件时,文件头数据库信息是最后写入备份集文件的,在filesperset=1的情况 --//下写入备份集文件中的倒数第2块就是文件头的备份.
1226 0
|
Oracle 关系型数据库 数据库
[20171121]rman使用copy image恢复.txt
[20171121]rman使用copy image恢复.txt --//上个星期做数据文件块头恢复时,提到使用rman备份数据文件时,文件头数据库信息是最后写入备份集文件的,在filesperset=1的情况 --//下写入备份集文件中的倒数第2块就是文件头的备份.
1272 0
|
缓存 Oracle 关系型数据库
[20171122]rman filesystemio_options.txt
[20171122]rman备份与参数filesystemio_options设置.txt --//这几天写了几篇filesystemio_options参数设置的文章,单独测试这个参数对rman备份以及os缓存的影响.
985 0
|
Oracle 关系型数据库 Linux
[20171101]rman to destination.txt
[20171101]rman to destination.txt --//国庆放假,看了一些rman方面的书,看到一个不常用的参数to destination,测试看看.
939 0
|
Oracle 关系型数据库 测试技术
[20170625]参数LOG_ARCHIVE_DEST_1.txt
[20170625]参数LOG_ARCHIVE_DEST_1.txt --//昨天帮别人解决问题时再次遇到,在测试环境重复测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VER...
910 0
|
Oracle 关系型数据库 数据库
[20170616]recover copy of datafile 6.txt
[20170616]no copy of datafile 6 found to recover.txt --//最近几天一直被这个问题纠缠,我虽然不知道问题在哪来,还是找到简单的解决方法,做1个记录: --//链接:http://www.
1151 0
[20160623]ora-00445.txt
[20160623]ora-00445.txt Wed Jun 22 07:38:25 2016 Errors in file e:\app\administrator\diag\rdbms\orcl\orcl\trace\orcl_smco_3976.
1323 0