oracle之rman备份

rman必须在oracle的归档模式下才能进行

查看数据库是否为归档状态,在oracle数据库的命令行输入

archive log list;

首先关闭数据库

shutdown immediate;

startup mount;  (mount 状态不同于open)

alter database archivelog;      修改为归档模式

alter database open;          启动数据库

再次执行archive log list;

 

现在开始rman操作

rman target/

show all ;        参看参数

configure controlfile autobackup on;         启动控制文件的自动备份

show controlfile autobackup;        查看是否已自动备份

backup database;            简单的全库备份

list backup;                查看备份信息

此时可以返回shell终端,查看系统还剩余多少空间,从而估算备份冗余数(也就是说可以自动备份几次)

再次rman target/

configure retention policy to redundancy 10;

0级备份脚本(全库备份)

 

rman target/ << EOF_RMAN

run{

allocate channel c1 type disk;

backup incremental level 0 tag 'db0' format

'/u01/app/oracle/RmanBackup/db0_%d_%T_%s' database include current controlfile;       #我执行这个脚本会报错,把%T_%s改为%U就可以恢复正常了

delete noprompt obsolete;

release channel c1;

}

1级备份脚本(增量备份)

rman target/ << EOF_RMAN

run{

allocate channel c1 type disk;

backup incremental level 1 tag 'db1' format

'/u01/app/oracle/RmanBackup/db0_%d_%T_%s' database include current controlfile;

delete noprompt obsolete;

release channel c1;

}

  

posted on 2018-02-05 16:31  标配的小号  阅读(303)  评论(0编辑  收藏  举报

导航