Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sqlserver stored procedures generate and send HTML monitoring reports

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Background

Scheduled tasks are processed in the early hours of each morning, a process that normally takes about 6-7 hours. Before 9 o'clock every day, you need to make sure that all the data is processed, which is a deadline. If it is not completed, it means that an accident occurred in the operation and maintenance on the same day, which affected the customer.

In the initial stage, if a database data processing fails, an alarm email will be sent. When there are more alarm emails, it is undoubtedly difficult to confirm which database processing failed from the email.

So by writing stored procedures, we can monitor all the DB data processing, and send a report in html format every day, so that we can know the data processing status quickly and accurately.

The final effect is a list of database servers in the figure below. A database server can create multiple databases, and each Profile is a DB.

Mode of realization

The result in the table above depends on a table ProcessDurationReport in the operation and maintenance database. The record in this table is that the program writes the processing time when dealing with each database. We calculate and summarize the information in the table through SQL, and finally assemble it into a html page and send it through Sqlserver's mail service.

The table structure is as follows

The relevant stored procedures are as follows

The related stored procedure links are written at the end.

The realization of this function means that the operation and maintenance operation is simplified, and the data processing status can be determined by viewing the report every day.

You can also continue to improve on this basis and turn it into a small website that displays the processing status in real time.

Other functions can also be added to display the historical data processing status.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report