How to find last login date of a sql login?

i want to disable the SQL Logins which are not logged in last 15 days. (I schedule a job every night to check and disable)
For this 
i want to find  last login date of all sql logins in an instance if the login didn't log in with in 15 days i want to disable them.
In SYS.SYSLOGINS table we can see all the logins and 'isntname' tells us if it is SQL login or windows login. 
but where to find the last login date of SQL log in ?
Can any one help me?

Hi HYDBA,
If you use SQL Server 2005 or later, you can only get the current logon data using
DMV likes:
select
max
(login_time)as
last_login_time, login_name
from
sys.dm_exec_sessions
group
by login_name;
Related to your question there are two options:
One is logon trigger,
which is used to get current login time and login name comparing with the data from
sys.dm_exec_sessions. If the current login time comparing with last login time is larger than 15 days, then prevent the current login.   
Another one is to schedule a job, which is used to disable logon who’s current login time
comparing with last login time is larger than 15 days.
Hope it’s helpful for you.
Regards, Amber zhang

Similar Messages

  • HOW TO FIND LAST DOCUMENT DATE BASED ON MATERIAL NUMBER

    Hi,
           I want to know how to find the last document details based on material number.
    Is there any Functional modulle or BAPI programe?
    i,e, I want know last goods receipt details (MIGO)  based on material number.
    Can u please anybody tell me.
    Thanks,
    S.Muthu.
    Edited by: Subramaniyan Marimuthu on Jan 2, 2008 9:07 AM

    Hello.
    Check the BAPI_GOODSMVT_GETITEMS
    -example--
    Get GRs after a specific date for a specific plant/ storage location and movement types
      wa_budats-sign = 'I'.
      wa_budats-option = 'GE'.
      wa_budats-low = '20071201'.
      APPEND wa_budats TO budats.
      wa_plants-sign = 'I'.
      wa_plants-option = 'EQ'.
      wa_plants-low = '1000'.
      APPEND wa_plants TO plants.
      wa_stlocs-sign = 'I'.
      wa_stlocs-option = 'EQ'.
      wa_stlocs-low = '0001'.
      APPEND wa_stlocs TO stlocs.
      wa_mvts-sign = 'I'.
      wa_mvts-option = 'EQ'.
      wa_mvts-low = '101'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '901'.
      APPEND wa_mvts TO mvts.
      wa_mvts-low = '123'.
      APPEND wa_mvts TO mvts.
      CALL FUNCTION 'BAPI_GOODSMVT_GETITEMS'
        TABLES
          plant_ra        = plants
          stge_loc_ra     = stlocs
          move_type_ra    = mvts
          pstng_date_ra   = budats
          goodsmvt_header = header
          goodsmvt_items  = item
          return          = return.
    Reward if helpful.
    Cheers,
    George

  • How to find Last Payment date for vendor

    Hi,
    I am working on ALV  Vendor report details.
    1) How to find the last payment date for the vendor.
    2) In input paramter field  
        PARAMETERS: L_FILE  LIKE  RLGRAP-FILENAME.
       I want to validate the user input in the selction screen for downloading the file in the presentation server..
      what is the validation I have to write for the path name.
    pl help me give details.
    Thanks in advance.
    sharma

    1) use table REGUH field ZALDT or VALUT
    2) use fm like EPS_GET_FILE_ATTRIBUTES
    A.

  • How to find last activites date time in BCC by all BCC internal users?

    Is there a way to find the last activities date and time in BCC by all BCC internal users?

    It looks like /DSS/TrackActivity.sdl does the job for normal commerce users, but there is no such scenario for Internal users(BCC users), so this is something we need to do for internal users.
    Is my understanding correct?

  • To find last run date of custom concurrent program in oracle apps

    Hello Exports,
    Can you pls tell me how to find last run date of custom concurrent program in oracle apps.( thr Backend query )
    Thanks in advance,
    Edited by: 981527 on Mar 7, 2013 3:01 AM

    try the below:
    select fcp.user_concurrent_program_name
    ,fcr.request_date
    ,fu.user_name
    ,fcr.actual_start_date
    ,fcr.actual_completion_date
    ,fcr.phase_code
    ,fcr.status_code
    ,fcr.argument1
    ,fcr.argument2
    ,fcr.argument3
    from fnd_concurrent_programs_vl fcp
    ,fnd_concurrent_requests fcr
    ,fnd_user fu
    where fcp.user_concurrent_program_name like 'Payroll Run'
    and fcp.concurrent_program_id = fcr.concurrent_program_id
    and fcr.requested_by = fu.user_id
    order by fcr.actual_completion_date desc

  • How to find last date of month

    Dear  All,
    Can anybody tell me how to find last date of month I need it to check some validations
    helpful answer will definatly rewarded
    Regards
    Shashikant

    Hi,
    RP_LAST_DAY_OF_MONTHS Determine last day of month
    HR-D: Payroll Germany code
    RP_LAST_DAY_OF_MONTHS
    HR-D: Determine last day of month
    DATE_CONVERT_TO_FACTORYDATE
    Returns factory calendar date for a date Calculates and returns factory calendar date for a date (if CorrectOption = '+');
    Checks if the date is work day (if CorrectOption = '-').
    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.

  • How to find the creation date for a released requests..

    Hi friends ,
    In se09 tcode , we a date which represents the last changed date .. Now , for a particular Released request i want to find out the Creation date for it . How can i find it . I checked the tables like E070create there also we have requests that not released yet , i have also checked se03 and other tcode and a fn mo dules like TR_READ_GLOBAL_INFO_OF_REQUEST .
    So how to find the creation date for a released requests. Iam waiting for ur inputs..
    Thanks in advance..

    hi,
    Did u found the way to get the request creation date?
    I also need the same information.
    This needed for audit purpose........so it is must.
    Please help me in this.
    Best regards,
    vinod

  • To find last updated date in sql developer for a procedure or a function

    hi
    how to to find last updated date in sql developer for a procedure or a function.
    i m using sql developer version in 1.2

    I think you are in the wrong forum...
    Anyway you can try
    select * from
    all_objects o
    where o.object_type in ('FUNCTION','PROCEDURE');
    you have there the created date, last DDL and timestamp

  • How to find last inserted record in the table.

    Version: Oracle 10g
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".
    As i come to know that Rowid is not result perfect results. Please provide your inputs.

    user13416294 wrote:
    Version: Oracle 10gThat is not a version. That is a product name. A version is 10.1.0.2 or 10.2.0.4, etc.
    I have a table called "Manufacture" and 3 columns as mfno,itemname,quantity.
    How to find last inserted record in the table "Manufacture".Not possible as your data model does not cater for it. That simple.
    If there is a need to determine some order or associate some time to an entity, then that should be part of the data model - and a relationship, or one or more attributes are needed to represent that information. Thus your data model in this case is unable to meet your requirements.
    If the requirements are valid, fix the data model. In other words - your question has nothing to do with Oracle and nothing to do with rowid, rowscn or other pseudo columns in Oracle. It is a pure data modeling issue. Nothing more.

  • How to find last accessed/updated tables and the query text?

    I am using :
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.4.0 - Production
    How to find last accessed/updated tables and the query text?
    Regards
    LEE1212

    Check DBA_TBALES view there you find one date column that indicate last update
    One option is as follows:
    (1) Turn the auditing on: AUDIT_TRAIL = true in init.ora
    (2) Restart the instance if its running.
    (3) Audit the table:
         AUDIT INSERT,SELECT,DELETE,UPDATE on TableName
         by ACCESS WHENEVER SUCCESSFUL
    (4) Get the desired information using :
         SELECT OBJ_NAME,ACTION_NAME ,to_char(timestamp,'dd/mm/yyyy , HH:MM:SS')
         from sys.dba_audit_object.
    Cheer,
    Virag Sharma
    http://virag.sharma.googlepages.com/
    http://viragsharma.blogspot.com/
    Message was edited by:
    virag_sh

  • How to find out when data was deleted from table in oracle and Who deleted that

    HI Experts,
    Help me for below query:
    how to find out when data was deleted from table in oracle and Who deleted that ?
    I did that to fidn out some data from dba_tab_modifications, but I m not sure that what timestamp shows, wether it shows for update,insert or delete time ?
    SQL> select TABLE_OWNER,TABLE_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP,DROP_SEGMENTS,TRUNCATED from dba_tab_modifications where TABLE_NAME='F9001';
    TABLE_OWNER                    TABLE_NAME                        INSERTS    UPDATES    DELETES     TIMESTAMP         DROP_SEGMENTS TRU
    PRODCTL                        F9001                                                     1683         46       2171            11-12-13 18:23:39             0                   NO
    Audit is enable in my enviroment?
    customer is facing the issue and data missing in the table and I told him that yes there is a delete at 11-12-13 18:23:39 in table after seeing the DELETS column and timestamp in dba_tab_modifications, but not sure I am right or not
    SQL> show parameter audit
    NAME                                 TYPE        VALUE
    audit_file_dest                      string      /oracle/admin/pbowe/adump
    audit_sys_operations                 boolean     TRUE
    audit_syslog_level                   string
    audit_trail                          string      DB, EXTENDED
    please help
    Thanks
    Sam

    LOGMiner --> Using LogMiner to Analyze Redo Log Files
    AUDIT --> Configuring and Administering Auditing

  • How to find out which data control do the page layout components come from?

    hi,
    work in Jdev 11.1.2.3
    After have drag and drop data control into pages designer, how to find out which data control do the page layout component (such as a field in form layout) come from?
    --i cannot find data control related information in the property pallete for the page layout component.
    Regards.

    This information can be found in the page definition file.
    Select the field in the page and then click the binding tab.

  • How to get last Build date of a dll in the real time target

    Info On My Project    
       I am working on LabWindows CVI 12.0 for development . This project is a real time application for hardware, which is having Phar Lap ETS as RTOS...  
    I am facing some problems while checking Build date of my Application file( .dll)
    I have tried to use GetFileDate API. But it is not supporting for realtime Target..
    So i have tried __DATE__ macro.. That also having some problems..
    How to get last Build date of a dll from the real time target  ??
    Please Help to solve this....
    Thanks
    Vaishakh A  K

    Please reply if any one have suggestion...

  • How to find and replace data in form fields in acrobat xi, its not allowing to do so while trying, a

    how to find and replace data in form fields in acrobat xi, its not allowing to do so while trying, asking for adobe livecycle to get installed. please help.

    Easiest way to do it is the following:
    - Open the PDF file in Acrobat.
    - Go to Tools - Forms - More Form Options - Export Data.
    - Save the form data as an XML file somewhere on your system.
    - Open XML the file in a plain-text editor (I recommend Notepad++).
    - Let's say you want to replace all the years in the dates from "2013" to "2014". Do a global Search&Replace of "2013-" to "2014-" (I added the dash just to make sure that only date fields are edited).
    - Save the XML file (maybe under a new name).
    - Go back to the PDF file, and now go to Tools - Forms - More Form Options - Import Data.
    - Select the edited XML file and import it.
    - Done!

  • How to know last access date for the schema's

    Dear all,
    could u plz tell me How to know last access date for the schema’s
    Regards,
    Srinivasa rao.P

    Srinivas,
    could u plz tell me How to know last access date for the schema’s
    In Oracle, we don't access schemas but schema objects.And this informationis not kept anywhere persistantly.As Amit also mentioned,if you do need it,you have to enable Auditing.
    Aman....

Maybe you are looking for