SQLSERVER records the logon time of the logged-on user

Source: Internet
Author: User
The manager asked me if I could record the last time the user logged on to our business database, because someone had previously modified the login password of the database sa user, so we need to record it. I checked the information. It seems that I cannot record who has logged on to the business database. I can only record who has logged on to SQLSERVER.

The manager asked me if I could record the last time the user logged on to our business database, because someone had previously modified the login password of the database sa user, so we need to record it. I checked the information. It seems that I cannot record who has logged on to the business database. I can only record who has logged on to SQLSERVER.

SQLSERVER records the logon time of the logged-on user

A while ago, the manager asked me if I could record the last time the user logged on to our business database, because someone had previously modified the database sa user.

So we need to record the logon password.

I checked the information. It seems that I cannot record who has logged on to the business database. I can only record who has logged on to SQLSERVER.

The database version is SQL2005, and the operating system is Windows 7.

The following is a script written by myself. My implementation principle is to use a trigger. The trigger is a logon trigger, which covers the entire server range and the Hong Kong virtual host. If someone has logged on to the Hong Kong Space, just use

The bcp Command records the logon information in the log file.

1. If a trigger already exists in the original database, delete it.

1 USE MASTERtrg_logon_attempttest on all SERVER4 GO, Hong Kong server

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.