How to remove unused logins ???

  • Hi every one

    there are unused logins siting on my SQL Server Database and i want to get rid of them how to do that (Sql Server 2000)

    how to fine when was that particular login last used

    and i have to delete unused Databases also so

    how can we find last accessed date of a database

    please help me

    i need to do it fast

    Thanks in advance

    Gokul Krishan

  • You can try by running profiler over a week and find out the logins not used at all during the database access time.

    Manu

  • Manu is right. Only via a Profiler or server-side trace are you going to be able to see what logs in and what databases are used. SQL Server doesn't record a last accessed time.

    K. Brian Kelley
    @kbriankelley

  • ok thanks

    i tried that but the database names are not visible only logins are comming

    and database column is left blank

    i dont know why

  • In Profiler - database id and name are not default columns. You have to show all columns and select the database id and/or name to include them in the trace.

    I would recommend that you build up the trace in Profiler, then script it out so you can run this as a server side trace. The server trace will run to a file and then you can use the function fn_trace_gettable to read the file into a temp table and use SQL to identify whatever you need to.

    Jeff

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Go into Books Online and read about the system stored procedure sp_trace_setevent

    in there you will see a parameter called @columnid

    If you read through the Document you will see a table listing the available vaules for that parameter hint it's #3 😉

    Like they said script out the trace, but they are also inferred that you should go and review the code and figure out what each sproc is doing to create the trace. This is the only way to know for sure...

    Ahh the power of documentation....

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply