日期:2014-05-16  浏览次数:20551 次

Oracle 10g使用rman pipe
今天浏览OCP相关文档的时候,再次看到rman pipe的相关知识点,既然看到了,就做一下实验吧。具体使用方法可参考metalink 116668.1,167919.1。
启动rman 命名管道
引用
[ora10g@hzmc ~]$ rman pipe p1 target / nocatalog

Recovery Manager: Release 10.2.0.3.0 - Production on Tue Dec 14 14:08:23 2010

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



创建了命名管道之后在Oracle内部创建了以ORA$开头的命名管道对象
引用
SQL>select * from v$db_pipes;
OWNERID NAME                           TYPE     PIPE_SIZE
------- ------------------------------ ------- ----------
      0 ORA$RMAN_P1_OUT                PRIVATE       1424
      0 ORA$RMAN_P1_IN                 PRIVATE       1423

     
可以看到它不属于任何类型
引用
SQL> select SEGMENT_TYPE from dba_segments where  SEGMENT_NAME='ORA$RMAN_P1_IN';

no rows selected


往命名管道发送备份表空间命令
引用
SET SERVEROUTPUT ON SIZE UNLIMITED
DECLARE
V_INPUT VARCHAR2(32767) := 'BACKUP TABLESPACE ZHOU; EXIT;';
V_OUT NUMBER;
BEGIN
DBMS_PIPE.PACK_MESSAGE(V_INPUT);
V_OUT := DBMS_PIPE.SEND_MESSAGE('ORA$RMAN_P1_IN');
DBMS_OUTPUT.PUT_LINE(V_OUT);
COMMIT;
END;
/


命名管道接受备份命令并执行
引用
DECLARE
V_OUTPUT VARCHAR2(32767);
V_OUT NUMBER := 0;
BEGIN
WHILE (V_OUT = 0) LOOP
V_OUT := DBMS_PIPE.RECEIVE_MESSAGE('ORA$RMAN_P1_OUT', 5);
IF V_OUT = 0 THEN
DBMS_PIPE.UNPACK_MESSAGE(V_OUTPUT);
DBMS_OUTPUT.PUT_LINE(V_OUTPUT);
END IF;
END LOOP;
COMMIT;
END;
/

connected to target database: DRB (DBID=3342305182)
using target database control file instead of recovery catalog
RMAN-00572: waiting for dbms_pipe input
Starting backup at 14-DEC-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=93 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00040 name=/Tbackup/mcstar/oradata/zhou02.dbf
channel ORA_DISK_1: starting piece 1 at 14-DEC-10
channel ORA_DISK_1: finished piece 1 at 14-DEC-10
piece handle=/ora10g/oracle/product/10.2.0/db_1/dbs/0clvhsd5_1_1
tag=TAG20101214T142437 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 14-DEC-10
Starting Control File and SPFILE Autobackup at 14-DEC-10
piece handle=/ora10g/oracle/product/10.2.0/db_1/dbs/c-3342305182-20101214-00
comment=NONE
Finished Control File and SPFILE Autobackup at 14-DEC-10
Recovery Manager complete.

PL/SQL procedure successfully completed.


那么在备份的时候数据库等待什么时间呢?
引用
RMAN backup & recovery I/O                                              485          1        256 4294967295
Streams AQ: qmn slave idle wait