您的位置:首页 > 数据库

Rman使用前的准备工作,创建恢复目录所需要使用的表空间,在目录数据库创建rman用户,在目录数据库建立恢复目录

2009-02-23 12:58 761 查看
Rman使用前的准备工作,创建恢复目录所需要使用的表空间,在目录数据库创建rman用户,在目录数据库建立恢复目录
建立恢复目录
第一步,在目录数据库中创建恢复目录所用表空间:
SQL> create tablespace rman_ts datafile 'E:/ora10g/ora10gdata/pskdb/rman_ts.dbf' size 20M;
表空间已创建。
第二步,在目录数据库中创建RMAN 用户并授权:
SQL> create user rman identified by rman default tablespace rman_ts temporary
tablespace temp quota unlimited on rman_ts;

SQL> grant recovery_catalog_owner to rman;

SQL> grant connect, resource to rman;
第三步,在目录数据库中创建恢复目录

C:/> rman target sys/stephen@pskDB catalog rman/rman@pskDB –连接到目的数据库跟恢复数据库

RMAN>create catalog tablespace rman_ts --创建目录成功

register database --注册恢复数据库
resync catalog --同步全部恢复目录
第四步,通过rman进行相关备份的操作
Rman>show all;---- 显示所有的rman 参数设置
Rman>configure controlfile autobackup on;---更改相关的设置
Rman> backup database plus archivelog delete input;-- 备份整个数据 执行命令后提示如下:

以上说明数据库不是在归档模式下,需要修改成归档模式.
Sql>shutdown immediate;
Sql>startup mount;
Sql>alter database archivelog;
Sql>alter database open;
rman>backup database plus archivelog delete input; --执行后界面如下 会在flash_recovery_area下创建相关的文件

第五步,通过rman进行相关恢复的操作
Rman>shutdown immediate; ----先关闭数据库
Rman>startup nomount; ---把数据库启动到nomount状态下,此时还没用到控制文件。

Rman>restore controlfile from autobackup; ------从autobackup到恢复控制文件,假设数据库控制文件坏啦或是不能启动数据库啦。

Rman>alter database mount; ------把数据库切换到mount状态下
Rman>restore database; ---恢复数据库(主要针对data file,)

数据文件,redo log 打开后就可以把数据库切换到open模式下
Rman>alter database open resetlogs;

第六步:恢复表空间
Sql>alter tablespace users offline;
C:/rman target sys/stephen@pskDB catalog rman/rman@pskDB;
Rman>restore tablespace users;
Rman>recover tablespace users;
Rman>exit;
Sql>conn /as sysdba;
Sql>alter tablespace users online;

Rman>recover database; ---恢复数据库(主要针对在线redo log)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