Skip to content

Commit 86dd2cc

Browse files
committed
docs: Add logon trigger management guidance and improve clarity
Added practical SQL examples and documentation links for managing logon triggers in response to customer feedback (UUF #288442). Customer reported that the article mentioned disabling/dropping triggers but provided no guidance on how to perform these actions. Changes: - Added 'Manage logon triggers' section with SQL examples for listing, disabling, and dropping triggers - Added links to sys.server_triggers, DISABLE TRIGGER, DROP TRIGGER docs - Added Related content section with trigger security documentation - Improved clarity throughout for Acrolinx requirements (target: 80+) - Replaced directional terms with specific references - Converted passive voice to active voice - Split complex sentences for better readability - Defined SA acronym (system administrator) - Updated ms.date to 02/06/2026 - Added ai-usage: ai-assisted metadata
1 parent 471b5a6 commit 86dd2cc

1 file changed

Lines changed: 46 additions & 12 deletions

File tree

docs/relational-databases/errors-events/mssqlserver-17892-database-engine-error.md

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ description: "MSSQLSERVER_17892"
44
author: suresh-kandoth
55
ms.author: sureshka
66
ms.reviewer: jopilov, mathoma
7-
ms.date: 08/20/2020
7+
ms.date: 02/06/2026
8+
ai-usage: ai-assisted
89
ms.service: sql
910
ms.subservice: supportability
1011
ms.topic: "reference"
@@ -27,7 +28,7 @@ helpviewer_keywords:
2728

2829
## Explanation
2930

30-
Error 17892 is raised when a logon trigger code cannot execute successfully. [Logon Triggers](../triggers/logon-triggers.md) fire stored procedures in response to a LOGON event. This event is raised when a user session is established with an instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. An error message like the following is reported to the user:
31+
Error 17892 is raised when a logon trigger code cannot execute successfully. [Logon Triggers](../triggers/logon-triggers.md) fire stored procedures in response to a LOGON event. This event is raised when a user session is established with an instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. The following error message is reported to the user:
3132

3233
> Msg 17892, Level 14, State 1, Server \<Server Name>, Line 1
3334
Logon failed for login \<Login Name> due to trigger execution.
@@ -41,7 +42,7 @@ The problem could occur if there is an error when executing trigger code for tha
4142

4243
## User action
4344

44-
You can use one of the resolutions below depending on the scenario you are in.
45+
You can use one of the following resolutions depending on your scenario:
4546

4647
- **Scenario 1**: You currently have access to an open session to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] under an admin account
4748

@@ -51,32 +52,56 @@ You can use one of the resolutions below depending on the scenario you are in.
5152

5253
- Example 2: If an object referred to by the trigger code does exist but users do not have permissions, grant them the necessary privileges to access the object.
5354

