Oracle RMAN快速入门指南
4. 启动RMAN
RMAN为交互式命令行处理界面,也可以从企业管理器中运行。
为了使用下面的实例,先检查环境符合:
the target database is called "his" and has the same TNS alias
user rman has been granted "recovery_catalog_owner "privileges
目标数据库的连接用户为internal帐号,或者以其他SYSDBA类型帐号连接
the recovery catalog database is called "rman" and has the same TNS alias
the schema containing the recovery catalog is "rman" (same password)
在使用RMAN前,设置NLS_DATE_FORMAT 和NLS_LANG环境变量,很多RMAN LIST命令的输出结果是与日期时间相关的,这点在用户希望执行以时间为基准的恢复工作也很重要。
下例是环境变量的示范:
NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
NLS_DATE_FORMAT=DD-MON-YYYY HH24:MI:SS
为了保证RMAN使用时能连接恢复目录,恢复目录数据库必须打开,目标数据库至少要STARTED(unmount),否则RMAN会返回一个错误,目标数据库必须置于归档模式下。
4.1.使用不带恢复目录的RMAN
设置目标数据库的 ORACLE_SID ,执行:
% rman nocatalog
RMAN> connect target
RMAN> connect target internal/<PASSWORD>@his4.2.使用带恢复目录的RMAN
% rman rman_ts rman/rman@rman
RMAN> connect target
% rman rman_ts rman/rman@rman target internal/<PASSWORD>@his4.3.使用RMAN
一旦连接到目标数据库,可以通过交互界面或者事先存储的脚本执行指定RMAN命令,下面是一个使用RMAN交互界面的实例:
RMAN> resync catalog;
RMAN-03022:正在编译命令:resync
RMAN-03023:正在执行命令:resync
RMAN-08002:正在启动全部恢复目录的 resync
RMAN-08004:完成全部 resync使用脚本的实例:
RMAN> execute script alloc_1_disk;创建或者替代存储的脚本:
RMAN> replace script alloc_1_disk {
2> allocate channel d1 type disk;
3> }
0
相关文章