标签:rman
Recovery Manager(RMAN)是Oracle提供的一个实用工具,使用RMAN可以对Oracle数据库进行备份、还原、恢复等。RMAN还可以自动管理Oracle的备份策略。RMAN提供了命令行与图形界面两种访问方式。我们主要学习命令行方式操作RMAN。
进入RMAN非常简单,执行在OS环境下敲入rman命令即可。
[root@11gdg ~]# su - oracle 11gdg-> rman Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:30:07 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. RMAN>
我们要使用RMAN对数据库进行备份、恢复等操作,首先需要登录到目标数据库。连接到目标数据库有以下几种方式
登录本地服务器
11gdg-> rman target / Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:32:36 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: DEVDB (DBID=789087786) RMAN>
target关键字用来指定目标数据库。如果本地服务器有多个实例,想登录到某个具体实例时,需要先声明环境变量export ORACLE_SID=orcl
登录远程服务器
要登录远程服务器,必须先提供一个连接字符串,即编辑本地tnsnames.ora文件添加要连接的数据库。
11gdg-> rman target sys/oracle@devdb Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:40:05 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: DEVDB (DBID=789087786) RMAN>
当然,以上两种方式,也可以使用rman先启动程序,在rman里使用connect连接数据库。
11gdg-> rman Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:42:47 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. RMAN> connect target connected to target database: DEVDB (DBID=789087786) RMAN>
或者
11gdg-> rman Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:42:47 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/oracle@devdb connected to target database: DEVDB (DBID=789087786) RMAN>
退出rman 。 在rman环境下按Ctrl+d,或者输入exit命令。
11gdg-> rman Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:42:47 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. RMAN> connect target sys/oracle@devdb connected to target database: DEVDB (DBID=789087786) RMAN> exit Recovery Manager complete. 11gdg->
rman提供了log参数,可以将rman执行过程中打印的日志重定向到log指定的文件中去。log参数只能在命令行中使用,不能在rman运行环境中使用。
11gdg-> rman target / log=rman.log RMAN> 11gdg-> cat rman.log Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 8 00:47:05 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: DEVDB (DBID=789087786) 11gdg->
本文出自 “叮咚” 博客,请务必保留此出处http://lqding.blog.51cto.com/9123978/1679566
标签:rman
原文地址:http://lqding.blog.51cto.com/9123978/1679566