calling PL/SQL scripts from Control-M

Post Reply
User avatar
Rashid
Nouveau
Nouveau
Posts: 56
Joined: 31 Oct 2009 12:00

calling PL/SQL scripts from Control-M

Post by Rashid » 12 Mar 2012 2:23

hello experts,

haunting some information about how can we implemenet PL/SQL scripts in control-M.

1. simple method is two wrap in scripts

or call with DB module.

If anyone has implemented PL/SQL scripts from Control-M,

please share/suggest Ideas

Thanks

User avatar
yllanos
Nouveau
Nouveau
Posts: 4
Joined: 30 Jul 2012 12:00

PL/SQL

Post by yllanos » 30 Jul 2012 10:57

Hello.

I know two ways to execute PL/SQL scripts from Control-M:

1. If you are using a Unix-type operating system on your database system, you can create a shell script to launch a sqlplus session and then use the execute comand to run your PL/SQL. Example:

Code: Select all

sqlplus /nolog
connect [$user_name]/[$user_pass]@[SID]
SET TIMING ON
ALTER PROCEDURE SCHEMA.MY_PROCEDURE COMPILE;
execute SCHEMA.MY_PROCEDURE();
Disconnect
This method has a disadvantage: it will only execute the shell job and the agent response is going to be an operating system-centric one, this means the agent is not going to interpret the databases error responses when they happen. The advantage is that you can run old database procedures in Oracle 8i, for example. I'm not sure, but there should be a similar way using .bat files on Windows platforms to run PL/SQLs

2. The other way is to use the database module to run PL/SQL. This is the recommended method since Control-M's agent is going to interpret Oracle error codes. We run database processes on a daily basis using this method. Control-M only supports Oracle 9i or newer.

The seconnd method also works for Oracle functions. If you have out/return parameters, Control-M will detect them and you can capture them on a variable and do some other processing depending on output.

Hope this helps.

Post Reply