David VanZandt
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; */
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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:
Btw, my question was rather about this one:
rdsadmin.rdsadmin_util.add_logfile(128M)
The parameter here (128M). What's the data type here?!
ASKER
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 name | Data type | Default | Required | Description |
---|---|---|---|---|
bytes | positive | null | No | The size of the log file in bytes. |
p_size | varchar2 | — | Yes | The size of the log file. You can specify the size in kilobytes (K), megabytes (M), or gigabytes (G). |
Thanks David ;-) Now this makes sense :-))
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.swi
That said, don't do that!
Just provide the procedure:
Open in new window