Can '&' work in host command?
Hi,
I tried to use HOST built-in to send command to Unix but Forms can not display any error. To trap error message, I tried to redirect stderr to file, but Forms seems to fail to send special character '&' to Unix.
For example:
HOST('path/shell_script >& path/log_file');
However, HOST('path/shell_script > path/log_file') works fine without stderr output.
So it is difficult for me to trap error message from Unix in the first place. Any alternative for debugging? I use Forms10g and tcsh in Unix.
Any advice would be much appreciated!
Hi,
normally when you run connection wizard, here once you mention the valid user name and pwd and at the end it will tell you "no application sets available for this user" if this user is not added properly for this application set.
So you should check the secuirty again using your admin user and see that you have added this user, assigned to team/task profile and member access profile. Also check the task profile and member access profiles if they are configured correctly or not.
regards,
Sreedhar
Similar Messages
-
Can't Call host command on Oracle Forms 10g on LINUX ap server
I have oracle developer suite 10g installed on Windows.I want to do some file operation in ap server(linux as 3)
I can use the script in the terminal on linux. but i can't use it on form . this is the button press trigger!
declare
a varchar2(200);
begin
a:='mkdir -p /data/apps/ygm';
-- message(a);
host(a);
end;
When the trigger execute, the linux hasn't do anything!
What should I do?Check and make sure you've added the appropriate bin directories in the default.env file. I ran into the same problem with forms on OAS on HP-UX.
Steve. -
Calling java host command in trigger/PLSQL
I created a java call to execute a linux host command that calls a shell script that will echo out a result. It is owned by SYS and has granted execute to SYSTEM. SYSTEM has a table that monitors accesses to the RDBMS. When a user logs on from a remote server vis sqlplus, this LOGON trigger write to the SYSTEM table (successfully). SYSTEM has a trigger that runs a linux command to execute a shell script that pulls the actual IP address from the remote system. I can run this call from a PLSQL block (outside the trigger) and get a response back like "user:101.101.101.111" but when I have the same user log on, the trigger fires - no errors or exceptions yet no rows are returned. Is there some restriction in a trigger versus just a plsql block call? The java code used is what I found on (http://www.oracle-base.com/articles/8i/ ... mPLSQL.php) and it works perfectly OUTSIDE the trigger but nothing is returned in the trigger firing steps. Any idea?
rdbms: 11.1.0.7, Redhat 4
I know the code works because I can write the host command output to a file. Later in the trigger I can open the file and can read the data that should have been returned in the java host call.FYI - here is the code from your site that I used:
DROP JAVA SOURCE SYS."Host";
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SYS."Host" as import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
if (isWindows()) {
finalCommand = new String[4];
// Use the appropriate path for your windows version.
finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
//finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
else {
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
new Thread(new Runnable(){
public void run() {
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println("Cmd results: " + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process output.");
ioe.printStackTrace();
finally {
try {
br_in.close();
} catch (Exception ex) {}
}).start();
new Thread(new Runnable(){
public void run() {
BufferedReader br_err = null;
try {
br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("Cmd Error: " + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_err.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process error.");
ioe.printStackTrace();
finally {
try {
br_err.close();
} catch (Exception ex) {}
}).start();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows() {
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
/ -
How can I use unix commands from oracle report
I have to use the following command from oracle reports.
In oracle forms we can use the HOST command but what about oracle reports2.5.
I have to email the attached file 100245.pdf from oracle reports to the given email id
uuencode 100245.pdf 100245.pdf | mailx -s "test" [email protected]Hi,
It's because .bat (or .cmd) files are scripts and not executables and are interpreted using the command line executable - which is normally cmd.exe (although you can buy others).
So you need to call cmd.exe passing the bat file name as a parameter, something like
cmd.exe /c batchfilename
Without the /c you will never get a response.
However, this brings us to the bizarre conclusion that you are going to:
call cmd.exe (a shell interpreter)
to launch a batch file
that calls cygwin (another shell interpreter)
which then runs ls
When shouldn't that just be:
call cmd.exe to run the dir command
Or better yet, If you are just after a file name listing and you seem to understand Java stored procs, why not just write a JSP to list the contents of a directory? No problems with OS dependant commands, scripts and 3rd party interpreters. Plenty of examples of that out on the internet as well.
HTH
Chris -
Host command in forms/reports
Is there a host command in reports 6i? I used this in forms 6i. When I tried to use in Reports 6i, I received a compile error.
basically all I need to do is to get directory information. This can be easily done in forms using the host command. Is there any built in package or function to achieve this in reports?
thanksthere is no "host" command in reports 6i (or earlier versions). you might want to consider using forms+reports combination (calling the report from within a form, in which you can execute the host command and do whatever you want to do, then pass the related parameters to the report). I am using this approach to handle some complex end user reporting requirements.
hope this proves useful
regards -
can i user host command in pl-sql. if so then tell me how i can.
Hi, you can't run a host command
directly from pl/sql.
Look at
http://technet.oracle.com:89/ubb/Forum88/HTML/001295.html
for a short description, how it can be done.
HTH
Detlev -
Forms HOST command no longer works after database upgrade from 10g to 11g
Hi,
After upgrading the database 10g to 11g the forms HOST command no longer works on Unix server. The form used to work fine prior the upgrade. I read all the threads I could find and did not see any solutions. Adding PATH and LD_LIBRARY_PATH does not work because it does not even run a basic shell script. (I saw this solution, adding PATH and LD_LIBRARY_PATH, in many questions / threads).
1. I wouldn't expect the database upgrade to be an issue, but it is the only change we had.
2. Note, 11g is Oracle Fusion Middleware which is quite a bit different than 10g.
I even tried the most basic commands like "echo" which is a build-in Unix command and there is no directory for it (ie. no /usr/bin - so variable PATH is irrelvent). i.e HOST('echo hi'); and HOST('echo "hi" '); and even HOST ('echo hi > /my_file.txt'); all returns FORMS_FAILURE (actually the if is IF FORM_SUCCESS THEN ... else ... and the else part always runs now - whereas it didn't before.).
Or basic commands like /usr/bin/ls as in HOST(/usr/bin/ls). At that point I was just testing the Unix command would return FORM_SUCCESS even though I could not see the results (because they weren't writing to a log file). Notice that I'm using the direct path /usr/bin so no Unix environment variables were needed.
The form does use webutil but that part works. For example, we have webutil_file_transfer( ....) The file shows up on the application server and in the expected directory.
Here's the main goal. Upload a file from clients local PC to the datebase server. The form uploads the file to the Application server, then we have a Unix script to scp (secure copy) the file from the application server to the database server. IF webutil, or any other Oracle functions could put the file on the database server that would be better. But, I don't know of any procedures that do that - or would have done it cleanly (i.e. storing to database and write back to server and then using a blob etc. )
Anyway, I was hoping someone would help with either of these.
1) Get the HOST command to work. - If we can get that to work then I wouldn't need any more help. We can just call the already existing Unix script to copy the file from the application server to the database.
2) OR be able to upload directly to the database server - wanted to do that originally
Any help would be appreciatedSolution for those interested and for anyone else searching this forum for a solution
I found this on My Oracle Support:
<h3>Host Command from Forms Not Working in 11g in Sun Solaris Sparc OS [ID 1157346.1]</h3>
Applies To: Oracle Forms - Version 11.1.1.1.0 and later
Sun SPARC Sun OS
Symptoms:
When trying to execute a Shell script or any OS command using the host() Built-in from Forms 11g, the host()command is not getting executed. The same functionality works on other operating systems and in previous versions like 10gR2.
Steps to be followed:
1) Take a backup and edit the $DOMAIN_HOME/config/fmwconfig/servers/WLS_FORMS/applications/formsapp_11.1.1/config/default.env or any custom environment file.
2) Locate the following environment variable:
LD_PRELOAD=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
3) Comment out this variable. After the changes, it will look like the following:
#LD_PRELOAD=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
3) a) Instead of LD_PRELOAD, kindly use LD_PRELOAD_64 as given below :
LD_PRELOAD_64=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
(This makes HOST AND RUN_REPORT_OBJECT work fine).
4) Save the file and execute your forms. The Host() built-in will work as expected
The LD_PRELOAD setting in default.env is only required for the working of signal chaining facility in JVM version 1.5 and later. If you are not using theSignal chaining facility, this variable is not required. For more information, refer to the following documentation
http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14772/forms.htm#CJAJGAFF -
HOST command does not seem to work in deployment system
I am developing forms software for a SUSE Linux system, but the HOST command does not seem to operate correctly when used in conjunction with Application Server.
All I am trying to do is launch Adobe Acrobat reader as a background job using the command :-
HOST('/opt/Adobe/Reader8/bin/acroread &');
but nothing seems to happen.
If I enter the command :-
*/opt/Adobe/Reader8/bin/acroread &*
directly from a shell window (using the same login account) the command works correctly.
I have tried other commands e.g. directory listings etc and all seem to have the same problem.
Furthermore when the same form is run from the development environment using "Internet Developer Suite" it operates correctly with no problems.
I am running on a deployment system where all three tiers of oracle are on the same machine (i.e. Database, AS and web front end).
Can anybody suggest any possible causes or anything I can try to help resolve this problem ?brian_a_j wrote:
Although I still dont understand why HOST would not work given my configuration (the Application Server and Web Browser operate on the same machine).One little test, put the execution command in a shell script and try to execute the script with the HOST command instead of the command itself.
Using HOST the script will be executed on the AS machine no matter from where it is executed.
Tony -
Webutil_file_transfer and host command doesn't work
I use a host command in forms to execute a sql-script, which creates a file on AS. After the host command I use webutil_file_transfer to ftp the created file to the client. If I try to do this again in the same session, the host command fails. I have to restart the application to get it working again. If I leave out the webutil_file_transfer I have no problems whatsoever. It looks like webutil is changing something perhaps in the environment. Anyone has the same problem (and a suitable solution)?
I can remove the files on AS (so there seems to be no lock). After removal of the files, no new files wil be created, even if I change the name of the file that needs to be created. Only restarting the application helps.
Raoul -
Can PL/SQL Run Host Command (DOS Command) ??
Hi All,
Can PL/Sql run HOST Command ?
If can't, iis there any other way to execute the DOS command ?
Thanks for help.
IwanHi sarah,
i have tried, but it didn't work.
in my abc.sql script : (host in pl/sql level)
BEGIN
HOST('cmd /C dir *.*');
END;
exit
but it still didn't work
so i tried in sqlplus level :
variable vStatus VARCHAR2(1);
variable vCmd VARCHAR2(3000);
BEGIN
:vCmd := 'C:\Program Files\Internet Explorer\iexplore';
END;
HOST("C:\Program Files\Internet Explorer\iexplore");
EXIT;
if i put HOST("C:\Program Files\Internet Explorer\iexplore"); --> it worked....
If i put HOST(:vCmd); --> i won't work.
Any body can help ?
Thanks,
Iwan -
Forms HOST command on WebLogic not working.
I am attempting to issue a HOST command from Forms 11g on a WebLogic Application Server (running on Solaris) to execute a server-side shell script.
I previously had no problem doing this using OAS10g (also running on Solaris), but all attempts on WebLogic set FORM_FAILURE to TRUE, and I do not know how to trace the error or cause of the problem.
To recreate, create a simple Form with a Text Item (ITEM4) and Command Button (ITEM5).
When-Button-Pressed trigger on ITEM5 contains the following code:
HOST(:item4);
IF FORM_FAILURE THEN
message('Form Failure occurred');
END IF;Transfer to Form server, and compile.
Even supplying '/bin/ls' as a command produces the error message.
As I mentioned, this was previously working without a problem on OAS10g on Solaris, so I am unsure if WebLogic requires some sort of different Security or privileges to be specified for the Forms Application component.
Cheers,
Marc.
Edited (code formatted) by: sirmarc on Oct 11, 2011 4:41 PMThe problem is most often caused as a result of not having the necessary environment variables available to execute the command in question. When the shell is launched using HOST, most of the typical variables are stripped. Specifically PATH and LD_LIBRARY_PATH. As a result, you need to create your own script to call and not call the command directly. The script would include the setting of the necessary environment variable before calling the wanted command.
You can try adding the needed variables to the default.env. In many cases, these will be picked up, it will just depend on exactly what it is you are trying to execute. So for example in default.env add to the existing PATH entry something like this or whatever is appropriate for your system> /usr/bin:/usr/ucb:/etc:.
Do not delete any of the existing entries in default.env and most importantly, do not use variable references. You must fully qualify your entries. Variables like $PATH are not permitted. -
10g Host command imp.exe not working
Hi,
Just created a relatively simple form that uses host command.
I create a sql script using text_io to create a new user.
I then use host to run that script on the app server.
All this works fine.
Then i use host command to try and import into the db. This is when it does nothing.
I have cut it down to bear bones and a button with the command:
host('D:\oracle\database\BIN\imp.exe LOG=D:\test.log');This doesnt even create the log "test.log"
If i copy and paste this into the run box on the app server the log is created?
Any ideas?
Thankshi
first try to import by using dos go to start,run and cmd something like this.
c:\Imp user/pass@orcl file=c:\file.dmp log=c:\log_name.log full=y
What is import/export and why does one need it?
Oracle's export (exp) and import (imp) utilities are used to perform logical database backup and recovery. When exporting, database objects are dumped to a binary file which can then be imported into another Oracle database.
These utilities can be used to move data between different machines, databases or schema. However, as they use a proprietary binary file format, they can only be used between Oracle databases. One cannot export data and expect to import it into a non-Oracle database.
Various parameters are available to control what objects are exported or imported. To get a list of available parameters, run the exp or imp utilities with the help=yes parameter.
The export/import utilities are commonly used to perform the following tasks:
Backup and recovery (small databases only, say < +50GB, if bigger, use RMAN instead)
Move data between Oracle databases on different platforms (for example from Solaris to Windows)
Reorganization of data/ eliminate database fragmentation (export, drop and re-import tables)
Upgrade databases from extremely old versions of Oracle (when in-place upgrades are not supported by the Database Upgrade Assistant any more)
Detect database corruption. Ensure that all the data can be read
Transporting tablespaces between databases
Etc.
From Oracle 10g, users can choose between using the old imp/exp utilities, or the newly introduced Datapump utilities, called expdp and impdp. These new utilities introduce much needed performance improvements, network based exports and imports, etc.
NOTE: It is generally advised not to use exports as the only means of backing-up a database. Physical backup methods (for example, when you use RMAN) are normally much quicker and supports point in time based recovery (apply archivelogs after recovering a database). Also, exp/imp is not practical for large database environments.
[edit] How does one use the import/export utilities?
Look for the "imp" and "exp" executables in your $ORACLE_HOME/bin directory. One can run them interactively, using command line parameters, or using parameter files. Look at the imp/exp parameters before starting. These parameters can be listed by executing the following commands: "exp help=yes" or "imp help=yes".
The following examples demonstrate how the imp/exp utilities can be used:
exp scott/tiger file=emp.dmp log=emp.log tables=emp rows=yes indexes=no
exp scott/tiger file=emp.dmp tables=(emp,dept)
imp scott/tiger file=emp.dmp full=yes
imp scott/tiger file=emp.dmp fromuser=scott touser=scott tables=dept
Using a parameter file:
exp userid=scott/tiger@orcl parfile=export.txt
... where export.txt contains:
BUFFER=10000000
FILE=account.dmp
FULL=n
OWNER=scott
GRANTS=y
COMPRESS=y
NOTE: If you do not like command line utilities, you can import and export data with the "Schema Manager" GUI that ships with Oracle Enterprise Manager (OEM).
[edit] Can one export a subset of a table?
From Oracle 8i one can use the QUERY= export parameter to selectively unload a subset of the data from a table. You may need to escape special chars on the command line, for example: query=\"where deptno=10\". Look at these examples:
exp scott/tiger tables=emp query="where deptno=10"
exp scott/tiger file=abc.dmp tables=abc query=\"where sex=\'f\'\" rows=yes--------------------------
You can also use DBMS_DATAPUMP.
For example, you can start the export job from a PL/SQL package with the following PL/SQL code:
declare
handle number;
begin
handle := dbms_datapump.open('EXPORT','SCHEMA');
dbms_datapump.add_file(handle,'SCOTT3.DMP','DUMPDIR');
dbms_datapump.metadata_filter(handle,'SCHEMA_EXPR','= ''SCOTT''');
dbms_datapump.set_parallel(handle,4);
dbms_datapump.start_job(handle);
dbms_datapump.detach(handle);
end;
/ sarah -
Host command is not working on linux
Hi
I m using linux for application server n windows for client. I need to create folder from client machine by cliking a button of forms10g runtime.HOST command is not working which was working fine in windows.
Any help is appriciateable.
kazi mokaremHi
I had the same issue on linux a few weeks back. What tuned out was, when you install the Oracle app svr it does not include the system paths by default.
The path where mkdir is located may not be visible to the app.
Try to hardcode the path for mkdir as /bin/mkdir .... and seee if that works.
If the above statement works then add that path in the paths variable in default.env file located in $ORACLE_HOME/forms/server directory
HTH
Arvind -
How can I use variable name as a prameter value in HOST Command ???
Hi All,
How can it possible to use variable value in parameter in HOST command ??
Following in my code:
host('rwclient server=reptest report=c:\cust_print.rdf p_1= s_sam_cust_id userid=wh1/wh1@dwh desformat=pdf desty=file desname=c:/temp/'||v_sam_cust_id||'.pdf');
RegardsHello,
The Syntax of the builtin HOST is :
SyntaxPROCEDURE HOST
(system_command_string VARCHAR2);
PROCEDURE HOST
(system_command_string VARCHAR2,
screen_action NUMBER);
So , you can build the system_command_string as any VARCHAR2
Example are provided in online help :
http://www.oracle.com/webapps/online-help/forms/10g/topics/f1_help/builth_m/host.html?tp=true
Regards -
Host command not working properly
Hi,
I am using oracle forms 10.1.2.0.2.
In my form, I need to call a unix shell script.
{ Oracle forms will run on application server.
Unix will run in a development server.
(Both the servers are different)
From forms, if I click a button, it should call the unix shell script in a specified path.
Internally, the unix script will call oracle to generate a file.
In the file, some manipulations are done using unix.
After doing some manipulations, the file is stored in a specified path in the unix box. }
To achieve the above, I did the below things.
To execute a unix shell script from my oracle forms (10g),
1) the below configuration i added in the webutil.cfg file
install.syslib.0.user.1=ffisamp.dll|40960|1.0|true
transfer.database.enabled=TRUE
transfer.appsrv.enabled=TRUE
transfer.appsrv.workAreaRoot=c:\temp
transfer.appsrv.accessControl=TRUE
#List transfer.appsrv.read.<n> directories
transfer.appsrv.read.1=c:\temp
#List transfer.appsrv.write.<n> directories
transfer.appsrv.write.1=c:\temp
2) I have attached webutil.pll library to my form
3) I have subclassed object group from webutil.olb to my form.
4) The host command i used is (these code are present in when-button-pressed trigger of a button)
host('rsh selvas -l administrator sh <foldername>/if_csv.ksh',NO_SCREEN);
if form_failure then
emessage('hi selva');
emessage(SQLERRM);
else
emessage('failure selva');
end if;
when I click the button, I am getting the below messages,
hi selva
normal, successful completion
Also, the script is not executing and it is not giving me the desired result.
Can any one help me, where I am missing.
Thanks,
Selvarajhi steve,
Thanks for your response
after the host command i added like this
host.....;
pause;
if form_failure then
emessage('hi selva');
else
emessage('failure selva');
end if;
when I executed,
I got the below messages
PLEASE ACKNOWLEDGE
-- when i clicked ok,
it showed me failure selva
but still the shell script has not executed.
Note:
In /tmp directory, no log files are available.
Can you plz help
thanks,
selvaraj
Maybe you are looking for
-
The following scenario: Mac HD: iPhoto Libary External HD: all photos which are shown in iPhoto now I want to copy back the photos from the external HD to the mac hd and I want iPhoto to know the new location of all these photos (couple of 10 thounsa
-
RFC to XI File - can NEVER EVER get more than one record in Output file.
Hi guys This might be related to my other post on File conversion but whatever I do I just can't seem to get more than one record in the output file the payload from R3==> XI seems fine for example <?xml version="1.0" encoding="UTF-8" ?> - <rfc:Z_XI
-
System copy optimzation of import on DB2 LUW
I am looking for system copy optimzation of import on DB2 LUW. R3load version is 640. IBM redbook (sg247774 DB2 Optimization Techniques for SAP Database Migration and Unicode Conversion) gives some general recommendations: 1) Use the DB2 LOAD API wit
-
Hi experts, in order to have one rate table with one Group of product freight Groups and another one for the 2 nd Group without creating new material groupings, I am using rate table Determination. I created a condition at master data -> Charge Manag
-
Sent Mail success but the Mail Server said it time out
I try CSEmail from coolservlets.com and in the first tiem, it working, but after that the mail server say Winsock 10052, software cuased a conenction abort.. I use Mdaemon 3.2 Any one can help me... I and the timer to maximum, and still error... but