今天浏览OCP相关文档的时候,再次看到rman pipe的相关知识点,既然看到了,就做一下实验吧。具体使用方法可参考metalink 116668.1,167919.1。
启动rman 命名管道
[quote][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.[/quote]
创建了命名管道之后在Oracle内部创建了以ORA$开头的命名管道对象
[quote]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[/quote]
可以看到它不属于任何类型
[quote]SQL> select SEGMENT_TYPE from dba_segments where SEGMENT_NAME='ORA$RMAN_P1_IN';
no rows selected[/quote]
往命名管道发送备份表空间命令
[quote]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;
/[/quote]
命名管道接受备份命令并执行
[quote]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.[/quote]
那么在备份的时候数据库等待什么时间呢?
[quote][color=red]RMAN backup & recovery I/O[/color] 485 1 256 4294967295
Streams AQ: qmn slave idle wait 488 0 0 0
jobq slave wait 489 0 0 0
jobq slave wait 492 0 0 0
jobq slave wait 499 0 0 0
jobq slave wait 504 0 0 0
Streams AQ: waiting for time management or cleanup tasks 507 0 0 0
Streams AQ: delete acknowledged messages 509 0 0 0
Streams AQ: waiting for messages in the queue 521 65261 1373053284 3
Streams AQ: waiting for messages in the queue 528 62601 1373050356 3
Streams AQ: qmn coordinator idle wait 535 0 0 0
Streams AQ: qmn slave idle wait 544 0 0 0
smon timer 549 300 0 0
pmon timer 555 300 0 0[/quote]
另外在操作系统级别,并不以rman进程出现
[quote]18472 ora10g 18 0 897m 81m 78m R 6 1.1 0:01.75 oracle [/quote]
启动rman 命名管道
[quote][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.[/quote]
创建了命名管道之后在Oracle内部创建了以ORA$开头的命名管道对象
[quote]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[/quote]
可以看到它不属于任何类型
[quote]SQL> select SEGMENT_TYPE from dba_segments where SEGMENT_NAME='ORA$RMAN_P1_IN';
no rows selected[/quote]
往命名管道发送备份表空间命令
[quote]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;
/[/quote]
命名管道接受备份命令并执行
[quote]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.[/quote]
那么在备份的时候数据库等待什么时间呢?
[quote][color=red]RMAN backup & recovery I/O[/color] 485 1 256 4294967295
Streams AQ: qmn slave idle wait 488 0 0 0
jobq slave wait 489 0 0 0
jobq slave wait 492 0 0 0
jobq slave wait 499 0 0 0
jobq slave wait 504 0 0 0
Streams AQ: waiting for time management or cleanup tasks 507 0 0 0
Streams AQ: delete acknowledged messages 509 0 0 0
Streams AQ: waiting for messages in the queue 521 65261 1373053284 3
Streams AQ: waiting for messages in the queue 528 62601 1373050356 3
Streams AQ: qmn coordinator idle wait 535 0 0 0
Streams AQ: qmn slave idle wait 544 0 0 0
smon timer 549 300 0 0
pmon timer 555 300 0 0[/quote]
另外在操作系统级别,并不以rman进程出现
[quote]18472 ora10g 18 0 897m 81m 78m R 6 1.1 0:01.75 oracle [/quote]