브랜드

Impact-Company-Logo-English Black-01-177x54

슈나이더 일렉트릭 코리아 웹사이트에 방문해 주셔서 감사합니다.

슈나이더 일렉트릭 코리아 웹사이트 방문자 분들 모두 환영합니다.
		
오늘 무엇을 도와드릴까요?
Removing Database Mail History
Issue
The SQL Server MSDB database can grow very large due to extensive use of Database Mail and/or sending large attachments via Database Mail.

Product
Struxureware Power Monitoring
Power Monitoring Expert
ION Enterprise
ION EEM

Environment
SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014

Cause
SQL Server stores all mails and attachments in the MSDB database. To avoid unnecessary growth of the MSDB database you should remove
the mail history unless it is required for auditing or other purposes.  If frequently sending large attachments using database mail this can cause the database MSDB to grow rapidly.

Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*

To display all mails processed by Database Mail, the sysmail_allitems view can be queried by executing one of the following statements.
SELECT COUNT(*)
FROM msdb.dbo.sysmail_allitems
or
SELECT *
FROM msdb.dbo.sysmail_allitems

There are 3 additional views available (sysmail_faileditems, sysmail_unsentitems, and sysmail_sentitems) which contain the mails of different status respectively.
Also, all attachments are stored within the MSDB database.  These are contained in the sysmail_attachment table.

To delete mail items, use the system stored procedure sysmail_delete_mailitems_sp.
The syntax is as follows:
sysmail_delete_mailitems_sp [@sent_before] [@sent_status]

Mail can be deleted using either of the parameters.  The @sent_before parameter specifies a date which all mail sent prior to the
specified date will be deleted. The @sent_status specifies the status of the mails which will be deleted.
For example, to delete all mails which are sent and are older than current month we can use:
EXEC  msdb.dbo.sysmail_delete_mailitems_sp
      @sent_before = '2012-05-10 00:00:00',
      @sent_status = 'sent'

After executing the above stored procedure to delete the unrequired mail, querying the sysmail_event_log view verifies the deletions that have been initiated.
SELECT description
FROM sysmail_event_log
ORDER BY log_date required

** see attachment containing the SQL script text


슈나이더 일렉트릭 Korea

첨부 파일
mail.sql [285 Bytes]
자세히 알아보기
제품군
자세히 알아보기
제품군

도움이 필요하신가요?

  • 제품 선택기

    애플리케이션에 적합한 제품과 액세서리를 빠르고 쉽게 찾을 수 있습니다.

  • 견적 받기

    영업 관련하여 온라인으로 문의하시면 전문가가 연락드립니다.

  • 구매처

    해당 지역의 가장 가까운 슈나이더 일렉트릭 대리점을 쉽게 찾을 수 있습니다.

  • 지원 센터

    한 곳에서 모든 요구 사항에 대한 지원 리소스를 찾아보십시오.

  • 제품 문서
  • 소프트웨어 다운로드
  • 제품 선택기
  • 제품 대체 및 교체
  • 지원 및 연락처 센터
  • 영업소 검색
  • 견적 받기
  • 채용
  • 회사 소개
  • 부정 행위 보고
  • 접근성
  • 뉴스룸
  • 투자자
  • Ecostruxure
  • 작업 검색
  • 블로그
  • 개인정보 취급방침
  • 쿠키 공지
  • 사용 약관
  • Change your cookie settings