Ⅰ 怎么查看sql server所有登录用户
1.大多数 Windows 用户都需要一个 SQL Server 登录名以便连接到 SQL Server。本主题说明了如何创建 SQL Server 登录名。
2.创建使用 Windows 身份验证 (SQL Server Management Studio) 的 SQL Server 登录名
3.在 SQL Server Management Studio 中,打开对象资源管理器并展开要在其中创建新登录名的服务器实例的文件夹。
4.右键单击“安全性”文件夹,指向“新建”,然后单击“登录名”。
5.在“常规”页上的“登录名”框中输入一个 Windows 用户名。
6.选择“Windows 身份验证”。
7.单击“确定”。
Ⅱ 用SQL数据库如何查看数据库的用户
select * from tableName;
tableName是数据库中注册用户表。
查询具体的字段:
SELECT column_name,column_name FROM tableName;
例子:
获取名为 "LastName" 和 "FirstName" 的列的内容(从名为 "Persons" 的数据库表):
SELECT LastName,FirstName FROM Persons;
(2)SQL查询一个角色所有的用户扩展阅读:
获取数据库所有表的字段及其字段
select table_name,column_name,column_comment,column_type,column_key from information_schema.Columns
where table_schema='数据库'
获取数据库某个表的字段及其字段
select table_name,column_name,column_comment,column_type,column_key from information_schema.Columns
where table_name='表名' and table_schema='数据库'
Ⅲ sql server 怎么查看用户
SQL Server中查询用户的对象权限和角色的方法
-- 查询用户的object权限
exec sp_helprotect NULL, 'UserName'
-- 查询用户拥有的role
exec sp_helpuser 'UserName'
-- 查询哪些用户拥有指定的系统role
exec sp_helpsrvrolemember 'sysadmin'
-- 可查询嵌套role
WITH tree_roles as
(
SELECT role_principal_id, member_principal_id
FROM sys.database_role_members
WHERE member_principal_id = USER_ID('UserName')
UNION ALL
SELECT c.role_principal_id,c.member_principal_id
FROM sys.database_role_members as c
inner join tree_roles
on tree_roles.member_principal_id = c.role_principal_id
)
SELECT distinct USER_NAME(role_principal_id) RoleName
FROM tree_roles
-- 其他权限相关基本表
select * from sysusers
select * from syspermissions
-- Who has access to my SQL Server instance?
SELECT
name as UserName, type_desc as UserType, is_disabled as IsDisabled
FROM sys.server_principals
where type_desc in('WINDOWS_LOGIN', 'SQL_LOGIN')
order by UserType, name, IsDisabled
-- Who has access to my Databases?
SELECT
dp.name as UserName, dp.type_desc as UserType, sp.name as LoginName, sp.type_desc as LoginType
FROM sys.database_principals dp
JOIN sys.server_principals sp ON dp.principal_id = sp.principal_id
order by UserType
select * from sys.database_principals
-- Server Roles
select
p.name as UserName, p.type_desc as UserType, pp.name as ServerRoleName, pp.type_desc as ServerRoleType
from sys.server_role_members roles
join sys.server_principals p on roles.member_principal_id = p.principal_id
join sys.server_principals pp on roles.role_principal_id = pp.principal_id
where pp.name in('sysadmin')
order by ServerRoleName, UserName
-- Database Roles
SELECT
p.name as UserName, p.type_desc as UserType, pp.name as DBRoleName, pp.type_desc as DBRoleType, pp.is_fixed_role as IfFixedRole
FROM sys.database_role_members roles
JOIN sys.database_principals p ON roles.member_principal_id = p.principal_id
JOIN sys.database_principals pp ON roles.role_principal_id = pp.principal_id
where pp.name in('db_owner', 'db_datawriter')
-- What can these users do?
SELECT
grantor.name as GrantorName, dp.state_desc as StateDesc, dp.class_desc as ClassDesc, dp.permission_name as PermissionName ,
OBJECT_NAME(major_id) as ObjectName, GranteeName = grantee.name
FROM sys.database_permissions dp
JOIN sys.database_principals grantee on dp.grantee_principal_id = grantee.principal_id
JOIN sys.database_principals grantor on dp.grantor_principal_id = grantor.principal_id
where permission_name like '%UPDATE%'
Ⅳ 查询oracle数据库所有用户的sqlplus命令是什么
命令是select * from dba_users,设置方法为:
1、在数据库的开始菜单中,输入cmd后回车,也就是调用Windows的命令行管理器。
Ⅳ sql一个用户有多个角色,查询具有该用户的其他角色的用户
--查询用户的角色ID,再查询同样角色的用户
selectu.*from用户表uinnerjoin用户和角色关联表ronu.用户ID=r.用户IDwherer.角色IDin(
select角色IDfrom用户和角色关联表where用户ID=5)
Ⅵ 如何查看一个SQL数据库的用户名
查看一个SQL数据库的用户名的具体步骤如下:
1、首先配置PLSQL连接某个oracle数据库,然后打开plsql工具,点击工具栏上的"Tools"(工具选项)。
Ⅶ 用SQL数据库如何查看数据库的用户
select * from tableName;
tableName是租羡数据库中注册用键型槐户表。
查询具体的字段:
SELECT column_name,column_name FROM tableName;
例子:
获取名为 "LastName" 和 "FirstName" 的列的内容(从名为 "Persons" 的数据库表):
SELECT LastName,FirstName FROM Persons;
(7)SQL查询一个角色所有的用户扩展阅读:
获取数据库所有表的字段及其字段
select table_name,column_name,column_comment,column_type,column_key from information_schema.Columns
where table_schema='数稿友据库'
获取数据库某个表的字段及其字段
select table_name,column_name,column_comment,column_type,column_key from information_schema.Columns
where table_name='表名' and table_schema='数据库'
Ⅷ 如何用sql语句查询一个用户,看看他具有哪些权限
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
1.查看所有用户:
select * from dba_users;
select * from all_users;
select * from user_users;
2.查看用户或角色系统权限(直接赋值给用户或角色的系统权限):
select * from dba_sys_privs;
select * from user_sys_privs;
3.查看角色(只能查看登陆用户拥有的角色)所包含的权限
sql>select * from role_sys_privs;
4.查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
5.查看所有角色:
select * from dba_roles;
6.查看用户或角色所拥有的角色:
select * from dba_role_privs;
select * from user_role_privs;
7.查看哪些用户有sysdba或sysoper系统权限(查询时需要相应权限)
select * from V$PWFILE_USERS
比如我要查看用户 wzsb的拥有的权限:
SQL> select * from dba_sys_privs where grantee='WZSB';
GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
WZSB CREATE TRIGGER NO
WZSB UNLIMITED TABLESPACE NO
比如我要查看用户 wzsb的拥有的角色:
SQL> select * from dba_role_privs where grantee='WZSB';
GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE
------------------------------ ------------------------------ ------------ ------------
WZSB DBA NO YES
查看一个用户所有的权限及角色
select privilege from dba_sys_privs where grantee='WZSB'
union
select privilege from dba_sys_privs where grantee in
(select granted_role from dba_role_privs where grantee='WZSB' );
Ⅸ db2数据库查询所有用户的sql语句
select name from sysibm.systables where type='T' and creator='DB2ADMIN'
type:数据库表用T表示;数据库视图用V表示
creator:数据库对象的创建者