-- 创建 ACL
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl =>
‘email_server_permissions.xml‘,
description
=>
‘Enables network permissions for the e-mail server‘,
principal =>
‘LJZ‘,
is_grant =>
TRUE,
privilege
=>
‘connect‘);
END;
?
-- 与邮件服务关联
BEGIN
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl =>
‘email_server_permissions.xml‘,
host =>
‘smtp.163.com‘,
lower_port =>
25,
upper_port =>
NULL);
END;
-- 这样 email_user 用户帐户创建的存储过程便可以向此邮件服务器发送邮件
?
--删除
BEGIN
DBMS_NETWORK_ACL_ADMIN.drop_acl(acl =>
‘email_server_permissions.xml‘);
COMMIT;
END;
--查询
SELECT host, lower_port, upper_port, acl FROM dba_network_acls;
SELECT acl,
principal,
privilege,
is_grant,
TO_CHAR(start_date,
‘DD-MON-YYYY‘)
AS start_date,
TO_CHAR(end_date,
‘DD-MON-YYYY‘)
AS end_date
FROM dba_network_acl_privileges;