显示授予另一个角色的所有角色、登录名或登录配置文件、角色的表格式的整个层次树,以及其它为指定角色配置的与登录安全性有关的参数,包括锁定角色的日期、锁定原因以及锁定该角色的登录服务器用户 ID (suid)。对于受口令保护的角色,还显示角色口令加密版本。
显示通过关联的登录配置文件向登录名授予的角色。输出中的 grantee 列显示登录配置文件名(如果适用)。只有在登录名具有与为其授予的角色关联的登录配置文件时,才会显示此列。可直接关联登录配置文件,或通过缺省登录配置文件进行关联。
sp_displayroles [<grantee_name >[, <mode>]]
<grantee_name>
是要获得的角色信息所对应的用户的登录名或登录配置文件,或者是要获得的信息所对应的角色的名称。
<mode>
是以下值之一:
显示授予发出该命令的用户的所有角色:
sp_displayroles
<h2>Role Name </h2>
supervisor_role
显示授予 supervisor_role 的所有角色:
sp_displayroles "supervisor_role"
<h2>Role Name </h2>
clerk
显示授予登录名“susanne”的角色,以及层次中位于该角色之下的角色:
sp_displayroles susanne, expand_down
Role Name Parent Role Name Level
----------------- ---------------------- ------
supervisor_role NULL 1
clerk_role supervisor_role 2
显示授予 intern_role 的角色,以及层次中位于该角色之上的角色:
sp_displayroles "intern_role", expand_up
显示为指定角色配置的与登录安全性相关的参数:
sp_displayroles physician_role, "display_info"
Role name = physician_role
Locked : YES
Date when locked: Jul 14 2007 9:15AM
Reason: Role locked by SAP ASE due to failed login
attempts reaching max failed logins.
Locking suid: dr_john
Date of Last Password Change : Oct 31 1999 3:33PM
Password expiration interval = 5
Password expired : NO
Minimum password length = 4
Maximum failed logins = 10
Current failed logins = 3
Password encryption version: SHA-256
显示为登录名“tom”授予的角色,该登录名与名为“sec_profile”的登录配置文件关联。
grant role sec_role to sec_profile
create login tom with password C0mp13x login profile sec_profile
grant role emp_role to tom
go
sp_displayroles tom
go
<h2>Role Name Grantee </h2>
emp_role tom
sec_role sec_profile
当指定了可选参数 expand_up 或 expand_down 时,将显示被指定角色名包含的或包含指定角色名的所有直接授予的角色。
只有在登录名具有关联的登录配置文件,或缺省登录配置文件适用于已授予角色的登录名时,才会显示 Grantee 列。