1.连接到目标数据库
这段时间搞oracle的rman备份脚本,所以找了一些资料,记录。
rman target user/password@yourdbname
2.启用控制文件自动备份
configure controlfile autobackup on;
3.配置自动备份的存放位置
configure controlfile autobackup format for device type disk to 'D:\database\backup\autobackupcontrole/autobackup_controle_%F';
4.配置控制文件的快照存放位置:
configure snapshot controlfile name to 'D:\database\backup\backupsnapshot\s%U';
5.修改备份格式为copy
configure device type disk backup type to copy;
7.配置缺省介质是磁盘备份
configure default device type to disk;
8.配置缺省备份是压缩方式:
configure device type disk backup type to compressed backupset;
9.配置缺省备份位置及名称
configure channel 1 device type disk format 'D:\database\backup\102wxxrdb\%U';
----配置备份保留策略-----
10.基于恢复窗口,7天
configure retention policy to recovery window of 7 days;
11.基于冗余策略,每个文件至少保留2份
configure retention policy to redundancy 2;
12.查看备份策略:
show retention policy;
13.查看过期的备份文件
report obsolete;
14.清空备份策略:
configure retention policy to none;
15.根据备份策略,删除过期备份
delete obsolete;
16.恢复上面的配置为默认值:configure ..... clear
configure controlfile autobackup format for device type disk clear;
转自网络