一、登陆登出RMAN及相关注意点
1、在oracle账户下,输入rman进入rman环境
[oracle@ocpserver ~]$ rman Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jun 20 20:15:25 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. RMAN>
2、输入connect target /
RMAN> connect target /
connected to target database
RMAN>
说明:
connect target / 和在SQL*PLUS里面的sqlplus / as sysdba有类似的疑问。你也可以输入connect target user/passwd@instance_name 这样进入指定instance;
当然这个命令可以汇总为直接输入rman target /
connect不能像SQL*PLUS里面缩写为conn
3、用rman启动oracle
RMAN> startup; Oracle instance started database mounted database opened Total System Global Area 218103808 bytes Fixed Size 1218604 bytes Variable Size 96470996 bytes Database Buffers 117440512 bytes Redo Buffers 2973696 bytes RMAN>
4、用rman关闭oracle
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN>
5、暂时回到系统界面host
如同SQL*PLUS里面的“!”符号作用一样。其实在SQL*PLUS里面也是可以使用host命令暂时退出SQL*PLUS,输入exit后回到SQL*PLUS欢迎一样。
RMAN> host;
[oracle@ocpserver ~]$ exit
exit
host command complete
RMAN>
6、RMAN界面下执行SQL命令
##RMAN不能执行select语句,郁闷
语法: SQL '<command>' ;
语法比较简单,就是提示符下输入SQL,后接SQL命令,命令用单引号括起来command 通常为可执行的SQL命令语句,也可以为PL/SQL块
使用限制
如果SQL语句中包含文件名,则文件名及路径需要使用两个单引号括起来,整个SQL语句首尾需要使用双引号
可以执行SQL查询语句,但是无任何结果输出
RMAN提示符下常用的命令
- startup [nomount | mount], shutdown immediate
- alter system archive log current
- alter database open [resetlogs]
RMAN> sql 'create table testrman(name varchar2(20),id number)';
using target database control file instead of recovery catalog
sql statement: create table testrman(name varchar2(20),id number)
RMAN>
RMAN> startup nomount;
Oracle instance started
Total System Global Area 218103808 bytes
Fixed Size 1218604 bytes
Variable Size 100665300 bytes
Database Buffers 113246208 bytes
Redo Buffers 2973696 bytes
RMAN> alter database mount;
using target database control file instead of recovery catalog
database mounted
RMAN> alter database open;
database opened
RMAN>
二、登出RMAN
国际惯例,exit,quit,自己试试也就知道了。
三,参考深入学习文档
RMAN入门:http://www.cnblogs.com/Ronger/archive/2011/12/29/2306367.html
RMAN简明使用手册:http://www.eygle.com/digest/2008/05/rman_quickly_manual.html