rman学习

本文详细记录了创建Oracle RMAN恢复目录的步骤,包括创建数据库用户、分配权限、创建恢复目录、注册目标数据库等过程。在操作过程中遇到了文件缺失、权限问题和SQL解析错误等挑战,并逐一解决,最终成功备份数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

怎么样创建RMAN恢复目录
[A]首先,创建一个数据库用户,一般都是RMAN,并给予recovery_catalog_owner角色权限
sqlplus sys
SQL> create user rman identified by rman;
SQL> alter user rman default tablespace tools temporary tablespace temp;
SQL> alter user rman quota unlimited on tools;
SQL> grant connect, resource, recovery_catalog_owner to rman;
SQL> exit;
然后,用这个用户登录,创建恢复目录
rman catalog rman/rman
RMAN> create catalog tablespace tools;
RMAN> exit;
最后,你可以在恢复目录注册目标数据库了
rman catalog rman/rman target backdba/backdba
RMAN> register database;

------------------------------------------------------------------------------------------
|创建RMAN恢复目录的过程记录                |
------------------------------------------------------------------------------------------
系统环境:WINXP+ORACLE9.2.0.1客户端
1、在客户端上使用rman的时候提示文件缺少(不知道是什么原因)

C:/>rman

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-03000: recovery manager compiler component initialization failed
RMAN-06000: could not open recovery manager library file: D:/oracle9i/ora92/RDBM
S/ADMIN/RECOVER.BSQ
LFI-00108: Open expect the file [RECOVER][BSQ] to exist.


2、从服务端拷贝RECOVER.BSQ到ORACLE目录
C:/>rman

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

RMAN> catalog scott/tiger@pgjt

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "identifier": expecting one of: "archivelog, bac
kup, controlfilecopy, clone, datafilecopy"
RMAN-01008: the bad identifier was: scott
RMAN-01007: at line 1 column 9 file: standard input

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01006: error signalled during parse
RMAN-02001: unrecognized punctuation symbol "/"

RMAN> exit


恢复管理器完成。

C:/>rman catalog scott/tiger@pgjt

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

连接到恢复目录数据库
未安装恢复目录


3、用户必须具备recovery_catalog_owner角色权限
RMAN> create catalog tablespace tools;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-06426: RECOVERY_CATALOG_OWNER role must be granted to user SCOTT