54-
Alternatively, you can just drop or disable the login trigger so that users can continue to log in to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
55+
Alternatively, you can just drop or disable the login trigger so that users can continue to log in to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
56+
57+
### Manage logon triggers
58+
59+
List all logon triggers on your server:
60+
61+
```sql
62+
SELECT name, is_disabled, create_date, modify_date
63+
FROM sys.server_triggers
64+
WHERE type_desc = 'LOGON';
65+
```
66+
67+
Disable a logon trigger temporarily without deleting it:
68+
69+
```sql
70+
DISABLE TRIGGER trigger_name ON ALL SERVER;
71+
```
72+
73+
Drop (delete) a logon trigger permanently:
74+
75+
```sql
76+
DROP TRIGGER trigger_name ON ALL SERVER;
77+
```
78+
79+
For more information, see [Manage trigger security](../triggers/manage-trigger-security.md#trigger-security-best-practices).
5580

5681
- **Scenario 2**: You do not have any current session that is open under admin privileges, but Dedicated Administrator Connection (DAC) is enabled on the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
5782

58-
In this case, you can use the DAC connection to take the same steps as discussed in Case 1 since DAC connections are not affected by Login triggers. For more information on DAC connection, see:
83+
In this case, you can use the DAC connection to take the same steps described in Scenario 1. Logon triggers don't affect DAC connections. For more information on DAC connection, see:
5984
[Diagnostic Connection for Database Administrators](../../database-engine/configure-windows/diagnostic-connection-for-database-administrators.md).
6085

61-
To check whether DAC is enabled on your [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], you can check [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log for a message that is similar to the following:
86+
To check whether DAC is enabled, review the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log. Look for a message similar to this example:
6287

6388
> 2020-02-09 16:17:44.150 Server Dedicated admin connection support was established for listening locally on port 1434.
6489
65-
- **Scenario 3**: You neither have DAC enabled on your server nor have an existing admin session to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
90+
- **Scenario 3**: DAC isn't enabled on your server, and you don't have an existing admin session to [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
6691

6792
In this scenario, the only way to remediate the problem would be to take the following steps:
6893

6994
1. Stop [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] and related services.
70-
2. Start [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] from the [command prompt](/previous-versions/sql/sql-server-2008-r2/ms180965(v=sql.105)) using the startup parameters `-c`, `-m`, and `-f`. Doing this disables the login trigger and lets you perform the same remedial measures that are discussed under **Case 1** above.
95+
2. Start [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] from the [command prompt](/previous-versions/sql/sql-server-2008-r2/ms180965(v=sql.105)) using the startup parameters `-c`, `-m`, and `-f`. This action disables the login trigger and lets you perform the same remedial measures described in Scenario 1.
7196

7297
> [!NOTE]
73-
> The above procedure requires a *SA* or an equivalent administrator account.
98+
> This procedure requires a system administrator (SA) or equivalent administrator account.
7499
75100
For more information about these and other startup options, see: [Database Engine Service Startup Options](../../database-engine/configure-windows/database-engine-service-startup-options.md).
76101

77102
## More information
78103

79-
Another situation where log on triggers fail is when using the `EVENTDATA` function. This function returns XML, and its case sensitive. So, you create the following logon trigger, intending to block access based on IP address, you can ran into the issue:
104+
Logon triggers can also fail when using the `EVENTDATA` function incorrectly. The `EVENTDATA` function returns XML and is case-sensitive. For example, if you create the following logon trigger to block access based on IP address, you might encounter error 17892 if the XML path uses incorrect casing:
80105

81106
```sql
82107
CREATE TRIGGER tr_logon_CheckIP
@@ -95,10 +120,19 @@ Another situation where log on triggers fail is when using the `EVENTDATA` funct
95120
GO
96121
```
97122

98-
User didn't maintain case when copying this script from the internet on this part of the trigger:
123+
If you don't maintain proper case-sensitivity when copying this script, specifically in this part of the trigger, the trigger fails:
99124

100125
```sql
126+
-- Incorrect: lowercase 'event_instance' and 'clienthost' will cause EVENTDATA to return NULL
101127
SELECT EVENTDATA().value ( '(/event_instance/clienthost)[1]' , 'NVARCHAR(15)');
102128
```
103129

104-
As a consequence, `EVENTDATA` always returned **NULL**, and all their SA equivalent logins were denied access. In this case, the DAC connection was not enabled, so we had no choice but to restart the server with the startup parameters listed above to drop the trigger.
130+
As a consequence, `EVENTDATA` always returns **NULL**, and all SA equivalent logins are denied access. In this case, if the DAC connection isn't enabled, you need to restart the server with the startup parameters described earlier to drop the trigger.
131+
132+
## Related content
133+
134+
- [Logon Triggers](../triggers/logon-triggers.md)
135+
- [sys.server_triggers (Transact-SQL)](../../relational-databases/system-catalog-views/sys-server-triggers-transact-sql.md)
136+
- [DISABLE TRIGGER (Transact-SQL)](../../t-sql/statements/disable-trigger-transact-sql.md)
137+
- [DROP TRIGGER (Transact-SQL)](../../t-sql/statements/drop-trigger-transact-sql.md)
138+
- [Manage trigger security](../triggers/manage-trigger-security.md)

0 commit comments

Comments
 (0)