SQL Server Roles 角色權限

SQL Server 提供服务器级角色以帮助你管理服务器上的权限。 这些角色是可组合其他主体的安全主体。 服务器级角色的权限作用域为服务器范围。 (“角色”类似于 Windows 操作系统中的“组”。)

下表显示了服务器级的固定角色及其权限。

服务器级的固定角色说明
sysadminsysadmin 固定服务器角色的成员可以在服务器上执行任何活动。
serveradminserveradmin 固定服务器角色的成员可以更改服务器范围的配置选项和关闭服务器。
securityadminsecurityadmin 固定服务器角色的成员可以管理登录名及其属性。 他们可以 GRANTDENY 和 REVOKE 服务器级权限。 他们还可以 GRANTDENY 和 REVOKE 数据库级权限(如果他们具有数据库的访问权限)。 此外,他们还可以重置 SQL Server 登录名的密码。

重要提示: 如果能够授予对 数据库引擎 的访问权限和配置用户权限,安全管理员可以分配大多数服务器权限。 securityadmin 角色应视为与 sysadmin 角色等效。 或者,从 SQL Server 2022 (16.x) 开始,请考虑使用新的固定服务器角色 ##MS_LoginManager##
processadminprocessadmin 固定服务器角色的成员可以终止在 SQL Server 实例中运行的进程。
setupadminsetupadmin 固定服务器角色的成员可以使用 Transact-SQL 语句添加和删除链接服务器。 (使用 Management Studio 时需要 sysadmin 成员资格。)
bulkadminbulkadmin 固定服务器角色的成员可以运行 BULK INSERT 语句。

Linux 上的 SQL Server不支持 bulkadmin 角色或 ADMINISTER BULK OPERATIONS 权限。 只有 sysadmin 才能对 Linux 上的 SQL Server 执行批量插入。
diskadmindiskadmin 固定服务器角色用于管理磁盘文件。
dbcreatordbcreator 固定服务器角色的成员可以创建、更改、删除和还原任何数据库。
public每个 SQL Server 登录名都属于 public 服务器角色。 当服务器主体尚未被授予或拒绝对安全对象的特定权限时,用户将继承授予对该对象 的公共 权限。 只有在希望所有用户都能使用对象时,才在对象上分配 Public 权限。 不能在公共场合更改成员身份。

注意:public 与其他角色的实现方式不同,可通过 public 固定服务器角色授予、拒绝或撤销权限。

SQL Server 2019 及更早版本的服务器角色权限

下图显示了分配给旧版服务器角色的权限 (SQL Server 2019 和早期版本) 。

 重要

CONTROL SERVER 权限与 sysadmin 固定服务器角色类似,但并不完全相同。 权限并不表示角色成员身份,并且角色成员身份不会授予权限。 (例如 ,CONTROL SERVER 并不意味着 sysadmin 固定服务器 role.) 但是,有时可以在角色和等效权限之间模拟。 大多数 DBCC 命令和许多系统过程要求 sysadmin 固定服务器角色的成员身份。

 为便于管理数据库中的权限,SQL Server 提供了若干*角色,这些角色是用于对其他主体进行分组的安全主体。 它们类似于 Microsoft Windows 操作系统中的  。 数据库级角色的权限作用域为数据库范围。

固定数据库角色

下表显示了固定数据库角色及其能够执行的操作。 所有数据库中都有这些角色。 无法更改分配给固定数据库角色的权限,“公共”数据库角色除外。

固定数据库角色名说明
db_ownerdb_owner 固定数据库角色的成员可以执行数据库的所有配置和维护活动,还可以 drop SQL Server 中的数据库。 (在 SQL 数据库 和 Synapse Analytics 中,某些维护活动需要服务器级别权限,并且不能由 db_owners 执行。)
db_securityadmindb_securityadmin 固定数据库角色的成员可以仅修改自定义角色的角色成员资格和管理权限。 此角色的成员可能会提升其权限,应监视其操作。
db_accessadmindb_accessadmin 固定数据库角色的成员可以为 Windows 登录名、Windows 组和 SQL Server 登录名添加或删除数据库访问权限。
db_backupoperatordb_backupoperator 固定数据库角色的成员可以备份数据库。
db_ddladmindb_ddladmin 固定数据库角色的成员可以在数据库中运行任何数据定义语言 (DDL) 命令。 此角色的成员可以通过操作可能在高特权下执行的代码来提升其特权,并且应监视其操作。
db_datawriterdb_datawriter 固定数据库角色的成员可以在所有用户表中添加、删除或更改数据。 在大多数情况下,此角色将与 db_datareader 成员身份相结合,以允许读取要修改的数据。
db_datareaderdb_datareader 固定数据库角色的成员可以从所有用户表和视图中读取所有数据。 用户对象可能存在于除 sys 和 INFORMATION_SCHEMA 以外的任何架构中 。
db_denydatawriterdb_denydatawriter 固定数据库角色的成员不能添加、修改或删除数据库内用户表中的任何数据。
db_denydatareaderdb_denydatareader 固定数据库角色的成员不能读取数据库内用户表和视图中的任何数据。

