oravirt/ansible-oracle-modules

oracle_tablespace: PL/SQL error when altering a tablespace with a huge current maxsize

Opened this issue · 0 comments

The oracle_tablespace module has a PL/SQL block as central element ro alter tablespaces.

I encountered an error while resizing a tablespace:

ORA-06502: PL/SQL: numerischer oder Wertefehler: Zeichenfolgenpuffer zu klein
ORA-06512: in Zeile 92
ORA-06512: in Zeile 92

It turned out that the MAXBYTES of the (temp-)tablespace in question was around 32TB, a relatively huge number in terms of bytes.

The anonymous PL/SQL block compares the current maxsize to the given one while making a string comparison between the current size calculated with the given unit ("m", "g", ...) and the given size string (module parameter) to identify if the maxsize is to be altered or not:

v_maxsize_current := ((rec.maxbytes)/v_divisor_maxsize);

v_maxsize_current is a VARCHAR2(20). In my case the resulting number ("32767.99997711181640625000") was longer than the max. size of v_maxsize_current, which lead to the error stack above.

The (quick) fix was to enlarge the relevant VARCHAR2s (I took 50, just a quickshot).

It hit me with MAXSIZE, but from what I can see it could happen with NEXT, too - at least the same way is used (but the numbers usually are smaller).

Sorry for not providing a patch.