Running a file beats of a stored procedure
This is part II of theI thought I was opening a new thread
I thought I had this fiqured out, but it still does not work
(1) I gave to CREATE a TASK EXTERNAL to my user
(2) start the OracleJobScheduler Service
3)
create or replace
PROCEDURE RUN_OS_COMMAND(p_cmd IN varchar2)
is
v_job_exists pls_integer:=0;
begin
select count(1)
into v_job_exists
from all_scheduler_jobs
where job_name='JAVA_EXE';
if v_job_exists>0 then
dbms_scheduler.drop_job(job_name =>'JAVA_EXE');
end if;
dbms_scheduler.create_job
( job_name =>'JAVA_EXE'
, job_action =>p_cmd
, job_type =>'executable'
, enabled =>false
, auto_drop =>false
, start_date =>systimestamp
);
dbms_scheduler.run_job(job_name =>'JAVA_EXE');
end;
test.bat is del test.csvI run this
begin
RUN_OS_COMMAND('C:\temp\test.bat');
end;
/
anonymous block filledIt runs without error, but does not run in the file bat... What am I I miss, thanks Doug
C:\temp\test.bat
make the content of the above file be below lines
CD C:
CD \temp
the value > capture.log
After the series of tests capture.log exist?
What is its content?
Tags: Database
Similar Questions
-
Error 1051030 - all by running a file beats running a MXL
I have a BAT file that runs a MXL file. The MAXL file runs EAS calculation scripts. He worked previously, but off delay all beats by running the file I get this error. (See below)
When I log in INJURED I can run scripts. If the planning application exists and works. By browsing the Oracle Forum and documentation, I noticed when the file essbase.cfg is corrupted these types of errors can occur. I think the Essbase file is in good shape. Thoughts and suggestions are very appreciated.
If you start a session MaxL and connecting with the same user admin2, running
display application;
Is the application that you are having problems with return to the list of applications.
See you soon
John
-
can I run a file of commands of a stored procedure.
Y at - it an easy way to call a file beats using a stored procedure oracle under windows.
Thank you
DougDepending on the version of your database, you can use JAVA or DBMS_SCHEDULER.
http://www.Oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:16212348050Search this forum and two sites for more examples.
-
A query in the stored procedure
Hello
I use EXECUTE IMMEDIATE to run a DDL statement in a stored procedure.
But I can't see this picture, please tell me why.
create or replace procedure names
is
Start
EXECUTE IMMEDIATE ' CREATE TABLE execute_table (col1 VARCHAR (10))';
commit;
end;
*/*
Created procedure.You must perform the procedure as well; only for creating it does not table:
BEGIN NAmes; END; OR EXEC NAmes; (from SQL*PLUS)
-
How to run a stored procedure by using the steps in database?
Hello
I'm trying to run some procedures of the store and it will not work.
See the file attached is seq.
I have a varchar parameter (50), which must also be provided to the stored procedure and it returns an int.
To do this I had to only use data in an open statement
-
Cannot load the file DOC ID 109095.1 java stored procedure
Hello. I'm trying to follow the documentation for 109095.1 (How to perform a system call to a Java Stored Procedure and capture the output) and after I try to load the java file I received the following two errors below. In some of the forum posts I met and performed various controls as well and from what I can tell, it seems that the java install my have broken or is not installed properly in the first place (unknown previous state). Some of the results of the checks are also lower.
[dcampoy@prd oracle] $ loadjava u dcampoy / * - diagram t_super_user - v CaptureStream.java
arguments: '-u' ' dcampoy / *' '-schema ' 't_super_user' '-v' "CaptureStream.java".
creation: source T_SUPER_USER. CaptureStream
loading: source T_SUPER_USER. CaptureStream
Error creating source CaptureStream
ORA-06550: line 1, column 75:
PLS-00201: identifier ' DBMS_JAVA. SET_COMPILER_OPTION' must be declared
ORA-06550: line 1, column 75:
PL/SQL: Statement ignored
ORA-06550: line 1, column 239:
PLS-00201: identifier 'NameFromLastDDL' must be declared.
ORA-06550: line 1, column 231:
PL/SQL: Statement ignored
Audits
SQL > DESC DBMS_JAVA
ERROR:
ORA-04043: object DBMS_JAVA does not exist
Runtime Environment Java was also (JAVA_HOME, $PATCH, and)
$LD_LIBRARY_PATH)
There are other tables with stored java information but I'm unable to find those queries I has used last week. I do remember every time they were ran zero rows were returned. I will try and get that information. Any assistance is much appreciated thank you.
Thank you! That seemed to be the case because I had to install java in the database running the two files below sql. I also ran select it under check that java has not been installed. After installing both .sql files, I was able to download my java files successfully.
SQL > @? / JavaVM/install/initjvm. SQL and
SQL > @? / RDBMS/admin/catjava. SQL
set line 200
wrap off Set
Col ComputerName format a20
Select ComputerName, VERSION, dba_registry;
COMPUTERNAME Version STATUS -------------------- ------------------------------ --------------------------------------------
Oracle Enterprise Manager 11.2.0.3.0 VALID Oracle 11.2.0.3.0 database catalog VALID Oracle 11.2.0.3.0 database Pack VALID Oracle Real Application 11.2.0.3.0 VALID -
How to view the run log in the stored procedure?
Hello
I'm working on a project of migrating from Sybase to Oracle (10g).
On Sybase, when I run a stored procedure, it will connect to the console as:
100 rows inserted
200 rows affected
...
One line per request in the stored procedure.
Oracle, I only: 'Procedure completed successfully' (Yes, I'm french :-)
Is there a way to get the logs for each request in my stored procedure?
-An option?
-One command after each request?
Thanks in advance.user9321154 wrote:
OK, it's great.Otherwise, there is not an option on Oracle to achieve this same result automatically.
No, if you want to do this, you must do it yourself. PL/SQL is a real language, not a script like T - SQL language. Therefore, it is the procedure that one is successful or not, not every instruction.
You should also be aware that if you use % ROWCOUNT SQL to get the number of rows processed and DBMS_OUTPUT. Put_line to show them on the screen, that the output will not appear before once you have completed the process, not as each DBMS_OUTPUT statement is processed.
If you want to t shelves where in the procedure, you will need to insert the release of record in a table by using an autonomous transaction or something like UTL_FILE use to write the instructions in an o/s file.
John
-
How to run/call a cfm in a stored proc Oracle file?
Hi all! I'm quite new to Oracle PL/SQL stored procedure. Is this possible and how you call/execute a file coldfusion from an Oracle stored procedure? I know that cfm files can call stored procedures. What about the reverse? Ideas or suggestions is appreciated. Thank you...I'm having a hard time trying to think of why you really want to do something like that. However, all this side, the answer is no. The database has no real "knowledge" on ColdFusion and there is no way for PL/SQL to "run" anything on the ColdFusion server. Maybe if you were more specific about what you have actually tried to do instead of a generic question, someone might be able to help to find an alternative.
Phil
-
Create a journal of stored procedure when it is run through dbms_jobs...
Hello everyone,
I have a stored procedure that we run it through dbms_jobs...
I wanted to print the dbms_output of my stored procedure in a log file or in short I just wanted to create logs for this stored procedure...
I know that if I run this procedure using cron, I'll be able to create a log file...
But how can I do this using dbms_jobs
Database version: 10.2.0.1
Any help would be great...
Thank youIf the answer has helped you please mark it as Correct or relatively useful so another can benefit.
With greetings
Krystian Zieja
[Project Envision | http://www.projectenvision.com] -
Hello
I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...
HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport "
... ");resCode = DBExecutePreparedSQL (hstmt);
resCode = DBClosePreparedSQL (hstmt);
... but in this case, I am not able to read the return value of the stored procedure.
I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?
No idea how to solve my problem?
Cake of KR
DianaS salvation,
Thanks for your comments. During this time I found another way which fullfill my needs:
resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);
sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)
{
/ * Enter values in the record. */
resCode = DBGetColInt (hstmt, 1, & s32_TestId);
}resCode = DBDeactivateSQL (hstmt);
sz_Buffer is the content of the XML file.
Cake of KR
-
Hello
How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.
Thank you
Jay.
Hi if your task is running an informatica mapping you can set your DAC task to run the full mapping for incremental and full loads, so tab task just point to the mapping.
Hope that helps.
Thank you
-
Apex. Submit->; process to run one of the two stored procedures on page
version: 4.2.5
page one region: form on the stored procedure
region of page two: form on the stored procedure
The region button 'submit' for the region page 2:
ACTION: Redirect URL
Run Validations: YES
Target URL: javascript:apex.submit ('CALL_MY_PROC');
'Treatments' execute the stored procedure
Point process: submit now - after calculations and Validations
Enforcement process: once a Page visit (by default)
...
Conditions
When you press the button:-no Condition button
Condition type: request = Expression 1
Expression 1: REQUEST = CALL_MY_PROC
The expected behavior is to call the stored procedure in the region on two page without invoking the other stored procedure. Separation of concerns is desired, this button sends the form this proc, this button argues that form to this proc. Nor should call each other, so to speak.
The stored procedure is not called when I click 'Submit' (button from region to region page two). How can I solve this?
Thanks in advance for any guidance.
-abe
Solution: the status... are not REQUEST =
-abe
-
Re: "insufficient privileges" error when you run the Java stored procedure in another schema
I get an "insufficient privileges" error when you run the Java stored procedure in another schema, see details below. I don't know what are missing privileges (I already granted the EXECUTE privilege), suggestions? -Thank you.
Define a simple java class and deploy it as a Java stored procedure to test:
Schema: User1
test of the package;
public class HelloWorld {}
public HelloWorld() {
Super();
}
public static String Hello () {}
Return "HELLO";
}
}
CREATE or REPLACE FUNCTION HELLO RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME ' test. HelloWorld.hello () return java.lang.String';
Grant execute on USER2 HELLO
Test the Java stored procedure through the PL/SQL function call (in the same schema):
Schema: User1
SET SERVEROUTPUT ON
DECLARE
v_Return VARCHAR2 (200);
BEGIN
v_Return: = User1. HELLO;
DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);
END;
anonymous block filled
v_Return = HELLO
Test the Java stored procedure through the PL/SQL function call in a different pattern:
Schema: USER2
SET SERVEROUTPUT ON
DECLARE
v_Return VARCHAR2 (200);
BEGIN
v_Return: = User1. HELLO;
DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);
END;
Error report-
ORA-01031: insufficient privileges
ORA-06512: at "User1." HELLO', line 1
ORA-06512: at line 4 level
01031 00000 - "insufficient privileges".
* Cause: An attempt was made to change the user name or password
without the privilege appropriate. This error also occurs if
trying to install a database without the need for employment
access privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
If the user has been granted the privilege necessary for a higher label
that the connection is active.
* Action: Ask the database to perform the operation or grant administrator
the required privileges.
For users Trusted Oracle get this error, well that granted the
the privilege that is suitable for the top label, ask the database
administrator to grant the privilege to the appropriate label.
You have created the function with AUTHID CURRENT_USER, which means that the function is executed with the rights of the applicant (but not with the rights of the author). This means that the applicant must have grants (directly or through roles) on all used/accessible objects in the service. In your case the user USER2 has not granted with EXECUTE on the class/source Java test. Class HelloWorld, causing the ORA-01031 exception. You create service without AUTHID CURRENT_USER (i.e. with AUTHID DEFINE, which is by default, if you do not have a specific reason to use AUTHID CURRENT_USER) or grant EXECUTE on JAVA test SOURCE. Class HelloWorld to User2.
Dimitar
-
Hello
Can someone help us please on this issue we have; If a solution is already available somewhere on the forum please link me to it.
Please see our situation;
The script below was part of the customization of a colleague to a script of Oracle FDM ("AftFileImport").
There are no screenshots at this stage that came back to us with a temporary workaround.
More detailed description:
We built a custom report of FDM ("FSBValidationErrorsforAllLocations") that accepts two parameters (CatKey, period) and which calls a procedure stored in SQL Server with the same two parameters. FDM SQL statement of the report is:
RUN FSBValidationErrorsforAllLocations ' ~ time ~', ~ Cat Key ~
It works through the User Interface.
When you try to put the two settings by customizing the event Oracle 'AftFileImport'script, the report fails. Below the part of the code in the 'AftFileImport', where we tried to fill values:
- objReport.mParametersClear
- objReport.mParametersAddNew "CatKey", RES. PstrCat
- objReport.mParametersAddNew 'Period', RES. PstrPer
We must understand why the way above to the definition of the parameters does not work with stored procedures, as seems to be the only documented way Oracle of setting parameters.
Please let me know if that's enough.
Thank you in advance.
Hello
which is the error when you run the script?
- objReport.mParametersAddNew "Cat Key", RES. PstrCat
Try again with the white space as it is how you named your parameter in the report definition, didn t you?
Also try to use the built like the following examples:
objRP.mParametersClear objRP.mParametersAddNew 'Period', CDate (dtePeriod) objRP.mParametersAddNew 'Loc', CLng (lngLocation) objRP.mParametersAddNew 'CatKey", CLng (lngCatKey) objRP.mParametersAddNew "TargAcct", CStr (strAutoMapAcct) Concerning
-
Error of insufficient privileges on the creation of model running in a stored procedure
Hello
I get the error of insufficient privileges on execution of the DBMS_DATA_MINING. Script CREATE_MODEL in a stored procedure.
If I run the same DBMS_DATA_MINING. Script CREATE_MODEL in an anonymous block with just begin... end;
I am able to create a model successfully, but if I do the same thing after having stored the script in the stored procedure, it is throwing error of insufficient privileges.
Scripts:
BEGIN
DBMS_DATA_MINING. () CREATE_MODEL
Model_name = > < template name >
mining_function = > dbms_data_mining. CLASSIFICATION,
DATA_TABLE_NAME = > < data table name >
CASE_ID_COLUMN_NAME = > < case ID >
target_column_name = > < target column >
SETTINGS_TABLE_NAME = > < settings table >
DATA_SCHEMA_NAME = > < schema >
SETTINGS_SCHEMA_NAME = > < schema >
);
END;
The foregoing, works very well and created a model with the model given with success.
But if I keep the above, in a stored procedure as - MINING_TESTING
create or replace procedure MINING_TESTING as
BEGIN
DBMS_DATA_MINING. () CREATE_MODEL
Model_name = > < template name >
mining_function = > dbms_data_mining. CLASSIFICATION,
DATA_TABLE_NAME = > < data table name >
CASE_ID_COLUMN_NAME = > < case ID >
target_column_name = > < target column >
SETTINGS_TABLE_NAME = > < settings table >
DATA_SCHEMA_NAME = > < schema >
SETTINGS_SCHEMA_NAME = > < schema >
);
END;
Compiles correctly.
Enforcement - EXEC MINING_TESTING;
Error message throw sufficient privileges.
The error message complete below:
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "SYS." DBMS_DATA_MINING', line 1798
ORA-06512: at "MIS_ORABI_ODM.CA_MINING_TESTER", line 3
ORA-06512: at line 1
01031 00000 - "insufficient privileges".
* Cause: An attempt was made to change the user name or password
without the privilege appropriate. This error also occurs if
trying to install a database without the need for employment
access privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
If the user has been granted the privilege necessary for a higher label
that the connection is active.
* Action: Ask the database to perform the operation or grant administrator
the required privileges.
For users Trusted Oracle get this error, well that granted the
the privilege that is suitable for the top label, ask the database
administrator to grant the privilege to the appropriate label.
Hello
DataMiner UI grants privileges to a role, so if you're depending on these privileges you must proceed as follows when you create a stored procedure.
Your stored procedure was created with the default authid which is definers. It will not use the privileges for the role. Solution is to create the stored procedure with authid current_user. This will pick up the privileges for the role. Another option is to apply the following subsidies directly to the user account:
grant CREATE MINING MODEL
CREATE THE TABLE,
IN ORDER TO CREATE
Example of stored procedure:
create or replace procedure MINING_TESTING AUTHID CURRENT_USER as
BEGIN
DBMS_DATA_MINING. () CREATE_MODEL
MODEL_NAME =>
mining_function-online dbms_data_mining. CLASSIFICATION,
DATA_TABLE_NAME =>
CASE_ID_COLUMN_NAME =>
target_column_name =>
SETTINGS_TABLE_NAME =>
DATA_SCHEMA_NAME =>
SETTINGS_SCHEMA_NAME =>
);
END;
Thank you, Mark
Maybe you are looking for
-
Where the toolbar is on iTunes 12.3.2?
Where is preferences and toolbar gone? I want to transfer items purchased on my windows laptop and have no idea how to proceed.
-
Re: Want to HP dv7 - no sound on the TV when it is connected via a HDMI cable
Hello. I would also like to ask for help because I'm faced with the same question. what I'm trying to get a sound with HDMI, it will not work... Delfim João
-
Usually when I'm connected wireless 3 g, says again but in white. Now, when connected wireless 3g grave and only lights up when I turn off the wireless. Any ideas if this is normal after the update?
-
Duplicate active Linux64 on Windows32
HelloI try active duplicate of Centos5.9 64-bit to 32-bit of Windows XP. Because from what I've read, this should be possible, at least they have the same endian format. However, when I try it fails with the following error. Tried searching to no ava
-
Photoshop CS2 Mac Installation failure?
I have a Mac with OS X Yosemite and when I opened "Downloads" and click on PhSp_CS2_Ret.dmg and then click on install Adobe Photoshop CS2 and start the installation it stops and says: "the installation failed. Setup has encountered an error that caus