Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

gpc encryption command from PLSQL

MihaiFAug 13 2020 — edited Aug 25 2020

Hi experts

I'm trying to call Linux host command from PLSQL.

I've created a simple function in PLSQL which create a simple '#!/bin/sh' shell file and use dbms_scheduler.create_job functionality to call this shell script.

dbms_scheduler.create_job(

    job_name=>'TEST_OS_EXEC_117',

    job_type=>'executable',

    job_action=>'/mydir/test112.sh',

    enabled=>TRUE

    );

The function is working fine for different host command (for example to archive a file with tar ... 'tar  -zcvf ' ), but it's not working for encryption "gpg" command .

The encryption command created is:

gpg --output MyFile_20200813140204.gpg --encrypt -r MYKEY --armor MyFile_20200813140204.csv

I want to mention the "gpg" command is working fine if:

   - I'll submit directly from Linux     (gpg --output MyFile_20200813140204.gpg --encrypt -r MYKEY --armor MyFile_20200813140204.csv)

   - execute shell script from Linux, but it's not working from PLSQL ( ./test112.sh )

The additional_info column from DBA_SCHEDULER_JOB_RUN_DETAILS table is populated with the error message:

ORA-27369: job of type EXECUTABLE failed with exit code: 2 gpg: MYKEY: skipped: No public key

gpg:MyFile_20200813140204.csv

STANDARD_ERROR="gpg: MYKEY: skipped: No public key

gpg: MyFile_20200813140204.csv: encryption failed: No public key"

Do you have an idea?

Thanks,

MihaiF

Comments
Post Details
Added on Aug 13 2020
9 comments
756 views