查询登录数据库的用户信息?
想查询登录sqlserver数据库的用户信息,请问怎么查询?
[解决办法]
exec sp_who/*spid ecid status loginame hostname blk dbname cmd 1 0 background sa 0 NULL LAZY WRITER 2 0 sleeping sa 0 NULL LOG WRITER 3 0 background sa 0 master SIGNAL HANDLER 4 0 background sa 0 NULL LOCK MONITOR 5 0 background sa 0 master TASK MANAGER 6 0 background sa 0 master TASK MANAGER 7 0 sleeping sa 0 NULL CHECKPOINT SLEEP8 0 background sa 0 master TASK MANAGER 9 0 background sa 0 master TASK MANAGER 10 0 background sa 0 master TASK MANAGER 11 0 background sa 0 master TASK MANAGER 12 0 background sa 0 master TASK MANAGER 51 0 sleeping NT AUTHORITY\SYSTEM FLYSTONE 0 msdb AWAITING COMMAND52 0 sleeping NT AUTHORITY\SYSTEM FLYSTONE 0 msdb AWAITING COMMAND53 0 sleeping sa FLYSTONE 0 CSDN_TEST AWAITING COMMAND54 0 sleeping sa FLYSTONE 0 master AWAITING COMMAND55 0 runnable sa FLYSTONE 0 CSDN_TEST SELECT (所影响的行数为 17 行)*/
[解决办法]
--查看数据库里用户和进程的信息 sp_who --查看所有数据库用户登录信息sp_helplogins --查看数据库启动时间select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1 --查看数据库启动的参数exec master..xp_msver