zoukankan      html  css  js  c++  java
  • 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 ) 
    
  • 相关阅读:
    request和response使用
    oracle_to_char
    oracl_LTRIM_RITRIM
    convert
    jdbc
    oracle_trunc
    [python]glob模块中的glob()函数为什么返回空列表??
    win10 anaconda+tensorflow+keras
    Golang学习:sublime text3配置golang环境
    2018/12/05学习笔记
  • 原文地址:https://www.cnblogs.com/stswordman/p/1639114.html
Copyright © 2011-2022 走看看