Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)

  • RE: Need to track logins to all databases

    I may end up going that route, Lowell. Thanks.

    As an aside, this is the Oracle code I'm essentially trying to emulate...

    create or replace trigger tr_logon

    begin

    If user not in ('SYS','SYSTEM','SYSMAN') then

    Update...

  • RE: Need to track logins to all databases

    Lowell (6/18/2015)


    i think a logon trigger is the wrong device in this case.I don't think the database named in a connection string has much relevance.

    i think the OP is really...

  • RE: Need to track logins to all databases

    Michael L John (6/18/2015)


    mark.dickinson (6/18/2015)


    Michael L John (6/17/2015)


    Sorry, I saw this post and ran out the door after I published the code.......

    3. I don't think Database name is part of...

  • RE: Need to track logins to all databases

    Michael L John (6/17/2015)


    Sorry, I saw this post and ran out the door after I published the code.......

    3. I don't think Database name is part of the EventData Function. Try...

  • RE: Need to track logins to all databases

    Okay... here's where I am...

    Table create script works fine...

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_PADDING ON

    GO

    CREATE TABLE [dbo].[Server_Logon_History](

    [EventType] [nvarchar](100) NULL,

    [PostTime] [datetime] NULL,

    [LoginName] [nvarchar] (512) NULL,

    [ClientHost] [nvarchar] (512)...

  • RE: Need to track logins to all databases

    Ed Wagner (6/17/2015)


    mark.dickinson (6/17/2015)


    Michael L John (6/17/2015)


    CREATE TRIGGER [Server_Logon_Trigger]

    ON ALL SERVER

    FOR LOGON

    AS

    INSERT INTO DBAUtilities.dbo.Server_Logon_History(EventType, PostTime, ServerName, LoginName, LoginType, SID, ClientHost, IsPooled)

    SELECT EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(100)'),

    EVENTDATA().value('(/EVENT_INSTANCE/PostTime)[1]',...

  • RE: Need to track logins to all databases

    Michael L John (6/17/2015)


    CREATE TRIGGER [Server_Logon_Trigger]

    ON ALL SERVER

    FOR LOGON

    AS

    INSERT INTO DBAUtilities.dbo.Server_Logon_History(EventType, PostTime, ServerName, LoginName, LoginType, SID, ClientHost, IsPooled)

    SELECT EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(100)'),

    EVENTDATA().value('(/EVENT_INSTANCE/PostTime)[1]', 'datetime'),

    EVENTDATA().value('(/EVENT_INSTANCE/ServerName)[1]', 'nvarchar(512)'),

    EVENTDATA().value('(/EVENT_INSTANCE/LoginName)[1]', 'nvarchar(512)'),

    EVENTDATA().value('(/EVENT_INSTANCE/LoginType)[1]',...

  • RE: Need to track logins to all databases

    seaport (6/17/2015)


    You may use "Who Is Active" script.

    http://sqlblog.com/files/folders/release/entry35240.aspx

    Create an agent job (schedule for every 5 minutes or any frequency you need), use the code from the script to...

Viewing 8 posts - 1 through 8 (of 8 total)