$whoami
oracle
$export oracle_sid=orcl
$rman
RMAN>connect target / --如果目标数据库就是一个本地数据库
connect to target database:ORCL
RMAN>$rman target/ --连接目标数据库(在数据库本地进行备份)
connect to target database:ORCL
RAMN>show default device type; --检查默认备份通道类型
RAMN configuration parameters are:configure default device type to 'sbt_tape';
RAMN>backup as backupset database; --使用sbt_tape方式完全备份;
在上述全库备份中,所有数据文件,当前控制文件,当前参数文件,但没有备份归档日志.
RMAN>run --对所有归档日志文件进行备份,介质为磁盘
{
allocate channel c1 device type disk;
backpu database plus archivelog delete input;
release channel c1;
}
*****在备份过程中,可以通过指定备份文件名的格式来指定备份文件的存在位置.在10g,11g中,如不指定,则磁盘备份将被放置在闪回恢复区.
RMAN>run
{
allocate channel c1 device type disk;
backup database format '/flash_recovery_area/backup_%u.backupset'
plus archivelog delete input;
release channel c1;
}
RMAN>list backup of database; --查询备份内容
***********另外一种备份是采用镜像的方式,采用copy命令,或backup的as ********copy选项,如下进行了镜像完全备份
RMAN>run
{
allocate channel c1 device type disk;
backup as copy database plus archivelog delete input;
release channel c1;
}
***********备份集增量备份
***0级增备,相同于完备
RMAN>run
{
allocate channel c1 device type disk;
backup incremental level = 0 database plus archivelog delete input;
release channel c1;
}
*****1级增备
RMAN>run
{
allocate channel c1 device type sbt; --开通c1通道,使用磁带介质
allocate channel c2 device type sbt;
backup incremental level =1 database plus archivelog delete input;
release channel c1;
release channel c2;
}
*********在增备中,若干次的同级,上级增备可以被合并,称为增量
********的累计备份.
RMAN>run
{
allocate channel c1 device type sbt;
allocate channel c2 device type sbt;
backup incremental level = 1 cumulative database plus archivelog delete input;
release channel c1;
release channel c2;
}
*******备份局部的数据文件
select file_id,file_name,tablespace_name from dba_data_file;
出现所有数据文件信息
****下面对file_id为4和5的数据文件进行备份
RMAN>run{
allocate channel c1 device type sbt;
alloate channel c2 device type sbt;
backup datafile 4,5 filesperset = 1; ----?
release channel c1;
release channel c2;
}
RMAN>list backup of datafile 4,5; --查看刚刚备份的情况
********备份控制文件
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24214296/viewspace-1035135/ ,如需转载,请注明出处,否则将追究法律责任。