PL/SQL :: Scheduling - Create Oracle Job That Will Execute Shell Script?
Jul 2, 2012I need to create an oracle job that will execute a shell script. i need to run it only when I call it(so not to be scheduled).
View 5 RepliesI need to create an oracle job that will execute a shell script. i need to run it only when I call it(so not to be scheduled).
View 5 RepliesI have a shell script which triggers a batch in our application (an application which is not integrated with any other scheduler and is trying to integrate with OEM for the first time).
Is it possible to schedule a job to run this shell script in OEM ?
I have a requirement where i need to execute a unix shell script "a.sh" having permissions user1,group1 and no access to public. This should be executed from Oracle function.
So i wrote a routine in Java and it works fine when i execute a command like Date etc.
But when i execute "a.sh" from oracle client, its returning error that "could not be executed-permission denied". This is because once login happened through the "sqlplus" the shell takes user as "oracle" and group as "dba" but the script "a.sh" having only permissions user1,group1. Unfortunately we are not allowed to change the permission for "a.sh" to give execute permission to all(public).
After searching in internet, i understand that one way is to make the password (/etc/passwd) for the user "user1" as no password and can use "su" command so that it wont ask password while invoking it.
Is there any other way apart from this doing changes in password file at UNIX level when executing a script from oracle client?
if further information is required.
Oracle: version: 11.2.0.1
UNIX : AIX -5.9
Is there a way to execute remote shell scripts/perl script through APEX 4.1?I use Application Express 4.1.1.00.23
View 3 Replies View RelatedHow to create user using java shell basis to using sysdba or sysoper access on isplplus and what is the location of java home in linux.
View 2 Replies View Relatedfind the sample script and the error i face while running from shell. Actually i want to check the health of the database.
Sample script:
--------------------
export ORACLE_SID=GMX
export ORACLE_HOME=/opt/app/oracle/product/9.2.0
export PATH=/home/oracle/dbgen/PM/bin:/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/pd/bin:/op
[code]....
error messege:
Oracle Server Manager Release 2.3.4.0.0 - Production
Message 4505 not found; No message file for product=SVRMGR, facility=MGR
Error while trying to retrieve text for error ORA-12545
Error while trying to retrieve text for error ORA-12545
Attached File(s)
Script.txt ( 997bytes )
Number of downloads: 3
I am trying to create a procedure using the EXECUTE IMMEDIATE. I have been having problems calling it from an anonymous block
My code
CREATE OR REPLACE PROCEDURE homework
(p_table_name VARCHAR2)
IS
v_department_id departments.department_id%TYPE;
BEGIN
EXECUTE IMMEDIATE
[code]....
I called the procedure from an anonymous block
BEGIN
homework('Employees');
END;
It gives me an error
ORA-00905: missing keyword
Is it possible to create sequence using EXECUTE IMMEDIATE statement. The sequence name will be the bind variable.
DECLARE
TEMP VARCHAR2(20);
BEGIN
TEMP := :P2_INFO;
EXECUTE IMMEDIATE 'CREATE SEQUENCE' TEMP;
END;
This creates a sequence named TEMP, but i want the name :P2_INFO entered by user.
How can i create a temporary table using EXECUTE IMMEDIATE ??
Like:
CREATE GLOBAL TEMPORARY table new_table as (Select * from old_table);
Provide automated shell script for renaming oracle DB 10gR2. Now it is a daily manual job for us.
View 4 Replies View Relatedi try to make trigger to execute immediate create or replace view
(
CREATE OR REPLACE TRIGGER xxxx
BEFORE INSERT ON table1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
declare
l number ;
v_ddl varchar2(4000);
v_job number;
[code]....
it give me error for insuffition privilage in execute immediate and after i make GRANT CREATE ANY TRIGGER TO user give me error can't commit in trigger.
I am trying to create table using bind variable in EXECUTE IMMEDIATE.. I want to know whether oracle allows to create table using bind variable in EXECUTE IMMEDIATE..
Following is the example :
Declare
test_tab varchar2(10) := 'tab_test';
sql_stm varchar2(100);
Begin
sql_stm := 'create table ' || :a || ' (col1 NUMBER)';
dbms_output.put_line(sql_stm);
EXECUTE IMMEDIATE sql_stm
using test_tab;
Exception
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm || ' ' || sqlcode);
End;
After running above block it is giving error : ORA-01008: not all variables bound.
I cant compile & execute this function.
create or replace
FUNCTION get_branding_testing
RETURN r_brand
IS
BEGIN
CURSOR c1
IS
SELECT b.branding_code, c.name_desc
[code]....
I have a series of SQL scripts which contain SQL statements to create tables, populate them, create functions and stored procedures. Now I would like to execute each sql file against SQLPlus using a batch file so that I can just run this one file and all the configuration work I need to do can get done.
Problem is, when I try to execute the SQL file against SQLPlus, it gets upset with the Create Procedure/Function scripts...
I am using the following command:
sqlplus u/p@<someserver> @<path_to_sqlfile>.sql
this sql file contains create procedure pl/sql code
Is it possible create/compile SP/Functions that are contained within SQL Files using SQLPLus? Or do I have to physically write them out in SQLPLus (or load them in SQLDeveloper) to accomplish this?
I would like to create a trigger that will execute a stored procedure when a package/function/procedure is compiled. I tried creating an update trigger on user_objects, but it statues aI cannot create that trigger tyoe on views.
View 1 Replies View RelatedI want to run some reports based on certain schedule lets say after 1 hour or 2 hours may be send an email.How to do it.
View 4 Replies View RelatedIS it possible TO schedule same JOB WITH different timings.
I need only one SCHEDULER which should run ON saturday AT 6 pm ,AND monday AT 9 pm.
CREATE TABLE dept1 AS SELECT * FROM dept;
CREATE OR REPLACE
procedure update_record is
BEGIN
insert into dept1 values(10,'xxx','xxx');
END;
[code].....
PFB code i used to schedule a job as per my requirement. And the procedure is executing fine, but when im about to run it is getting hang.
create or replace procedure scheduler_alert(frq varchar2,intrvl number) is
begin
dbms_scheduler.create_job(
job_name=>'scheduler_alert',
job_type=>'stored_procedure',
job_action=>'alertlog_error',
start_date=>SYSTIMESTAMP,
repeat_interval=>'FREQ='||frq||';INTERVAL='||intrvl,
enabled=>true,
auto_drop=>false);
end;
/
When im trying to run the job it is getting hang.
exec dbms_scheduler.run_job('scheduler_alert');
how to do report scheduling.? So that server can auto run those report at specified time. And send output to user.
View 2 Replies View Related @ the end of the day means After date changes i need to populate the new row in Some of my tables with the previous date values with the new date.. In that time some other Transaction will Occur on those tables so we need to lock all the tables in that time..Even i tried by doing the Exclusive lock on the tables...
execute immediate 'LOCK TABLE CTR_SALES IN EXCLUSIVE MODE NOWAIT';
execute immediate 'LOCK TABLE CTR_STK_ASSIGN IN EXCLUSIVE MODE NOWAIT';
And how to run this function @ 12:00 in the midnight by scheduling.... And 1 more thing how to pick the recent (Transaction) row on that table. I tried from the rowid it's not working
I need to schedule a stored procedure and a stored package every day @6:30 AM.
I have also a merge statement that I need to execute before stored procedure is executed.
we need to create a materialized view which should do complete refresh at pre determined interval like - 6am,12pm and 4pm every day.
Is it possible to have this option in materialized view?
As of now, I could understand we can do "start with" and "next" option which will schedule refresh with same interval but not with different time interval which I mentioned above.
i have a production database server with 2 node rac. i now have a separate database server for my report db. Now i want to do an automatic export of the production database or a schema in the production database and then import it automatically to the report db immadiately after the export job finishes at a specific time, say 12 midnight everyday. how do i go about this using crontab or any other better solution. my database is 11gr2 and operating system is rhel 5.7.
View 1 Replies View RelatedI would like to export my whole database every evening. How can I do this using enterprise manager.
View 4 Replies View RelatedOracle DB Version - 11g XE I scheduled a job using dbms_scheduler which will insert a record into table T for each minute. I didnt mention COMMIT inside my procedure but records are being commited after each successful execution. How come it is possible. Here is my code.
SQL> create table t ( empno number, creation_date date);
Table created
SQL> create or replace procedure test_proc 2 is 3 4 begin 5 6 insert into t values (1,sysdate); 7 8 end; 9 /
Procedure created
[Code]....
PL/SQL procedure successfully completed
SQL> select * from t;
EMPNO CREATION_DATE---------- ------------- 1 11/12/2013 11 1 11/12/2013 11 1 11/12/2013 11 1 11/12/2013 11 1 11/12/2013 12 1 11/12/2013 12 1 11/12/2013 12 1 11/12/2013 12 1 11/12/2013 12
9 rows selected
I have oracle 11g r2, I have a table emp, where i have three columns emp_no,status and creation_date, creation date is a time stamp like '02/09/2012 17:59:47'.
I have to trigger an email if the status is not updated for 30 minutes.
DECLARE
CUSROR C_GET_DATA IS
/*SELECTING RECORDS*/
SELECT * FROM EMP WHERE creation_date BETWEEN CREATION_DATE AND CREATION_dATE+30 AND STATUS IS NULL;
[Code]....
in the above code "CREATION_DATE AND CREATION_dATE+30" will give 30 days, how can i select just 30 minutes and schedule it every 30 minutes, so that email is triggered for if status is not updated for more than 30 minutes.
I'm working with old code that uses dbms_sql.execute to build/execute dynamic sql. In our case, the user can select varying columns(I think up to 20) with different where conditions as needed.
After building the sql, here's an example
WITH ph AS
(SELECT ph.* FROM po_header ph WHERE 1 = 2),
pf AS
(SELECT DISTINCT pf.order_id, pf.fund
FROM po_fau pf, ph
WHERE 1 = 1
AND ph.order_id = pf.order_id
[code]....
Where table records for
po_header = ~567746
po_fau = ~2153570
and PK "order_id" is a NUMBER(10) not null and a snippet of the code looks like
nDDL_Cursor := dbms_sql.open_cursor;
dbms_sql.parse(nDDL_Cursor, sSQLStr, 2);
FOR x IN 1 .. nCols LOOP
sCols(x) := '';
dbms_sql.define_column(nDDL_Cursor, x, sCols(x), 100);
END LOOP;
nError := dbms_sql.execute(nDDL_cursor);
why when the "execute" statement is fired off the elapsed time takes ~4.5 seconds but If I change "1 = 1" above to "1 = 2" it takes ~.2 seconds. If I run the above query interactively it takes ~.2 seconds. Shouldn't the above query when joining
ph.order_id = pf.order_id
return zero rows back instantly or does the "dbms_sql_execute" do some other type of parsing internally that takes cpu time.
I have requirement as follows. I need to load the data to the target table on every Saturday. My source file consists of data of several sates. For every week i have to load one particular state data to target table. If first week I loaded AP data, then second week on Saturday karnatak, etc.
Provide code also how can i schedule the data load with every Saturday with different state column values automatically.
calling .ksh file from Oracle8i Pl/Sql code.We have Unix and Oracle on same server.
View 39 Replies View Relatedhow to you execute a stored procedure in ORACLE..For example in SQL SERVER its just
EXEC Proc_Name ParameterValues
How the hell do you do this in oracle i just want to test if my stored procedure works.