无法更改分配给固定数据库角色的权限。 下图显示了分配给固定数据库角色的权限:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Part I Overview 1. The Evolution of Microsoft SQL Server: 1989 to 2000 [加入我的離線書架] . SQL Server: The Early Years . Ron's Story . Kalen's Story . Microsoft SQL Server Ships . Development Roles Evolve . OS/2 and Friendly Fire . SQL Server 4.2 . SQL Server for Windows NT . Success Brings Fundamental Change . The End of Joint Development . The Charge to SQL95 . The Next Version . The Secret of the Sphinx . Software for the New Century 2. A Tour of SQL Server [加入我的離線書架] . The SQL Server Engine . DBMS-Enforced Data Integrity . Transaction Processing . Symmetric Server Architecture . Security . High Availability . Distributed Data Processing . Data Replication . Systems Management . SQL Server Utilities and Extensions . Client Development Interfaces . Summary Part II Architectural Overview 3. SQL Server Architecture [加入我的離線書架] . The SQL Server Engine . Managing Memory . Transaction Logging and Recovery . The SQL Server Kernel And Interaction With The Operating System . Summary Part III Using Microsoft SQL Server 4. Planning for and Installing SQL Server [加入我的離線書架] . SQL Server Editions . Hardware Guidelines . Hardware Components . The Operating System . The File System . Security and the User Context . Licensing . Network Protocols . Collation . Multiple Instances . Installing SQL Server . Basic Configuration After Installation . Remote and Unattended Installation . Summary 5. Databases and Database Files [加入我的離線書架] . Special System Databases . Database Files . Creating a Database . Expanding and Shrinking a Database . Changes in Log Size . Using Database Filegroups . Altering a Database . Databases Under the Hood . Setting Database Options . Other Database Considerations . Backing Up and Restoring a Database . Summary 6. Tables [加入我的離線書架] . Creating Tables . User-Defined Datatypes . Identity Property . Internal Storage . Constraints . Altering a Table . Temporary Tables . System Tables . Summary 7. Querying Data [加入我的離線書架] . The SELECT Statement . Joins . Dealing with NULL . Subqueries . Views and Derived Tables . Other Search Expressions . Summary 8. Indexes [加入我的離線書架] . Index Organization . Creating an Index . The Structure of Index Pages . Index Space Requirements . Managing an Index . Special Indexes . Using an Index . Summary 9. Modifying Data [加入我的離線書架] . Basic Modification Operations . Data Modification Internals . Summary 10. Programming with Transact-SQL [加入我的離線書架] . Transact-SQL as a Programming Language . Transact-SQL Programming Constructs . Transact-SQL Examples and Brainteasers . Full-Text Searching . Summary 11. Batches, Stored Procedures, and Functions [加入我的離線書架] . Batches . Routines . Stored Procedures . User-Defined Functions . Rewriting Stored Procedures as Functions . Rolling Your Own System Routines . Executing Batches,or What's Stored About Stored Procedures (and Functions)? . Temporary Stored Procedures . Autostart Stored Procedures . System Stored Procedures . Execute("any string") . Summary 12. Transactions and Triggers [加入我的離線書架] . Transactions . Triggers . Summary 13. Special Transact-SQL Operations: Working with Cursors and Large Objects [加入我的離線書架] . Cursor Basics . Cursors and ISAMs . Cursor Models . Appropriate Use of Cursors . Working with Transact-SQL Cursors . Cursor Variables . Working with Text and Image Data . Summary Part IV Performance and Tuning 14. Locking [加入我的離線書架] . The Lock Manager . Lock Types for User Data . Lock Compatibility . Internal Locking Architecture . Bound Connections . Row-Level vs. Page-Level Locking . Locking Hints and Trace Flags . Summary 15. The Query Processor [加入我的離線書架] . The SQL Manager . Compilation and Optimization . The Procedure Cache . Using Stored Procedures and Caching Mechanisms . Execution . Summary 16. Query Tuning [加入我的離線書架] . The Development Team . Application and Database Design . Planning for Peak Usage . Perceived Response Time for Interactive Systems . Prototyping, Benchmarking, and Testing . Creating Useful Indexes . Monitoring Query Performance . Concurrency and Consistency Tradeoffs . Resolving Blocking Problems . Resolving Deadlock Problems . Segregating OLTP and DSS Applications . Environmental Concerns . Summary 17. Configuration and Performance Monitoring [加入我的離線書架] . Operating System Configuration Settings . SQL Server Configuration Settings . System Maintenance . Monitoring System Behavior . Summary Bibliography and Suggested Reading
Transact-SQL, or T-SQL, is Microsoft Corporation’s powerful implementation of the ANSI standard SQL database query language, which was designed to retrieve, manipulate, and add data to relational database management systems (RDBMS). You may already have a basic idea of what SQL is used for, but you may not have a good understanding of the concepts behind relational databases and the purpose of SQL. This book will help you build a solid foundation of understanding, beginning with core relational database concepts and continuing to reinforce those concepts with real-world T-SQL query applications. If you are familiar with relational database concepts but are new to Microsoft SQL Server or the T-SQL language, this book will teach you the basics from the ground up. If you’re familiar with earlier versions of SQL Server, it will get you up-to-speed on the newest features. And if you know SQL Server 2005, you’ll learn about some exciting new capabilities in SQL Server 2008. Information Technology professionals in many different roles use T-SQL. Our goal is to provide a guide and a reference for IT pros across the spectrum of operational database solution design, database application development, and reporting and business intelligence solutions. Database solution designers will find this book to be a thorough introduction and comprehensive reference for all aspects of database modeling, design, object management, query design, and advanced query concepts. Application developers who write code to manage and consume SQL Server data will benefit from our thorough coverage of basic data management and simple and advanced query design. Several examples of ready-to-use code are provided to get you started and to continue to support applications with embedded T-SQL queries. Report designers will find this book to be a go-to reference for report query design. You will build on a thorough introduction to basic query concepts and learn to write efficient queries to support business reports and advanced analytics. Finally, database administrators who are new to SQL Server will find this book to be an all-inclusive introduction and reference of mainstream topics. This can assist you as you support the efforts of other team members. Beyond the basics of database object management and security concepts, we recommend Beginning SQL Server 2005 Administration and Beginning SQL Server 2008 Administration from Wrox, co-authored in part by the same authors. This book introduces the T-SQL language and its many uses, and serves as a comprehensive guide at a beginner through intermediate level. Our goal in writing this book was to cover all the basics thoroughly and to cover the most common applications of T-SQL at a deeper level. Depending on your role and skill level, this book will serve as a companion to the other Wrox books in the Microsoft SQL Server Beginning and Professional series.. This book will help you to learn: * How T-SQL provides you with the means to create tools for managing databases of different size, scope, and purpose * Various programming techniques that use views, user-defined functions, and stored procedures * Ways to optimize query performance * How to create databases that will be an essential foundation to applications you develop later Each section of this book organizes topics into logical groups so the book can be read cover-to-cover or can be used as a reference guide for specific topics. We start with an introduction to the T-SQL language and data management systems, and then continue with the SQL Server product fundamentals. This first section teaches the essentials of the SQL Server product architecture and relational database design principles. This section (Chapters 1–3) concludes with an introduction to the SQL Server administrator and developer tools. The next section, encompassing Chapters 4 through 9, introduces the T-SQL language and teaches the core components of data retrieval, SQL functions, aggregation and grouping, and multi-table queries. We start with the basics and build on the core structure of the SQL SELECT statement, progressing to advanced forms of SELECT queries. Chapter 10 introduces transactions and data manipulation. You will learn how the INSERT, UPDATE, and DELETE statements interact with the relational database engine and transaction log to lock and modify data rows with guaranteed consistency. You will not only learn to use correct SQL syntax but will understand how this process works in simple terms. More advanced topics in the concluding section will teach you to create and manage T-SQL programming objects, including views, functions, and stored procedures. You learn to optimize query performance and use T-SQL in application design, applying the query design basics to real-world business solutions. Chapter 15 contains a complete tutorial on using SQL Server 2008 Reporting Services to visualize data from the T-SQL queries you create. The book concludes with a comprehensive set of reference appendixes for command syntax, system stored procedures, information schema views, file system commands, and system management commands. The material in this book applies to all editions of Microsoft SQL Server 2005 and 2008. To use all the features discussed, we recommend that you install the Developer Edition, although you can also use the Enterprise, Standard, or Workgroup editions. SQL Server 2005 Developer Edition or SQL Server 2008 Developer Edition can be installed on a desktop computer running Windows 2000, Windows XP, or Windows Vista. You can also use Windows 2000 Server, Windows Server 2003, or Windows Server 2008 with the Enterprise or Standard edition. The SQL Server client tools must be installed on your desktop computer and the SQL Server relational database server must be installed on either your desktop computer or on a remote server with network connectivity and permission to access. Consult www.microsoft.com/sql for information about the latest service packs, specific compatibilities, and minimum recommend system requirements. The examples throughout this book use the following sample databases, which are available to download from Microsoft: the sample database for SQL Server 2005 is called AdventureWorks, and the sample database for SQL Server 2008 is called AdventureWorks2008. Because the structure of these databases differs significantly, separate code samples are provided throughout the book for these two version-specific databases. An example using the AdventureWorks2008DW database for SQL Server 2008 is also used in Chapter 15.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值