Dbms_Pipe Package.
Hi,
Can any one please tell me for which perpus we have to use dbms_pipe package.Please give one simple example.
Thanks,
Sanjeev.
user13483989 wrote:
Can any one please tell me for which perpus we have to use dbms_pipe package.Please give one simple example.For the same reason pipes are used when writing code that runs directly on the operating system (instead inside Oracle) - IPC or Inter Process Communication.
See http://en.wikipedia.org/wiki/Inter-process_communication for basic details.
Similar Messages
-
Problems using DBMS_PIPE package
Hi! Im using the SQL Navigator for Oracle to develop PL/SQL code and now I've got a problem with the DBMS_PIPE package. When i use the methods like create_pipe etc. in a normal pl/sql window it works without problems. But when i place such a DBMS_PIPE.CREATE_PIPE... call into a function in my own pl/sql package there's the error PLS-00201: identifiere 'sys.dbms_pipe' must be declared!
what do i have to do to use the dbms_pipe package in a package developed by my own.
thanks in advise
Ingologin to your SYS schema and grant execute on the DBMS_PIPE package to the oracle user under which you
are creating your PL/SQL procedure:
SQL> grant execute on SYS.DBMS_PIPE TO <username> ; -
DBMS_PIPE package in the library
Where do I find the DBMS_PIPE package. Right now I'm working on migrating forms to 6i. And i got this error in a procedure(G$_GET_PIPE_MESSAGES) which is called in a trigger.
DBMS_PIPE package has
1. PACK_MESSAGE procedure
2. SEND_MESSAGE function
3. RECEIVE_MESSAGE function
4. UNPACK_MESSAGE proceduredbms_pipe is a database package owned by SYS:
http://www.oracle.com/pls/db102/ranked?word=dbms_pipe&remark=federated_search
cheers -
Hi,
Below block is executed successfully but when i use it to dynamically fetch the values in SQL* Plus no values are getting printed.
Please help me out in rectifying the issue.
SET serveroutput on size 1000000
SET wrap on
SET linesize 80
DECLARE
v_text VARCHAR2 (4000);
v_res NUMBER;
v_num NUMBER;
v_date DATE;
v_usr user_users.username%TYPE;
v_err NUMBER;
pipe_name VARCHAR2 (300);
BEGIN
pipe_name := DBMS_PIPE.unique_session_name;
LOOP
v_res := DBMS_PIPE.receive_message (pipe_name, 2);
DBMS_PIPE.unpack_message (v_date);
DBMS_PIPE.unpack_message (v_usr);
DBMS_PIPE.unpack_message (v_num);
DBMS_PIPE.unpack_message (v_text);
DBMS_OUTPUT.put (TO_CHAR (v_date, 'DD-MON-YYYY HH24:MI:SS') || ' ');
DBMS_OUTPUT.put (v_usr || ' ');
DBMS_OUTPUT.put (v_num);
DBMS_OUTPUT.new_line;
DBMS_OUTPUT.put_line (' ' || v_text);
EXIT WHEN v_res = 0;
END LOOP;
END;
/kumar0828 wrote:
Yes i understood that.
When the PL/SQL block encounters the DBMS_OUTPUT_PUT_LINE that time the contents of the array will be displayed on the terminal.As Billy already said. This is wrong. SQL*plus will read and show the content of the buffer if certain circumstances are met. Therefore you will first get the message: Pl/sql Block executed. Then you will get the message from the buffer.
I want to know whether the code is proper to store the contents into the array. This code will try to read from apipe that is only known to your session. Usually pipes are used to read messages from other sessions.
This line would prevent that.
pipe_name := DBMS_PIPE.unique_session_name;It will read data from a pipe that does not exists outside of your own session. Is that what you want?
Edited by: Sven W. on Sep 25, 2012 12:07 PM -
Security Implications of PUBLIC on packages
What are the security implications if a commercial software package that we use requires that dbms_pipe and dbms_lock be granted to PUBLIC? This seems pretty dangerous to me, or are there some controls that make this not so dangerous?
Thanks,Depends what sort of security concerns you have...
I wouldn't be overly concerned about users accidentally causing problems using the dbms_pipe or dbms_lock packages. You could write a procedure that sleeps for a while, which might cause problems if that happened in the middle of a transaction, but that's a performance issue that ought to be identified in testing.
If your concern is with a determined attacker, I would tend to be more cautious with the dbms_pipe package, particularly if the application is piping data between processes, since an attacker could listen in on that conversation. Potentially, an attacker could cause application errors by sending messages to a process that caused it to stop waiting too soon.
Realistically, on the list of sins most third party database software is guilty of, these seem like pretty small potatoes.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
hi,
iam looking at logging event with trigger concept ,in that trigger use dbms_pipe to send the message , but i am confused where send has been send . please tell me for what purpose logging events and use of dbms_pipe.797525 wrote:
iam just student when i going through the triggers concept i found event logging ,message has been send through the dbms_pipe ,let me write code.,I'm guessing this is a rather old book. It wouldn't make sense to use DBMS_PIPE for this sort of thing in any reasonably modern system.
but if i run this query
errrors shows that declare dbms_pipe error.Most likely, whatever user owns the trigger does not have access to the DBMS_PIPE package. The DBA would need to grant the user EXECUTE access on DBMS_PIPE for this code to compile.
and you ask me about log file on database or flat file i really don't know
if it is how to view in log file ,where it will be located if oracle 10g.Without some other process that is listening on the same port and unpacking the messages, this call to DBMS_PIPE won't be written anywhere. It would be lost at a minimum when Oracle shut down. You'd need to have something like an external application that knows to look for a pipe named INV_PIPE and to pull messages from that pipe. That external application would have to write the message somewhere that you could see it.
Justin -
DBMS_PIPE FOR IN-HOUSE CHATTING
hi everybody!
i wanted to know if i could use dbms_pipe package for making an application for chatting between different users simultaenouslyIt is probably possible to get this to work, but it may be more painful that the alternatives...
If you have a long-runing process, Oracle provides a view to let you monitor its progress v$session_longops. You can use the DBMS_APPLICATION_INFO package to record user-defined information into this view. Oracle Enterprise Manager has a nice interface for displaying the information in this view with a progress bar that you might be interested in mimicing in your application.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Dbms_pipe / maxpipesize / locking
i use dbms_pipe in an application for debugging in development environment:
this environment consists of the following parts:
1) oracle server with plsql application and dbms_pipe for debug messages (SEND_MESSAGE)
2) windows service with odp.net waiting for messages from pipe (RECEIVE_MESSAGE) servicing multiple clients over telnet connection (broadcasts the debug message from pipe on all clients connected with telnet)
everything works fine - but some questions are open:
my sending pipe func looks like following:
create or replace PROCEDURE "DEBUG" (p_mandnr number, p_msg varchar2, p_type number) as
v_status number:=0;
v_lockHandle varchar2(200);
begin
dbms_lock.allocate_unique('control_lock', v_lockHandle);
v_status := dbms_lock.request(v_lockHandle, dbms_lock.x_mode);
if v_status=0 then
if v_status=0 then
dbms_pipe.pack_message(length(p_msg));
dbms_pipe.pack_message(p_msg);
dbms_pipe.pack_message(p_mandnr);
dbms_pipe.pack_message(p_type);
v_status := dbms_pipe.send_message('plsql_debug',0,1000000000);
if v_status<>0 then
dbms_pipe.purge('plsql_debug');
v_status:=dbms_pipe.remove_pipe('plsql_debug');
end if;
end if;
v_status := dbms_lock.release(v_lockHandle);
end if;
exception
when others then
case sqlcode
when -6558 then -- ORA-06558: buffer in dbms_pipe package is full. No more items allowed
dbms_pipe.reset_buffer;
else
null;
end case;
v_status := dbms_lock.release(v_lockhandle);
end;
1) do i have do lock the access to the pipe ?
2) if i specify a maxpipesize in the SEND_MESSAGE call with an implicity created pipe - what happens, if the message length is less than maxpipesize
3) what happens, if the windows service (RECEIVE_MESSAGE) do not run (so is not consuming messages from pipe), but the oracle server is writing messages to the pipe:
- the pipe gets an overflow ?
- if maxpipesize is reached the pipe is purged?
- if sending is blocked, so the SEND_MESSAGE returns immediately or waits for free space in the pipe (HORROR - so the entire application would be blocked)
- is there a life-timeout for messages in the pipe ?
thx for helpingYou are able to execute it using an anonymous block because you have the execute privilege via a role. To be able to create procedures with it, you must be granted the execute privilege on SYS.DBMS_PIPE directly, not via a role.
So log in as SYS, execute "grant execute on dbms_pipe to <your user>" and you are able to create your own procedures with dbms_pipe.
Groet,
Rob. -
DBMS_JOB & DBMS_PIPE to mimic multithreaded application
I am trying to use the DBMS_PIPE and DBMS_JOB PL/SQL packages (in 8i)
to write a multithreaded Oracle package.
By what I understand, the psuedo-code for my main and child procedures
would be something like:
PROC 1
- Setup DBMS_PIPE package to receive messages
- Spawn other procedure (PROC 2) multiple times using DBMS_JOB
- Recieve messages from spawned procedures using DBMS_PIPE
END PROC 1
PROC 2
- Do processing
- Send message to PROC 1 using DBMS_PIPE
END PROC 2
What I would like is any examples of working code that anyone may have
that can do just this. It does not appear too difficult but it's
easier to work from an example givin that I have not done this before.
Thanks
Paul..i would see that more as a candidate for using
advanced queuing .. than dbms_job nor _pipe
by using different queue tables
..its more easy i think and maybe more stable ..;)
Matthias -
is it possible to use dbms_pipe for sessions on different servers? like i've a plsql code with dbms_pipe. Can I pass messages in this pipe to a shell script (service) that is running on another server?
The dbms_pipe definition is given as :
The DBMS_PIPE package lets two or more sessions in the same instance communicate.
What does the same instance mean here?
Message was edited by:
user519027This is my req.
I've some files on a Unix machine which doesn't have any DB
I've DB on another server.
Now, I've to write a plsql code on the DB server to check for the validations of the filename and directory given as input to plsql. ie.. need to check if the file exists on the Unix machine or not. Then I've to send the status back to plsql (file exists or not).
Does this answer you? -
Invoke and Execute Unix command from Oracle PL/SQL
Dear All,
I am currently working in the development of multi user application in ORACLE.
My problem is,
I have to remove a temporary file created in unix server when a particular condition is satisfied in a PL/SQL proccedure.
I searched for this and got solution to use DBMS_PIPE package.
Can you help me how to pack the content 'rm file_name' from different users working in different sessions and how to execute. Can you please explain me how the server manages calls from different sessions and replies to individual sessions.
Thanks in advance,
Shenbaga.Well if doesn't raise an exception it succeeded. Is that sufficient acknowledgement?
Cheers, APC -
How to retrieve information on UNIX Host from oracle Forms
Hi,
Has anybody tried to retrieve manipulated information
on the Unix Server From the oracle forms running on a client ?.
If it is to be done by user exit and calling the pro*c code
then where should the pro*c code exist ?. on server or on client.
1. If on server then can that code return the value to form ?.
2. If on client then can that code access the unix server and
return the value ?..
OR
any other method or tool to do the above.
Thnaks and regards
nullI can only tell you what we've done for our system. We have
client applications which need to send/recv information from the
UNIX server (report submission, etc.)
We have a deamon (written in PRO*C) which runs on the UNIX
server. This deamon constantly monitors a pipe (using the
DBMS_PIPE package available with ORACLE 7.1). The client apps.
send requests through this pipe and wait for the server deamon to
process the request and send responses down a "return pipe".
This approach has served us well.
With ORACLE 8, you can (according to what I've read) link
external object modules (similar to ORA_FFI on the client), which
would make these OS specific functions available to the database
developer via PL/SQL but we're just now looking at ORACLE 8 so I
have no first hand experience with this.
gautam (guest) wrote:
: Hi,
: Has anybody tried to retrieve manipulated information
: on the Unix Server From the oracle forms running on a client ?.
: If it is to be done by user exit and calling the pro*c code
: then where should the pro*c code exist ?. on server or on
client.
: 1. If on server then can that code return the value to form ?.
: 2. If on client then can that code access the unix server and
: return the value ?..
: OR
: any other method or tool to do the above.
: Thnaks and regards
null -
Calling shell script from sql procedure
Hi gurus
Is it possible
1)to call a shell script from sql procedure
2)that shell script has to return one value
3)and again sql procedure(calling shell script) has to capture the return value.
please help me to write this scriptYou may NOT have EXECUTE privilege/ permissions on the DBMS_PIPE package. Check with your DBA.
Using DBMS_PIPE may not be that simple to implement. Just making a call to DBMS_PIPE procedure will not do anything. It will NOT trigger anything on the UNIX side.
. You will also need to :
1. Write a job (ie CRON) at UNIX side which will keep read the incoming pipe for new messages, Unpack the message and get the command to be executed at the UNIX side -- There will be a lot of work involved here + DBA presence/activity is also required.
As Justin has pointed out, try and use HOST command which is very simple or try and use Java.
Shailender Mehta -
Accepting userinput in stored procedure
Hi
I'm writing a stored procedure which will prompt the user to enter his username as
saying 'Please enter your User ID' . I've written the procedure as
create or replace
PROCEDURE Proc_AddUser AS
ACCEPT username CHAR PROMPT 'PLEASE ENTER YOUR FIRST NAME: ' ;
BEGIN
username := '&username';
DBMS_OUTPUT.PUT_LINE(username);
END Proc_AddUser;
It gives the following error during compilation
Error(3,17): PLS-00103: Encountered the symbol "CHAR" when expecting one of the following: := . ( @ % ; not null range default character
I also tried something like this
create or replace
PROCEDURE Proc_AddUser AS
username varchar2(20);
BEGIN
username := '&username';
DBMS_OUTPUT.PUT_LINE(username);
END Proc_AddUser;
But when I run it it says something like this in the running log
Connecting to the database RigManagementDatabase.
&username
Process exited.
Disconnecting from the database RigManagementDatabase.
Warm Regards,
Rahul Guha RayStored procedures, by definition reside in the DB server. And they know nothing about screen, keyboard or mouse, that are commonly used to enter data and that are managed by client applications - one of them being SQL*Plus which does have some rudimentary facilities for client imput (meaning in comparison with forms-driven applications built using some development environment).
Stored procs can communicate at runtime through files - using utl_file package, alerts - using dbms_alert package and pipes - using dbms_pipe package. Maybe you wish to read some documentation on these Oracle supplied packages. That means that some process (at OS level) will write to a file, or will be connected to the DB and signal an alert or write to a pipe, and the stored proc running will handle the data from that source. -
Call to Operative System function from DB procedure stored
I need to call some unix's function just like copy and delete files, but these, in a DB procedure stored...
there are some package or function (like 'Host()' in sqlplus), for make a call a OS funtions from a DB procedure stored???
I'm using a Oracle 8.1.5...
thanks for your helpHi,
If you only need to do file i/o, then use the utl_file package. Otherwise, you might need to use the dbms_pipe package and have a little server program sitting on the other end of the pipe waiting to do operating system tasks. There are many new packages with 8i, look over them before trying the dbms_pipe option.
Maybe you are looking for
-
Hi All: Im having a problem with the find command in Bridge. Basically it cant seem to find anything. It cant even find a file in a folder that Im looking at with Bridge. No mater what search criteria I select Bridge reports that there is nothing to
-
Crash report Monotype SkyFonts
Hello, installed program crashes with report. My other mac same application runs without problems. What could be the problem? Process: Monotype_SkyFonts [639] Path: /Applications/Monotype SkyFonts.app/Contents/MacOS/Monotype_SkyFon
-
When going to the SELL area of ebay, I can use every part except the description area. I hover the mouse over , the arrow is there but you can't click on it to start typing. Ta Jan.
-
I would like to display a Tree report in a list. I zeroed in on the following function group SEUT which contains the following function module RS_TREE_LIST_DISPLAY. Can some one provide me with the procedure to follow to go about using the functions
-
Losing portelt session after every request
Using bwa wl portal server 8.1 on wxp sp2 Hello all We wrote some JSR 168 compliant portlets and deployed them accoring to the bea doc. Basically our portlets seem to work. However, there are some issues that could be tracked down to one problem: Som