ORACLE RMAN备份的脚本配置

ORACLE RMAN备份的脚本配置

一: 备份;

1:连接目标数据库:

rman>connect target sys/sysray@db或者rman target=sys/sysray@db


2:查询目标数据库的配置情况;

RMAN> SHOW ALL;

修改成如下配置:

CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'F:rman_back%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT "F:rman_back%U";
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'F:rman_backSNCFRAYDB.ORA';

3:备份控制和数据文件

RMAN>backup database;

4:备份日志文件;

rman>backup archivelog all delete input;

二: 恢复:

1:先将数据库工作在'已装载'模式下;

sql>shutdown immediate;

sql>startup mount;

sql>select status from v$instance;

2:rman>restore database;

3:rman>recover database;

数据库恢复成功;

sql>alter database open;

OK;

<二>:表空间的备份与恢复;数据库要工作在归档日志模式下;

1:表空间的备份;

rman>backup (tablespace users include current controlfile);

2:备份归档日志;

rman>backup (archivelog all delete input);

3:表空间恢复;

3.1:表空间的脱机;

rman> sql'alter tablespace users offline immediate';

3.2:表空间所属数据文件还原;

rman>restore(tablespace users);

3.3:表空间恢复过程;

rman>recover tablespace users;

3.4:表空间联机的过程;

rman>sql'alter tablespace users online';

<三>:数据文件的备份恢复;数据库要工作在归档日志模式下;

1:备份数据文件;

rman>backup (datafile 'd:oracleoradatadbnameusers01.dbf');

2:备份所有归档日志文件;

rman>backup (archivelog all delete input);

3:数据文件的恢复;

3.1:将数据文件所属的表空间users脱机;

rman>sql'alter tablespace users offline immediate';

3.2:将数据文件还原的过程;

rman>restore (datafile 'd:oracleoradatadbnameusers01.dbf') ;

3.3:数据文件的恢复过程;

rman>recover datafile 'd:oracleoradatadbnameusers01.dbf';

3.4数据文件所属的表空间的联机;

rman>sql'alter tablespace users online';

OK;

阅读更多
个人分类: ORACLE
上一篇Oracle9i中分区partition的使用
下一篇ORA-01003 no statement parsed
想对作者说点什么? 我来说一句

oracle 11g rman备份脚本

2015年05月18日 2KB 下载

没有更多推荐了,返回首页

关闭
关闭