在Microsoft SQL Server中,sysadmin是最高级别的权限角色,它赋予用户对整个数据库服务器进行完全控制的权限。sysadmin角色的成员可以执行任意操作,包括创建、修改和删除数据库、登录名和其他安全对象,以及配置服务器级设置和选项。
要给用户分配sysadmin权限,可以按照以下步骤操作:
- 以sysadmin权限的登录账户(例如sa)登录到SQL Server Management Studio (SSMS)中。
- 在"对象资源管理器"窗口中,展开"安全性"文件夹。
- 右键单击"登录名"文件夹,然后选择"新建登录名"。
- 在"一般"页面上,输入登录名并选择相应的身份验证方法(Windows身份验证或SQL Server身份验证)。
- 切换到"服务器角色"页面,并选择"sysadmin"角色。
- 点击"确定"来创建新的登录名并将其授予sysadmin权限。
请注意,在授予sysadmin权限之前,请确保仔细考虑安全性和风险管理方面的问题。只有可信任的用户应该被授予sysadmin权限,因为他们具有对整个数据库服务器的完全控制权。
1> sp_help sysusers;
2> go
Name Owner Type Created_datetime
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------------------------------- -----------------------
sysusers sys view 2020-06-12 22:41:04.860
Column_name Type Computed Length Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------------------------------- --------------------------------------------------------------------------------------------------------------------------------
uid smallint no 2 5 0 yes (n/a) (n/a) NULL
status smallint no 2 5 0 yes (n/a) (n/a) NULL
name sysname no 256 no (n/a) (n/a) Chinese_PRC_CI_AS
sid varbinary no 85 yes no yes NULL
roles varbinary no 2048 yes no yes NULL
createdate datetime no 8 no (n/a) (n/a) NULL
updatedate datetime no 8 no (n/a) (n/a) NULL
altuid smallint no 2 5 0 yes (n/a) (n/a) NULL
password varbinary no 256 yes no yes NULL
gid smallint no 2 5 0 yes (n/a) (n/a) NULL
environ varchar no 255 yes no yes Chinese_PRC_CI_AS
hasdbaccess int no 4 10 0 yes (n/a) (n/a) NULL
islogin int no 4 10 0 yes (n/a) (n/a) NULL
isntname int no 4 10 0 yes (n/a) (n/a) NULL
isntgroup int no 4 10 0 yes (n/a) (n/a) NULL
isntuser int no 4 10 0 yes (n/a) (n/a) NULL
issqluser int no 4 10 0 yes (n/a) (n/a) NULL
isaliased int no 4 10 0 yes (n/a) (n/a) NULL
issqlrole int no 4 10 0 yes (n/a) (n/a) NULL
isapprole int no 4 10 0 yes (n/a) (n/a) NULL
Identity Seed Increment Not For Replication
-------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- ---------------------------------------- -------------------
No identity column defined. NULL NULL NULL
RowGuidCol
--------------------------------------------------------------------------------------------------------------------------------
No rowguidcol column defined.
No constraints are defined on object 'sysusers', or you do not have permissions.
No foreign keys reference table 'sysusers', or you do not have permissions on referencing tables.
The object 'sysusers' does not have any indexes, or you do not have permissions.
1>
1> sp_help sysprotects;
2> go
Name Owner Type Created_datetime
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ------------------------------- -----------------------
sysprotects sys view 2020-06-12 22:41:04.890
Column_name Type Computed Length Prec Scale Nullable TrimTrailingBlanks FixedLenNullInSource Collation
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------------------------------- --------------------------------------------------------------------------------------------------------------------------------
id int no 4 10 0 no (n/a) (n/a) NULL
uid smallint no 2 5 0 yes (n/a) (n/a) NULL
action tinyint no 1 3 0 yes (n/a) (n/a) NULL
protecttype tinyint no 1 3 0 yes (n/a) (n/a) NULL
columns varbinary no 8000 yes no yes NULL
grantor smallint no 2 5 0 yes (n/a) (n/a) NULL
Identity Seed Increment Not For Replication
-------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------- ---------------------------------------- -------------------
No identity column defined. NULL NULL NULL
RowGuidCol
--------------------------------------------------------------------------------------------------------------------------------
No rowguidcol column defined.
No constraints are defined on object 'sysprotects', or you do not have permissions.
No foreign keys reference table 'sysprotects', or you do not have permissions on referencing tables.
The object 'sysprotects' does not have any indexes, or you do not have permissions.