SOLVED
ORA-06512: at “SYS.UTL_MAIL”, line 654 ORA-06512: at “SYS.UTL_MAIL”,
Asked by OracleDba••14 views•oracle
#oracle#error
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
ORA-06512: at "SYS.UTL_MAIL", line 654 ORA-06512: at "SYS.UTL_MAIL",
I was getting error while trying to send email from database
SQL> declare
2 begin
3 UTL_MAIL.SEND(mime_type => 'text/html; charset=us-ascii',
4 sender => '
[email protected]
',
5 recipients => '
[email protected]
',
6 subject => 'Test email Harvey',
7 message => 'This is a test email from rac01');
8 end;
9 /
declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.UTL_MAIL", line 654
ORA-06512: at "SYS.UTL_MAIL", line 671
ORA-06512: at line 3
SQL>
What I have found was that the parameter smtp_out_server was not set up
SQL> show parameter smtp_out_server
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
smtp_out_server string
SQL>
By setting the parameter to mail server it worked all good
SQL> alter system set smtp_out_server='mailhost.example.com' scope=both sid='*';
System altered.
SQL> show parameter smtp_out_server
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
smtp_out_server string mailhost.example.com
SQL>
SQL> declare
2 begin
3 UTL_MAIL.SEND(mime_type => 'text/html; charset=us-ascii',
4 sender => '
[email protected]
',
5 recipients => '
[email protected]
',
6 subject => 'Test email Harvey',
7 message => 'This is a test email from rac01');
8 end;
9 /
PL/SQL procedure successfully completed.
SQL>
Please note that I had to make sure that ACLs are configured right as well
SQL> col acl format a30
SQL> col host format a30
SQL> col principal format a30
SQL> col end_date format a30
SQL> col start_date format a30
SQL> select * from DBA_NETWORK_ACLS;
HOST LOWER_PORT UPPER_PORT ACL ACLID
------------------------------ ---------- ---------- ------------------------------ --------------------------------
mailhost.csu.edu.au 25 25 /sys/acls/mailserver_acl.xml 2023FDE3E03E3B45E0511C60040A3C26
SQL> select * from DBA_NETWORK_ACL_PRIVILEGES;
ACL ACLID PRINCIPAL PRIVILE IS_GRANT INVER START_DATE END_DATE
------------------------------ -------------------------------- ------------------------------ ------- -------------------- ----- ------------------------------ ------------------------------
/sys/acls/mailserver_acl.xml 2023FDE3E03E3B45E0511C60040A3C26 HARV connect true false
SQL>
SQL>