• create audit例子


    代码
    --setup
    USE MASTER
    GO
    -- Create the server audit
    CREATE SERVER AUDIT test_audit
        
    TO FILE ( FILEPATH = 
    'E:\audit' );
    GO
    -- Enable the server audit
    ALTER SERVER AUDIT test_audit 
    WITH (STATE = ON) ;
    GO
    -- Move to the target database
    USE Fortest_lmtopo
    GO
    CREATE DATABASE AUDIT SPECIFICATION Audit_MEETING_VISITOR
    FOR SERVER AUDIT test_audit
    ADD (update , INSERT,delete
         
    ON lmuser.MEETING_VISITOR by public)--audit these operation executed by any user because all users are inhert from 'public'role
    WITH (STATE = ON)
    GO
    --CREATE DATABASE AUDIT SPECIFICATION Audit_update_Fortest_lmtopo
    --
    FOR SERVER AUDIT test_audit
    --
    ADD (DATABASE_OBJECT_ACCESS_GROUP
    --
    )
    --
    WITH (STATE = ON)


    --query

    select a.name as [Action],c.class_type_desc as [ObjectType],f.schema_name,f.object_name,f.statement from
    sys.fn_get_audit_file('c:\case\*',default,default) f inner join sys.dm_audit_actions a
    on f.action_id=a.action_id inner join sys.dm_audit_class_type_map c on f.class_type=c.class_type
    AND c.securable_class_desc = a.class_desc



    GO
    --clean
    go
    use Fortest_lmtopo
    go
    ALTER database AUDIT specification Audit_MEETING_VISITOR with(state=off
    go
    drop database audit specification Audit_MEETING_VISITOR
    go
    use master
    go
    alter server audit test_audit with (state=off)
    go
    drop server audit test_audit
    go

    http://technet.microsoft.com/en-us/library/cc280404.aspx

    http://www.sqldbatips.com/showarticle.asp?ID=136

     USE MASTER
    GO
    -- Create the server audit
    CREATE SERVER AUDIT test_audit
    TO FILE ( FILEPATH = 
    'C:\cases\Cluster\116020613677365- SQL server not starting up in cluster' );
    GO
    -- Enable the server audit
    ALTER SERVER AUDIT test_audit 
    WITH (STATE = ON) ;
    GO
    
    
    CREATE SERVER AUDIT SPECIFICATION audit_specification_name
    FOR SERVER AUDIT test_audit
    ADD ( SERVER_PERMISSION_CHANGE_GROUP ) ,
    add (SERVER_PRINCIPAL_CHANGE_GROUP)
     WITH ( STATE =  ON ) 
    
  • 相关阅读:
    FilterLog代码分析
    Session
    关于XML的技术详情----XML定义 用途 工作原理及未来
    javaee思维导图
    互联网应用与企业级应用的区别
    javaee课程目标
    Recycle -- 项目总结
    python3.6学习笔记2基础语法
    python3.6学习笔记1认识python
    CentOS6.5下Virtualenv搭建Python3开发环境
  • 原文地址:https://www.cnblogs.com/stswordman/p/1639114.html
Copyright © 2020-2023  润新知