这是将 Oracle Recovery Manager 与 Oracle Job Scheduler 结合使用的有效方法吗?
首先,我正在创建一个可执行作业:
BEGIN
DBMS_SCHEDULER.CREATE_JOB(job_name => 'PIPE_JOB', job_type => 'EXECUTABLE', job_action => 'RMAN PIPE TEST_PIPE_1 target / TIMEOUT = 60');
END;
接下来,我尝试使用这一系列 Oracle 命令执行该作业:
DECLARE
pipename CONSTANT VARCHAR2(100) := 'TEST_PIPE_1';
create_result INTEGER;
send_result INTEGER;
BEGIN
create_result := DBMS_PIPE.CREATE_PIPE(pipename);
DBMS_PIPE.PACK_MESSAGE('BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DEVICE TYPE DISK DATABASE INCLUDE CURRENT CONTROLFILE;');
send_result := DBMS_PIPE.SEND_MESSAGE(pipename);
DBMS_SCHEDULER.RUN_JOB(job_name => 'PIPE_JOB', use_current_session => false);
END;
现在,当我调用 RUN_JOB 时,RMAN 可执行文件会在服务器上启动,但随后可能会立即退出因为它永远不会收到我试图打包到管道中的命令。
如何正确使用管道使 RMAN 接收我尝试发送的命令?
First, I am creating an executable job:
BEGIN
DBMS_SCHEDULER.CREATE_JOB(job_name => 'PIPE_JOB', job_type => 'EXECUTABLE', job_action => 'RMAN PIPE TEST_PIPE_1 target / TIMEOUT = 60');
END;
Next, I am trying to execute the job with this series of Oracle commands:
DECLARE
pipename CONSTANT VARCHAR2(100) := 'TEST_PIPE_1';
create_result INTEGER;
send_result INTEGER;
BEGIN
create_result := DBMS_PIPE.CREATE_PIPE(pipename);
DBMS_PIPE.PACK_MESSAGE('BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DEVICE TYPE DISK DATABASE INCLUDE CURRENT CONTROLFILE;');
send_result := DBMS_PIPE.SEND_MESSAGE(pipename);
DBMS_SCHEDULER.RUN_JOB(job_name => 'PIPE_JOB', use_current_session => false);
END;
Now, when I make the call to RUN_JOB, the RMAN executable fires up on the server, but then immediately exits, presumably because it never receives the commands that I am attempting to pack into the pipe.
How can I use pipes correctly to make RMAN receive the commands I am trying to send it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您不能为此使用 DBMS_PIPE。它是一个 PL/SQL“东西”,而不是 RMAN 可以处理的东西,也不像 unix 管道到 STDIN 那样。
不过,您可以使用 DBMS_SCHEDULER 进行参数设置。您可能需要一个介入的 shell 脚本。
[额外]
我有一个带有一个或多个参数的 shell 脚本
shell 脚本将调用 RMAN 并通过 STDIN 将参数通过管道传递给它。
I don't think you can use DBMS_PIPE for this. It is a PL/SQL 'thing' and not something RMAN can deal with, and not like unix pipes to STDIN.
You can do parameters with DBMS_SCHEDULER though. You may need an intervening shell script.
[Added]
I'd have a shell script that takes one or more parameters
The shell script would call RMAN and pipe the parameters to it through STDIN.
看来我之前错了,RMAN可以与DBMS_PIPE一起使用。
文章此处。我自己不太明白,但博客上的评论可能会提供更多细节
Looks like I was wrong before and RMAN can be used with DBMS_PIPE.
Article here. Don't understand it myself, but a comment on the blog may give some more details