RMAN> grant recovery_catalog_owner to scott;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "identifier": expecting one of: "allocate, alter
, backup, beginline, blockrecover, catalog, change, connect, copy, create, cross
check, configure, duplicate, debug, delete, drop, exit, endinline, host, {, libr
ary, list, mount, open, print, quit, recover, register, release, replace, report
, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, s
pool, startup, shutdown, send, show, test, upgrade, validate"
RMAN-01008: the bad identifier was: grant
RMAN-01007: at line 1 column 1 file: standard input

RMAN> exit


恢复管理器完成。

C:/>sqlplus /nolog

SQL*Plus: Release 9.2.0.1.0 - Production on 星期五 2月 4 09:19:10 2005

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


SQL> conn sys/sys@pgjt as sysdba
已连接。

SQL> grant recovery_catalog_owner to scott;

授权成功。

已用时间:  00: 00: 00.00
SQL> exit
从Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production中断开


4、登陆rman创建恢复目录、用恢复目录注册目标数据库
C:/>rman catalog scott/tiger@pgjt

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

连接到恢复目录数据库
未安装恢复目录

RMAN> create catalog tablespace tools;

恢复目录已创建

RMAN> exit

恢复管理器完成。

C:/>rman catalog scott/tiger@pgjt target sys/sys@pgjt

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

连接到目标数据库: NCDBPX (DBID=2674958795)
连接到恢复目录数据库

RMAN> register database;

注册在恢复目录中的数据库
正在启动全部恢复目录的 resync
完成全部 resync

RMAN> exit

恢复管理器完成。

5、rman备份数据
C:/>rman catalog scott/tiger@pgjt target sys/sys@pgjt

恢复管理器: 版本9.2.0.1.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

连接到目标数据库: NCDBPX (DBID=2674958795)
连接到恢复目录数据库

RMAN> run{
2> allocate channel c1 type disk;
3> backup full tag 'dbfull' format 'e:/full%u_%s_%p' database
4> include current controlfile;
5> sql 'alter system archive log current';
6> release channel c1;
7> }

分配的通道: c1
通道 c1: sid=40 devtype=DISK

启动 backup 于 04-2月 -05
通道 c1: 正在启动 full 数据文件备份集
通道 c1: 正在指定备份集中的数据文件
在备份集中包含当前的 SPFILE
备份集中包括当前控制文件
输入数据文件 fno=00011 name=E:/ORACLE/ORADATA/NCDBPX/NNC_DATA01.DBF
输入数据文件 fno=00017 name=E:/ORACLE/ORADATA/NCDBPX/IUFO.ORA
输入数据文件 fno=00014 name=E:/ORACLE/ORADATA/NCDBPX/NNC_INDEX01.DBF
输入数据文件 fno=00016 name=E:/ORACLE/ORADATA/NCDBPX/NNC_INDEX03.DBF
输入数据文件 fno=00012 name=E:/ORACLE/ORADATA/NCDBPX/NNC_DATA02.DBF
输入数据文件 fno=00013 name=E:/ORACLE/ORADATA/NCDBPX/NNC_DATA03.DBF
输入数据文件 fno=00002 name=E:/ORACLE/ORADATA/NCDBPX/UNDOTBS01.DBF
输入数据文件 fno=00015 name=E:/ORACLE/ORADATA/NCDBPX/NNC_INDEX02.DBF
输入数据文件 fno=00001 name=E:/ORACLE/ORADATA/NCDBPX/SYSTEM01.DBF
输入数据文件 fno=00020 name=E:/ORACLE/ORADATA/NCDBPX/RESTOREIUFO.ORA
输入数据文件 fno=00018 name=E:/ORACLE/ORADATA/NCDBPX/IUFO3.ORA
输入数据文件 fno=00005 name=E:/ORACLE/ORADATA/NCDBPX/EXAMPLE01.DBF
输入数据文件 fno=00019 name=E:/ORACLE/ORADATA/NCDBPX/TEMP02.ORA
输入数据文件 fno=00010 name=E:/ORACLE/ORADATA/NCDBPX/XDB01.DBF
输入数据文件 fno=00006 name=E:/ORACLE/ORADATA/NCDBPX/INDX01.DBF
输入数据文件 fno=00009 name=E:/ORACLE/ORADATA/NCDBPX/USERS01.DBF
输入数据文件 fno=00003 name=E:/ORACLE/ORADATA/NCDBPX/CWMLITE01.DBF
输入数据文件 fno=00004 name=E:/ORACLE/ORADATA/NCDBPX/DRSYS01.DBF
输入数据文件 fno=00007 name=E:/ORACLE/ORADATA/NCDBPX/ODM01.DBF
输入数据文件 fno=00008 name=E:/ORACLE/ORADATA/NCDBPX/TOOLS01.DBF
输入数据文件 fno=00021 name=E:/ORACLE/ORADATA/NCDBPX/IUFO0113.ORA
通道 c1: 正在启动段 1 于 02-1月 -05
释放的通道: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c1 channel at 02/04/2005 10:25:01
ORA-19502: write error on file "e:/full04g96cac_4_1", blockno 220801 (blocksize=
8192)
ORA-27072: skgfdisp: I/O error
OSD-04008: WriteFile() failure, unable to write to file
O/S-Error: (OS 112) 磁盘空间不足。

6、上面全库备份由于空间不足,下面测试备份表空间
RMAN> run{
2> allocate channel c1 type disk;
3> backup full tag 'tsuser' format 'e:/full%u_%s_%p' tablespace users;
4> release channel c1;
5> }

分配的通道: c1
通道 c1: sid=36 devtype=DISK

启动 backup 于 04-2月 -05
通道 c1: 正在启动 full 数据文件备份集
通道 c1: 正在指定备份集中的数据文件
输入数据文件 fno=00009 name=E:/ORACLE/ORADATA/NCDBPX/USERS01.DBF
通道 c1: 正在启动段 1 于 02-1月 -05
通道 c1: 已完成段 1 于 02-1月 -05
段 handle=E:/FULL06G96DQB_6_1 comment=NONE
通道 c1: 备份集已完成, 经过时间:00:00:02
完成 backup 于 04-2月 -05

释放的通道: c1


RMAN> EXIT


恢复管理器完成。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值