现在的位置: 首页 > 综合 > 正文

ORACLE10G RMAN中run代码块中自动释放通道

2013年09月18日 ⁄ 综合 ⁄ 共 1002字 ⁄ 字号 评论关闭

        在RMAN的run代码块中,oracle会自动释放channel,不用手工书写release channel channelname语句,测试如下:

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

      C:/Documents and Settings/Administrator>rman target /

恢复管理器: Release 10.2.0.1.0 - Production on 星期一 11月 13 21:58:44 2006

Copyright (c) 1982, 2005, Oracle. All rights reserved.

连接到目标数据库: MYTESTDB (DBID=4023194148)

RMAN> run
2> {
3> allocate channel channel1 type disk;
4> sql 'alter system switch logfile';
5> }

使用目标数据库控制文件替代恢复目录
分配的通道: channel1
通道 channel1: sid=137 devtype=DISK

sql 语句: alter system switch logfile
释放的通道: channel1

RMAN>

不过感觉最好还是写上release channel ...,这样是一个好的习惯,而且代码前后照应,比较美观:

RMAN> run
2> {
3> allocate channel channel1 type disk;
4> sql 'alter system switch logfile';
5> release channel channel1;
6> }

分配的通道: channel1
通道 channel1: sid=137 devtype=DISK

sql 语句: alter system switch logfile

释放的通道: channel1

RMAN>

抱歉!评论已关闭.