sp_addauditrecord [<text>[, <db_name>[, <obj_name>
[, <owner_name>[, <dbid>[, <objid>]]]]]]
是添加到当前审计表的消息的文本。这些文本将被插入该表的 extrainfo 字段。
是记录所引用的数据库的名称。该名称将被插入当前审计表的 dbname 字段。
是记录所引用的对象的名称。该名称将被插入当前审计表的 objname 字段。
是记录所引用的对象的所有者。该名称将被插入当前审计表的 objowner 字段。
是 db_name 的数据库 ID 号。不要用引号引起该整数值。<dbid> 将被插入当前审计表的 dbid 字段。
是 obj_name 的对象ID 号。不要用引号引起该整数值。<dbid> 将被插入当前审计表的 objid 字段。
在当前审计表中,将“I gave A. Smith permission to view the payroll table in the corporate database.This permission was in effect from 3:10 to 3:30 pm on 9/22/92”添加到 extrainfo 字段中;将“corporate”添加到 dbname 字段中;将“payroll”添加到 objname 字段中;将“dbo”添加到 objowner 字段中;将“10”添加到 dbid 字段中,并将“1004738270”添加到 objid 字段中:
sp_addauditrecord "I gave A. Smith permission to view the payroll table in
the corporate database. This permission was in effect from 3:10 to 3:30 pm
on 9/22/92.", "corporate", "payroll", "dbo", 10, 1004738270
将此记录添加到审计追踪中。本例使用带 @ 前缀的参数名,以便将某些字段留空:
sp_addauditrecord @text="I am disabling auditing briefly while we
reconfigure the system", @db_name="corporate"
SAP ASE 服务器将所有审计记录写入当前审计表。当前审计表由 current audit table 配置参数的值决定,而该参数是用 sp_configure 设置的。一个安装系统至多可有八个系统审计表,名称分别为 sysaudits_01、sysaudits_02,依此类推,直到 sysaudits_08。
记录实际上最先存储在内存审计队列中,审计进程稍后才将这些记录从审计队列写入当前审计表。因此,不能指望审计记录会立即存储到审计表中。
在下列情况下,可以使用 sp_addauditrecord:
sp_addauditrecord 的执行权限 – 无需任何特殊角色
sp_configure 启用了 auditing 配置参数