数据库备份和恢复方案及步骤

上传人:xzh****18 文档编号:34341723 上传时间:2018-02-23 格式:DOC 页数:9 大小:60KB
返回 下载 相关 举报
数据库备份和恢复方案及步骤_第1页
第1页 / 共9页
数据库备份和恢复方案及步骤_第2页
第2页 / 共9页
数据库备份和恢复方案及步骤_第3页
第3页 / 共9页
数据库备份和恢复方案及步骤_第4页
第4页 / 共9页
数据库备份和恢复方案及步骤_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《数据库备份和恢复方案及步骤》由会员分享,可在线阅读,更多相关《数据库备份和恢复方案及步骤(9页珍藏版)》请在金锄头文库上搜索。

1、操作系统:GNU/Linux数据库管理系统:Oracle10g一、安装 Recovery Catalog1, 用 dbca 创建一个 DATABASE catdb,用于存放 recovery catalog dataoraclelocalhost $dbca2, 在 catdb 中创建一个名为 rcat_ts 的表空间作为用户 rman 的默认表空间oraclelocalhost $sqlplus sys/oraclecatdb as sysdbaSQL create tablespace rcat_ts;SQL create user rman identified by oracle te

2、mporary tablespace tempDefault tablespace rcat_ts quota unlimited on rcat_ts;3, 授予 catlog 所有者 rman recovery_catalog_owner 角色,该角色提供给用户所有查询和维护 recovery catalog 所必需的权限SQL grant connect,resource,recovery_catalog_owner to rman;4, 启动 rman,以 catalog 所有者 rman 登录oraclelocalhost $rman catalog rman/oraclecatdb

3、RMAN create catalog tablespace rcat_ts;5,用 rman 同时连接到 target 数据库、catalog 数据库,在新建的 recovery catalog 中注册 target 数据库oraclelocalhost $rman target sys/oracleorcl catalog rman/oraclecatdb RMAN register database;,察看已在 recovery catalog 中注册的 target 数据库oraclelocalhost $sqlplus rman/oraclecatdbSQLselect * from

4、 db;二、 配置 RMAN1,同时连接 target 数据库和 recovery catalog 数据库oraclelocalhost $rman target sys/oracleorcl catalog rman/oraclecatdb2,RMAN show all (检查配置)configure default device type to disk ( 设置默认的备份的设备为磁盘)CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; (设置备份的并行级别)configure channel 1 devic

5、e type disk format /home/new/backup_%U (设置备份文件格式)configure channel 2 device type disk format /home/oracle/backup_%U (设置备份文件格式) configure controlfile autobackup on (打开控制文件的自动备份)configure controlfile autobackup format for device type disk to /home/new/ctl_%F (设置控制文件备份格式)三. 备份测试备份全库1,同时连接 target 数据库和 r

6、ecovery catalog 数据库oraclelocalhost $rman target sys/oracleorcl catalog rman/oraclecatdb2,RMAN backup database plus archivelog delete input;3,连接 target 数据库oraclelocalhost $sqlplus sys/oracleorcl as sysdbaSQL conn hr/hr;SQL select salary from employees where employee_id=157;SQL update employees set sa

7、lary =2000 where employee_id=157;SQL commit;SQL select salary from employees where employee_id=157;四. 恢复测试复原及恢复全库1,连接 target 数据库oraclelocalhost $sqlplus sys/oracleorcl as sysdba2,把 target 数据库先关闭,然后启动到 mount 状态SQL shutdown immediate;SQL startup mount;3,复原及恢复全库RMAN restore database channel ORA_DISK_1:

8、 restore complete, elapsed time: 00:05:10RMAN recover databasemedia recovery complete, elapsed time: 00:00:074,连接 target 数据库oraclelocalhost $sqlplus sys/oracleorcl as sysdba5,打开 target 数据库SQL alter database open;6,查看已录入的事物SQL conn hr/hr;SQL select salary from employees where employee_id=157; 假设备份了一个

9、表空间 users恢复表空间:rman target rman/rmantest2006 catalog rman/rmantest2007sql alter tablespace users offline immediate (使 TEST2006 的 USERS 表空间脱机)进入 test2006select tablespace_name,status from dba_tablespaces; (检查 USERS 已经脱机)退出 RMAN删除 D:oracleoradataTEST2006users01.dbf rman target rman/rmantest2006 catalo

10、g rman/rmantest2007restore tablespace usersrecover tablespace userssql alter tablespace users online (使 TEST2006 的 USERS 表空间在线)进入 test2006select tablespace_name,status from dba_tablespaces; (检查 USERS 已经在线)三 、物理(热)备份。Linux 下 Oracle10.2.0.1 RMAN 备份及恢复步骤介绍切换服务器归档模式,如果已经是归档模式可跳过此步:%sqlplus /nolog (启动 sq

11、lplus)SQL conn / as sysdba (以 DBA 身份连接数据库)SQL shutdown immediate; (立即关闭数据库)SQL startup mount (启动实例并加载数据库,但不打开 )SQL alter database archivelog; (更改数据库为归档模式)SQL alter database open; (打开数据库)SQL alter system archive log start; (启用自动归档)SQL exit (退出 )2、连接:%rman target=gti/gti123LANDF; (启动恢复管理器)3、基本设置:RMAN

12、configure default device type to disk; (设置默认的备份设备为磁盘 )RMAN configure device type disk parallelism 2; (设置备份的并行级别,通道数)RMAN CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT /home/oracle/backup/data/backup_%U; (设置备份的文件格式,只适用于磁盘设备)RMAN CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT /home/oracle/backup/data1/back

13、up_%U; (设置备份的文件格式,只适用于磁盘设备)RMAN configure controlfile autobackup on; (打开控制文件与服务器参数文件的自动备份)RMAN configure controlfile autobackup format for device type disk to /home/oracle/backup/data/ctl_%F; (设置控制文件与服务器参数文件自动备份的文件格式)4、查看所有设置:RMAN show all5、查看数据库方案报表:RMAN report schema;6、备份全库:RMAN backup database pl

14、us archivelog delete input; (备份全库及控制文件、服务器参数文件与所有归档的重做日志,并删除旧的归档日志)7、备份表空间:热备份(归档状态下才有效果) 1、alter tablespace tablespace_name start backup; 2、拷贝你的该表空间的数据文件备份 3、alter tablespace tablespace_name end backup; 4、一个一个表空间做完,就备份完了 RMAN backup tablespace system plus archivelog delete input; (备份指定表空间及归档的重做日志,并

15、删除旧的归档日志)RMAN backup tablespace UNDOTBS plus archivelog delete input; (备份指定表空间及归档的重做日志,并删除旧的归档日志)RMAN backup tablespace SYSAUX plus archivelog delete input; (备份指定表空间及归档的重做日志,并删除旧的归档日志)RMAN backup tablespace TEMP plus archivelog delete input; (备份指定表空间及归档的重做日志,并删除旧的归档日志)8、备份归档日志:RMAN backup archivelog all delete input;9、复制数据文件:RMAN copy datafile 1 to /home/oracle/product/10.2.0.1/backup/system.copy;/*RMAN copy /home/oracle/data/gti_sys01.dbf to /home/oracle/product/10.2.0.1/backup/system.copy;RMAN copy /home/oracle/data/gti_undotbs.dbf 1 to /home/oracle/product/10.2.0.1/backup/undo.copy;RMAN c

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号