Execution of shell script using OSLinetoken fetchlet
HII,I have a requirement. I need to use a shell script in the fetchlet of OSLineToken. In the metric system of response I will check whether or not the directory already exists on the server. To verify the existence of the directory, I created a shell script. But how can I report its result with the metric of the answer? The shell script is as follows:
Shell script:
If test d $1; then
echo "DIR exists."
on the other
echo 'no '.
FI
The answer for the same metric will be:
< QueryDescriptor FETCHLET_ID = "OSLineToken" >
< property NAME = 'command' SCOPE = 'GLOBAL' >
SH {nom_repertoire where the shell script is transferred} / {shell script file name} {dir_name_parameter} < / property >
< property NAME = 'startsWith' SCOPE 'GLOBAL' = > em_result = < / property >
< property NAME = "separator" SCOPE = 'GLOBAL' > | < / property >
< / QueryDescriptor >
Please suggest what is the use of em_result here?
Once the existence of the directory is checked, if it upward, then I need to call another shell script to concatenate the contents of all files with .log extension (this will be the setting of shell script). Get the output of shell script and view it in custom management plug-in. As I use cat *.log > > consolidatefile command to concatenate the data, I need to read the file consolidatefile from the server and return these data to concatenated plug-in file. Yet once, how can I read the contents of the consolidatefile file in EMF? I will create another matrix to this effect say 'read_content '. the querydesciptor the same thing will be as follows:
< QueryDescriptor FETCHLET_ID = "OSLineToken" >
< property NAME = 'command' SCOPE = 'GLOBAL' >
SH {nom_repertoire where the shell script is transferred} / {shell script file name} {dir_name_parameter} {extension of the files concatenated} < / property >
< property NAME = 'startsWith' SCOPE 'GLOBAL' = > em_result = < / property >
< property NAME = "separator" SCOPE = 'GLOBAL' > | < / property >
< / QueryDescriptor >
I'm not sure what all the properties to use in this case... I saw that several example files use some of them perbin, scriptsdir, but some of them do not... The related pdf also does not say anything about this kind of properties. Please suggest.
I hope that the explanation of the problem is not so heavy. Please let me know if you have any question to understand.
Thank you
AS
The guide of extensibility will have instructions on how to package your files as an Archive Plug-in management (MPA). Once you have this file archive, the EM grid control will point to import your plug-in management (MP) in the repository. Once imported, you can deploy them through the user interface for all agents in your grid control. (You can get to the UI Plug - ins by clicking on Setup in the upper right corner, then management Plug-ins to halfway down on the left side of the page).
When the MP is deployed to the agent, the emx /
Properties with a range of systemeparametres get their values from the emd.properties file. If you decide to put up on the agent (which is probably easier than reconditioning of all your files whenever you are editing, and then re-importation and redeploy their), you will need to create the directory structure in the % scriptsDir %. So if you finally Pack your plug-ins all work even.
Tags: Enterprise Manager
Similar Questions
-
Call a shell script using the OA framework page.
Hi all
I'm new to Framework.There OA is a condition in which I have to call a shell script using a Web page using OA framework. Can someone shed some light on how can we do this?
ConcerningHello
You can save the script shell as simultaneous program and submit this OAF page request.
Sambi
-
Call the batch file and not the shell script using measures of the event
Can I use EVENTACTIONS at the door of gold like
eventactions (SHELL, /path-to-batch-file/test1.bat)
will this work? I am on a windows machine, so I need to run a batch file and not a shell script
In GGSCI, you can shell OUT to the BONE and call a command/executable file.
For example on Windows:
GGSCI (WIN2003) 2 > shell dir
Volume in drive C has no label.
Volume serial number is 8CCC-9E58
Directory of C:\ggs
18/08/2012 07:23
. 18/08/2012 07:23
... 2010-10-15 06:37 bcpfmt.tpl 426
2010-10-15 06:37 bcrypt.txt 1 725
22/04/2011 03:41 2 560 category.dll
05/11/2011 10:43
cfg 2010-10-15 07:15 739 chkpt_ora_create.sql
...
What were the results when you tried this in an EVENTACTIONS clause?
-
OEDQ 9.0.8 - external task - execution of Shell Script
Hello Disqualification Experts.
I am looking for your expert advise on this... With the help of the external task I am able to call the .bat (batchfiles) but I'm not able to run .ksh (UNIX shell script file), attached is the example script I am trying to run via the external task.
File name: testfile.ksh
#! / usr/bin/ksh
Set - x
$ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqd < < EOF
WHENEVER SQLERROR EXIT SQL. SQLCODE
EXECUTE SP_TRUNCATE_TABLE ('ABC_OWN', 'ABC_TABLE');
COMMIT;
quit smoking;
EXPRESSIONS OF FOLKLORE
output
Disqualification-> Manager-> External tasks-> Creates a new task called TestTask who has the below...
Command: testfile.ksh
Working directory: \opt\local\software\edq\config\commandarea
Get this error Message:
The external task (Execute testfile.ksh) failed because of the following exception: cannot run program "/ opt/local/software/edq/config/commandarea/testfile.ksh": error = 2. No such file or directory
Thanks in advance!
BG
Dear Richard, thank you for your prompt response.
# / bin/bash helped and I also have to export the ORACLE_HOME in the script, somehow the $ORACLE_HOME is not recognized by the external task.
Example of Script working:
#! / bin/bash
export ORACLE_HOME=/ora02/oracle/product/11.2.0.4/client
$ORACLE_HOME/bin/sqlplus - s edq_test/edqtest@edqdev<>
WHENEVER SQLERROR EXIT SQL. SQLCODE
EXECUTE SP_TRUNCATE_TABLE ('ABC_SCHEMA', 'ABC_TABLE');
COMMIT;
QUIT SMOKING;
EXPRESSIONS OF FOLKLORE
output
Thanks for your help!
BG
-
ORA-01017 encountered during execution of shell scripts
Hello
During execution of the backup script for one of my databases, the script contains a login section which breaks down as shown below
Section login script:
sqlplus / < < END > /tmp/$PROGRAM.tmp
Error generatedf in the log file:
SQL * more: Production release 11.2.0.3.0 on sea Apr 10 11:32:06 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-01017: name of user and password invalid. connection refused
Two points to note:
1) there are two other databases on the same server and they have no problem
(2) I am able to connect to this database as ' / '.
(3) I am able to connect to the database as sysdba from another server
(4) the script runs successfully when I change like: sqlplus / as sysdba < < END > /tmp/$PROGRAM.tmpHi, for the use of this you must create a user authenticated externally then it will work... Check other databases where you are using the sqlplus / connection for your refrence command
-
Execution of the script using the shortcut key will launch the ExtendScipt Toolkit.
Run the script by using the shortcut key assign will launch the ExtendScipt Toolkit in a machine.
Maybe not the Script because it works normally if a double-click is used to run instead.
Another idea?
What shortcuts are you trying to use? If they include the shift or Alt/Option keys, then ESTK is raised to the top because it is this that these keys if you hold either button down on launching a script.
Dave
-
using DBFS file system for request shell scripts
Guy
We use DBFS application shell scripts using Korn shell scripts. The default shell for use is/bin/ksh
Exadata = X 2-2
version = 11.2.2.2.1 BP4
Version Oracle = 11.2.0.2
WARNING: incorrect syntax, perhaps a fake '-'? See /usr/share/doc/procps-3.2.7/FAQ
-ksh: xxx.ksh: xxx.ksh: cannot run [bad address]
When you run as
ksh xxx.ksh it works fine
Thank youMOS 1054431.1 also discusses this:
"DBFS filesystems can always hold files of shell script or binary file, but if it is mounted with the direct_io option, files on DBFS is not executable. In this case, a second file DBFS system may be used because it can be mounted without the option direct_io to support executable files or scripts. »
-
I decided to use OSLineToken fetchlet to call Java and return a set of values delimited. I expected, as the OSLineToken documentation suggested that each row is row and each comma in a line would look like a column. Here is an example of the returned output, pre-OSLineToken:
pool-0, AnotherProject, NoCache, z2, gzip, all the
pool-0, AnotherProject, simple, z, off, all
by default, test, pool-0, z2, off, all
by default, whql1, pool-0, z2, off, all
by default, whql2, pool-0, z2, off, all
by default, whql3, pool-0, z2, off, all
by default, whql4, pool-0, z2, off, all
I was hoping 'that' it would be bound to a table in my collection of parameters in search of something like
Pool | Project | FS | Profile | Compress | Other
pool-0 | AnotherProject | NoCache. Z2 | gzip | all the
....
And as such, built my collection of metadata
< Metric NAME = "LogicalInformation" TYPE = "TABLE" >
< display >
< NLSID label = "logical_info" > device logical Configuration < / Label >
< / display >
< TableDescriptor >
< ColumnDescriptor NAME = 'Pool' TYPE = "STRING" >
< display >
< NLSID label = "pool_identifier" > hen < / Label >
< / display >
< / ColumnDescriptor >
< ColumnDescriptor NAME = "Project" TYPE = "STRING" >
< display >
< NLSID label = "project_name" > project < / Label >
< / display >
< / ColumnDescriptor >
< ColumnDescriptor NAME = "Share" TYPE = "STRING" >
< display >
< NLSID label = "ShareName" > FS < / Label >
< / display >
< / ColumnDescriptor >
< ColumnDescriptor NAME = "DataProfile" TYPE = "STRING" >
< display >
< NLSID label = "data_profile" > profile < / Label >
< / display >
< / ColumnDescriptor >
< ColumnDescriptor NAME = "DataCompression" TYPE = "STRING" >
< display >
Compress < NLSID label = 'data_compression' > < / Label >
< / display >
< / ColumnDescriptor >
< ColumnDescriptor NAME = 'Other' TYPE = "STRING" >
< display >
< NLSID label = 'other' > other < / Label >
< / display >
< / ColumnDescriptor >
< / TableDescriptor >
< QueryDescriptor FETCHLET_ID = "OSLineToken" >
<Property NAME="command" SCOPE="GLOBAL">%emdRoot%/jdk/bin/java -Djava.library.path=%dll% -classpath %emdRoot%/sysman/admin/scripts/emx/my_agent/TestXMLRPCWorkflows.jar:%emdRoot%/sysman/admin/scripts/emx/my_agent/xmlrpc-common-3.1.2.jar:%emdRoot%/sysman/admin/scripts/emx/my_agent/xmlrpc-client-3.1.2.jar:%emdRoot%/sysman/admin/scripts/emx/my_agent/ws-commons-util-1.0.2.jar:%emdRoot%/sysman/admin/scripts/emx/my_agent/commons-logging-1.1.jar com.sun.myagent.client.RetrieveLogicalTopology mysystem.yadda.com root s0ftware. System.out < / property >
< property NAME = "separator" SCOPE = 'GLOBAL' > < / property >
< / QueryDescriptor >
< / metric >
But alas, all I get in the emagent.trc file is the following (and in the GUI a big read 'ERROR' with an x by him in this group of settings).
2009-06-23 12:50:28 upload Thread-249852 ERROR: error when you rename the file in addXmlFileToUpload. : error = 2: no such file or directory
2009-06-23 12:51:08 engine Thread-249872 ERROR: metric has no keys, but the result has several lines
2009-06-23 12:51:08 engine ERROR Thread-249872: [sun_storage_7000, isv - 7110 h, LogicalInformation]: nmeegd_GetMetricData failed: metric has no keys, but the result has several lines
I didn't expect that I would need to key in the returned array (none of the examples in the guide of extensibility really talk about this)... in fact, I can't find anywhere that talks a lot about the relationship between the fetchlet OSLineToken, the parsed table and a corresponding TableDescriptor / metric definition would look like.
No clues to help me cut down on hit / miss on this one?
PaulFor any measure where you are going to return several rows, you must designate one (or more) of your columns as key columns. Each line must be able to be identified uniquely by this column (or columns collection).
-
import program does not process customized when you use the shell script
Hello
I have the pkg in that
PROC1 without leaving param in this procedure, I call you created proc2 import and program
Now, I call this proc1 in the shell script, here my flat program to import does not work
Why? and I try to use CONSCUB on proc1 using 2 output param which is errbuf, retcode in the newspaper, I'm "wrong number of arguments"
Please help me?
Thank you
Renon,
Proc1 is your first program at the same time, right?
How many parameters is defined for that?
You can paste a screenshot of the window parameter?
If there is no parameter, just use this:
$FND_TOP/bin/CONCSUB $LOGIN SQLAP 'Accounts payable Manager' WAIT ' rajesh' = N SIMULTANEOUS SQLAP PROC1
Assuming that "Renon" is a username of fnd and the program is set in the Application of accounts payable.
See you soon
AJ
-
Call Shell Script from within PL/SQL - using DBMS_PIPE
Hi all
I'm trying to run a shell script inside my PL/SQL using DBMS_PIPE block (not sure if this is the right way or not)
Pl Sql script
==========
Set serveroutput size 100000
declare
cursor c1 is select * from mag_images
where nom_image like '% comp2.
v_path varchar2 (100): = ' / home/maguzzi/DOCUMENTS_DIR / ";
v_result number: = 0;
v_in_filename varchar2 (100): = v_path | ' test_file.jpg';
v_out_filename varchar2 (100): = v_path | ' test_file_out.jpg';
v_script varchar2 (100): = "tst_convert.sh";
v_command varchar2 (200): = 'sh'. v_path | v_script | » '|| v_in_filename | » '|| v_out_filename;
Start
A1 to c1 loop
dbms_output.put_line ('v_command: ' | v_command);
write_to_file ('test_file.jpg', 'DOCUMENTS_DIR', a1. Content);
dbms_output.put_line (' file write result: ' | v_result);
v_result: = exec_host_command (v_command);
dbms_output.put_line (' resize result :'|| file v_result);
end loop;
end;
Result DBMS_OUTPUT
====================
v_command: /home/maguzzi/DOCUMENTS_DIR/tst_convert.sh test_file.jpg test_file_out.jpg
Result of the entry of the file: 0
Result of resizing the file: 0
PL/SQL procedure successfully completed.
Function exec_host_command
=======================
FUNCTION to CREATE or REPLACE exec_host_command (lc_cmd IN VARCHAR2)
RETURN INTEGER IS
ln_status NUMBER;
lc_errormsg VARCHAR2 (80);
lc_pipe_name VARCHAR2 (30);
BEGIN
lc_pipe_name: = 'Maguzzi_PIPE ';
DBMS_PIPE. PACK_MESSAGE (lc_cmd);
ln_status: = dbms_pipe.send_message (lc_pipe_name);
RETURN ln_status;
END;
/
The Image of the BLOB is written to the correct location on the server "test_file.jpg", and although the exec_host_command function returns a value of 0, the shell script (tst_convert.sh) is not executed (i.e. no output file is created - outfile.txt and the image is not copied/converted to a new file name "" test_file_out.jpg" )
Shell script
========
tst_convert.sh
echo 'Here' > outfile.txt
Echo $1 > > outfile.txt
Echo $2 > > outfile.txt
resizing to convert $1 - $200 2
Could this be problems with permissions on files?
test_file1.jpg has permission - rw-rw-r-
test_convert.sh a permission rwxrwxrwx
When I run the script manually and pass in 2 parameters ($1 = infilename and $2 = outfilename), it works...
I'd appreciate if someone can point out my mistake or suggest another method that works.
Thanks in advance
How long does it take to create the converted file? Remember that the external Scheduler is running asynchronously, so it is possible that the converted file does not exist yet when the PL/SQL block subsequently tries to open it.
Try to add some delay seconds to the routine to ensure that the external task is completed:
begin dbms_scheduler.create_job( job_name => 'MAG_IMAGE_CONVERT2' , job_type => 'EXECUTABLE' , job_action => '/home/oracle/DOCUMENTS_DIR/tst_convert2.sh' );-- '/home/oracle/DOCUMENTS_DIR/tst_convert.sh'); dbms_scheduler.enable('MAG_IMAGE_CONVERT2'); dbms_lock.sleep(3); end;
This probably isn't really a viable solution in the long term if it turns out that this is really the problem.
-
Using the shell script sql variable
OS: Oracle Linux 5.10
DB Oracle 11.2.0
I have need to query the database and assign the return value to a variable of shell, but it does not work.
create table imr_env (key varchar2(1000), value varchar2(1000) ; insert into imr_env values('TblspcUsagePct','90'); commit;
Here is the shell script:
#!/bin/bash echo "in script" ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ; export ORACLE_HOME ORACLE_SID=IMR1 ; export ORACLE_SID export PATH=$PATH:$ORACLE_HOME/bin pct=`sqlplus -S app/manager <<END set serveroutput on declare output_val number ; BEGIN select value into output_val from imr_env where key = 'TblspcUsagePct' ; dbms_output.put_line('output_val: ' || to_char(output_val)) ; END ; / exit; END` ## another sqlplus connection, use $pct in the where clause echo "var value is $pct"
Here is the result:
SQL> ./test.sh in script var value is output_val: 90
Why isn't the shell variable is populated with the value retrieved from the database?
I need to use $pct in another query that will be storage spaces that are at least 90% full.
I had to change to a korn shell - I couldn't get the "READ" command in shell or bash.
But it is not only "READ" command:
SQL > select * from IMR_ENV;
THE KEY VALUE
------------------------- -----
TblspcWarningLimit 90
TblspcUsagePct 50
SQL > exit
Disconnected from the database to Oracle 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
$ cat test.sh
VAL = $(sqlplus-S test/test)<>
Set feedback off
set the position
Select (value) from imr_env, including the key to_number = "TblspcUsagePct";
Select (value) from imr_env, including the key to_number = "TblspcWarningLimit";
"exit";
EXPRESSIONS OF FOLKLORE
)
set $VAL
Echo $1
Echo $2
$./test.sh
50
90
$ echo $SHELL
/ bin/bash
$
-
Need to call the Shell script that uses SQL loader in APex4.1 / 11g
Hello!
I have a requirement in which I need to call a shell script that connects to an external server, FTP to a file and then use sqlloader to load data into our table. We have now the ftp script that accomplishes this task to another program, but is a scheduled task. I wanted to call the script ftp in the APEX. Any suggestions on how this can be done, what is the logic of PL/SQL can we use? I saw online some people using DBMS Scheduler for this?
Thank you
SunHello
Create some sh script on your computer host oracle where you can join in the external server and run the process.
something like:run_external_sh.sh
#!/bin/sh ssh ext_user@ext_host ./sqlloader/import/import.sh
Then create an external TASK to call it via ORACLE (PL/SQL)
-Shell Script call.
BEGIN DBMS_SCHEDULER.create_program ( program_name => 'external_call_sh', program_type => 'EXECUTABLE', program_action => '/local_host/call_external/sh/run_external_sh.sh', number_of_arguments => 0, enabled => TRUE, comments => 'Call external SH script'); END; /
You can now create a regular / or unplanned WORK
-Job defined by the calendar and an existing program.BEGIN DBMS_SCHEDULER.create_job ( job_name => 'jb_external_call_sh', program_name => 'external_call_sh', schedule_name => 'external_call_scheduler', -- created scheduler enabled => TRUE, comments => 'Job defined by an existing external_call_sh program and schedule.'); END; /
You can now call the WORK in the APEX in the process of PL/SQL.
BEGIN -- Run job synchronously. DBMS_SCHEDULER.run_job (job_name => 'jb_external_call_sh'); END;
Concerning
J :D -
How to use select into command in shell script?
I need to get the total number of rows in a table using select count (*) table and must assign a shell script variable. I used the following script, it returns the number of lines, but also with oracle headers, please help me to remove the headers.
Shell script
#! / bin/sh
Count = "sqlplus $username/$password@$tnsname < < EOF"
NEWPAGE 0 VALUE
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET THE POSITION
Select count (*) in the table.
"exit";
EXPRESSIONS OF FOLKLORE"
echo "the value is"$count"
O/P:
SQL * more: Release 10.2.0.4.0 - Production on game Dec 22 05:01:33 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64 bit Production with the partitioning, options Real Application Clusters, OLAP, Data Mining and Real Application Testing
SQL > SQL > SQL > SQL > SQL > SQL > SQL > SQL 525935 SQL > >
Disconnected from the database to Oracle 10 g Enterprise Edition Release 10.2.0.5.0 - 64-bit options of Production with the partitioning, Real Application Clusters, OLAP, Data Mining and Real Application TestingUse SQL * Plus silent mode. Change:
Count = "sqlplus $username/$password@$tnsname<>
TO
Count ='sqlplus- s $username/$password@$tnsname<>
SY.
-
How to write the CLOB parameter to a file or a XML using shell script?
I run an oracle stored procedure using shell script. How can I get the OUT of the procedure (CLOB) parameter and write it to a file or a XML in UNIX environment using shell script?
Edit/Delete MessageSQL> var c clob SQL> SQL> begin 2 select 3 DBMS_XMLGEN.getXML( 4 'select rownum, object_type, object_name from user_objects where rownum <= 5' 5 ) into :c 6 from dual; 7 end; 8 / PL/SQL procedure successfully completed. SQL> SQL> set long 999999 SQL> set heading off SQL> set pages 0 SQL> set feedback off SQL> set termout off SQL> set trimspool on // following in the script is not echo'ed to screen set echo off spool /tmp/x.xml select :c from dual; spool off SQL> SQL> --// file size SQL> !ls -l /tmp/x.xml -rw-rw-r-- 1 billy billy 583 2011-12-22 13:35 /tmp/x.xml SQL> --// file content SQL> !cat /tmp/x.xml
1 TABLE BONUS 2 PROCEDURE CLOSEREFCURSOR 3 TABLE DEPT 4 TABLE EMP 5 TABLE EMPTAB -
Coil PL/SQL parameter value using shell script
Hello
I execute PL/SQL procedure using shell script. I want the value of parameter in a coil OUTPUT text file. to_msg is the IN OUT parameter in the script below. Is this possible?
sqlplus test/***@db < < EOFSQL
COIL Status.txt
HEAD off SET
SET SERVEROUTPUT ON
declare
to_msg varchar2 (8000): = 'status ';
EXEC P_Status (to_msg);
SPOOL off
"exit";
EOFSQLAravindhK wrote:
Thanks for your reply. When I roll the result, sql statements is also copied to the text file. How can I eliminate the sql statements.What are the results when you do as below
sqlplus-s
Maybe you are looking for
-
If I type a url and press on enter it does not find this website, I have to click the green arrow at the end of the url box. If I choose a url in the url box drop he won't find the web site, I have to click the arrow on the green at the end of the ur
-
Equium L20 constantly out hot air
Hello I've had my Equium L20 for about 2 years now and I am a little concerned about my vents on the left side of the laptop.He is constantly out hot air, - is this normal?Because I don't know that it is only used to make from time to time with huge
-
CQ61-312SA: Presario CQ61 does not boot, black screen.
In setting in motion: LEDs LED power supply front and button cases NIPWireless LED lightsAbove the touchpad LED lights continuouslyLEDS near caps lock and above paved digital flash streamingNo sign of drive activity, no fan noise, the screen remains
-
drive hard not Windows XP Pro SP3
What size hard disk Windows XP Pro SP3 supports the promary score?
-
The display of the external hard drive content
Hello I have a Maxtor external hard drive and I want to view the content on this laptop (Dell Inspiron 1545), how do I access files? Any idea of it please. John