Link to home
Start Free TrialLog in
Avatar of David VanZandt
David VanZandtFlag for United States of America

asked on

My PL/SQL block chokes on Amazon Web Service procedure. Asking for a second pair of eyes?

Hi, I have learned in the past two hours a lot of approaches that don't work. I'm asking for a fresh pair of eyes, please. Using Oracle 19c on aws rds, the rdsadmin schema is what allows SYS level commands to execute in place of the usual ALTER statements. Also, rds uses log groups in lieu of the expected log group members. I have tried many, many variations on the syntax on code that seemingly passes the TOAD and SQL*Dev syntax checkers, but it all fails to run. 

DECLARE
loggroups NUMBER :=0 ; stmt VARCHAR2(128); BEGIN     EXECUTE IMMEDIATE ('rdsadmin.rdsadmin_util.switch_logfile');     SELECT count(1) INTO loggroups FROM v$log;     IF loggroups < 9 THEN         EXECUTE IMMEDIATE ('rdsadmin.rdsadmin_util.add_logfile(128M)');     END IF; END; / /* this works outside of the block EXEC rdsadmin.rdsadmin_util.switch_logfile; */

Open in new window


ASKER CERTIFIED SOLUTION
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

>>this works outside of the block EXEC rdsadmin.rdsadmin_util.switch_logfile;

why don't you just call these package procedures "directly" without using "execute immediate"?!

Correct.  Execute immediate executes the 'string'.  It has no idea that it is a procedure, a select, or what.

So, you would need to provide the entire command to execute immediate.

So:, something like:
EXECUTE IMMEDIATE ('begin rdsadmin.rdsadmin_util.switch_logfile; end;');

That said, don't do that!

Just provide the procedure:
...
BEGIN
    rdsadmin.rdsadmin_util.switch_logfile;
    SELECT count(1) INTO loggroups FROM v$log;
...

Open in new window

Avatar of David VanZandt

ASKER

Missed that one entirely, tyvm. Alex, the log size is appropriate and is the default.
Glad, we could help ;-)
Btw, my question was rather about this one:
rdsadmin.rdsadmin_util.add_logfile(128M)

Open in new window

The parameter here (128M). What's the data type here?!
FWIW Alex, I see that at some point in this thread I dropped the delimiters -- the string value should be ('128M'). To answer your question, varchar2:
Parameter nameData typeDefaultRequiredDescription
bytespositivenullNoThe size of the log file in bytes.
p_sizevarchar2YesThe size of the log file. You can specify the size in kilobytes (K), megabytes (M), or gigabytes (G).

Thanks David ;-) Now this makes sense :-))