Using the mail sending function of Oracle to monitor the running status of the database

Source: Internet
Author: User
There are many ways to monitor Oracle. Here I simply use oracle's automatic email sending function to help OEMs monitor the database. The details are as follows:

There are many ways to monitor Oracle. Here I simply use oracle's automatic email sending function to help OEMs monitor the database. The details are as follows:

There are many ways to monitor Oracle. Here I simply use oracle's automatic email sending function to help OEMs monitor the database. The details are as follows:

The storage process for sending emails is excerpted from the Internet and a small change has been made:

Create or replace procedure sp_send_email (P_TXT VARCHAR2,
P_SUB VARCHAR2,
P_SENDOR VARCHAR2,
P_RECEIVER VARCHAR2,
P_SERVER VARCHAR2,
P_PORT number default 25,
P_NEED_SMTP int default 1,
P_FILENAME VARCHAR2 default null,
P_ENCODE VARCHAR2 DEFAULT 'bit 7 ')
AUTHID CURRENT_USER IS
/*
Purpose: use oracle to send emails
Main functions: 1. Supports multiple recipients.
2. Support for Chinese Characters
3. CC recipients are supported.
4. Support for attachments larger than 32 KB
5. Supports multi-line text
6. Support for multiple attachments
7. Supports text attachments and binary attachments
8. HTML format supported
8. Support
Author: suk
Parameter description:
P_txt: email body
P_sub: Mail title
P_SendorAddress: the sender's email address.
P_ReceiverAddress: The Receiving address, which can be sent to multiple addresses at the same time. The addresses are separated by "," or ";".
P_EmailServer: email server address, which can be a domain name or IP address
P_Port: port of the email server
P_need_smtp: Indicates whether smtp authentication is required. 0 indicates no, and 1 indicates yes.
P_user: User Name required for smtp authentication
P_pass: Password required for smtp Verification
P_filename: The attachment name, which must contain the complete path, for example, "d: \ temp \ a.txt ".
Multiple attachments are allowed. The attachment names are separated by commas (,) or semicolons (;).
P_encode: The attachment encoding conversion format. p_encode = 'bit 7' indicates the text type attachment.
P_encode = 'base64' indicates binary type attachment
Note:
1. Text attachments cannot be sent in base64 format. Otherwise, an error occurs.
2. Multiple attachments can only be sent in the same format
*/

Rochelle CRLF VARCHAR2 (2): = UTL_TCP.CRLF;
Rochelle sendoraddress VARCHAR2 (4000 );
Rochelle splite VARCHAR2 (10): = '+ + ';
Boundary constant VARCHAR2 (256): = '----- BYSUK ';
FIRST_BOUNDARY CONSTANT VARCHAR2 (256): = '--' | BOUNDARY | L_CRLF;
LAST_BOUNDARY CONSTANT VARCHAR2 (256): = '--' | BOUNDARY | '--' |
Rochelle CRLF;
MULTIPART_MIME_TYPE CONSTANT VARCHAR2 (256): = 'multipart/mixed; boundary = "'|
BOUNDARY | '"';
/* The following are the variables used to send large binary attachments */
Rochelle fil BFILE;
Rochelle file_len NUMBER;
Rochelle modulo NUMBER;
Rochelle pieces NUMBER;
L_FILE_HANDLE UTL_FILE.FILE_TYPE;
Rochelle AMT BINARY_INTEGER: = 672*3;/* ensures proper format; 2016 */
Rochelle filepos PLS_INTEGER: = 1;/* pointer for the file */
Rochelle chunks NUMBER;
Rochelle Buf RAW (2100 );
Rochelle data RAW (2100 );
Rochelle max_line_width NUMBER: = 54;
L_DIRECTORY_BASE_NAME VARCHAR2 (100): = 'dir _ FOR_SEND_MAIL ';
Rochelle line VARCHAR2 (1000 );
Rochelle mesg VARCHAR2 (32767 );
/* The preceding variables are used to send large binary attachments */

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.