你好,游客 登录 注册 搜索
背景:
阅读新闻

探索Oracle之RMAN_02基本使用

[日期:2012-05-19] 来源:Linux社区  作者:吴伟龙 [字体:大 中 小]

3、      RMAN的启动:

连接到目标数据库

rman\>connect target  user/pwd@db_name

注意:1、connect不能简写为conn

  2、连接USER必须具备SYSDBA权限

  3、连接的db_name必须在tnsnames.ora中有配置,且有效(即通过SQLPLUS可以连接)

  4、target database 必须为archivelog 模式

  5、如果是本地可以采用OS认证,如果是远程需要使用密码文件认证。

  6、RMAN工具版本与目标数据库必须是同一版本。

 

4、      在RMAN中执行操作系统命令

Egg:

RMAN> run{host "ls -artl";}

 

RMAN> run{host "ifconfig";}

 

RMAN> run{host "pwd";}     

/home/Oracle

host commandcomplete

 

RMAN> run{host "ls";}

 

Desktop  sqlnet.log

host commandcomplete

 

RMAN> exit

 

5、      在RMAN中执行SQL命令对数据库进行操作

5.1 启动关闭数据库

RMAN> shutdown immediate

database closed

database dismounted

Oracle instance shut down

 

RMAN> startup

connected to target database (not started)

Oracle instance started

database mounted

database opened

Total System Global Area     285212672 bytes

Fixed Size                     1218968 bytes

Variable Size                 79693416 bytes

Database Buffers             197132288 bytes

Redo Buffers                   7168000 bytes

 

RMAN>

 

5.2 在RMAN中执行SQL语句

RMAN> sql 'select * fromuser_tablespaces';  

sql statement: select * fromuser_tablespaces

 

RMAN> sql 'alter system checkpoint';

sql statement: alter system checkpoint

RMAN>

为了解释这个问题请参看红色注释

 

注意:

rman is not sqlplus, rman show result of"sql" command, but not show result of 'select ....'

 

5.3 在RMAN中执行bak.sql脚本

RMAN> run {executescript bak.sql}

linux
相关资讯       oracle数据库教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款