Home Database Mysql Tutorial SqlServer服务器和数据库角色

SqlServer服务器和数据库角色

Jun 07, 2016 pm 03:26 PM
sqlserver us database server Role first

首先我们来阐述服务器(实例级别)的权限,实例级别和数据库级别权限的最大不同在于:实例级别的权限是直接授权给登录名,而数据库级别的全显示授予数据库用户的,然后数据库用户再与登录名匹配。(再SqlServer中,登录名和用户是两个概念,登录名用于登录到

首先我们来阐述服务器(实例级别)的权限,实例级别和数据库级别权限的最大不同在于:实例级别的权限是直接授权给登录名,而数据库级别的全显示授予数据库用户的,然后数据库用户再与登录名匹配。(再SqlServer中,登录名和用户是两个概念,登录名用于登录到数据库实例,而用户位于数据库之内,用于和登录名匹配)

举例:

--指定登录名为dbtester,并且创建test数据库中的用户tester1
SqlServer服务器和数据库角色execute sp_grantdbaccess ‘dbtester’,'tester1'

在服务器(实例)范围内,对于不同的对象也可以授予不同的权限,主要有以下几种:端点,登录名,高可用性组,自定义服务器角色,固定服务器角色。利用sys.server_principals和sys.server_permissions 这两个视图可以查看已经被授予的权限。

示例:SqlServer服务器和数据库角色

其中我们要注意,Control Server 授予用户超级管理员的权限,可以让用户拥有对SqlServer的最高控制权,所以一般不要授予这个权限。

重点介绍一下固定服务器的角色,一共是九个分别是:

sysadmin
执行SQL Server中的任何动作,也是对任何数据库的任何操作的权限。

serveradmin
配置服务器设置,并可使用SHUTDOWN来停止实例的权限。

setupadmin
向该服务器角色中添加其他登录,添加、删除或配置链接的服务器,执行一些系统过程,如sp_serveroption。

securityadmin
用于管理登录名、读取错误日志和创建数据库许可权限的登录名,可以执行关于服务器访问和安全的所有动作。

processadmin
管理SQL Server进程,在实例中杀死其他用户进程的权限。

dbcreator
创建和修改数据库

diskadmin
管理物理数据库的权限。
bulkadmin

向数据库批量插入数据的权限(SqlServer2005中被添加进来)

public

本身不授予其他成员任何权限。只有连接权限。

固定数据库角色在数据库层上进行定义,因此它们存在于属于数据库服务器的每个数据库中。列出了所有的固定数据库角色。

db_owner
可以执行数据库中技术所有动作的用户

db_accessadmin
可以添加、删除用户的用户

db_datareader
可以查看所有数据库中用户表内数据的用户

db_datawriter
可以添加、修改或删除所有数据库中用户表内数据的用户

db_ddladmin
可以在数据库中执行所有DDL操作的用户

db_securityadmin
可以管理数据库中与安全权限有关所有动作的用户

db_backoperator
可以备份数据库的用户(并可以发布DBCC和CHECKPOINT语句,这两个语句一般在备份前都会被执行)

db_denydatareader
不能看到数据库中任何数据的用户

db_denydatawriter
不能改变数据库中任何数据的用户

参考:http://www.cnblogs.com/dannyli/archive/2012/09/18/2690740.html

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1237
24
iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Jul 23, 2024 pm 09:34 PM

According to news from this website on July 23, ASUS has launched a variety of server and workstation-level products powered by AMD EPYC 4004 series processors. Note from this site: AMD launched the AM5 platform and Zen4 architecture EPYC 4004 series processors in May, offering up to 16-core 3DV-Cache specifications. ASUSProER100AB6 server ASUSProER100AB6 is a 1U rack server product equipped with EPYC Xiaolong 4004 series processor, suitable for the needs of IDC and small and medium-sized enterprises. ASUSExpertCenterProET500AB6 workstation ASUSExpertCenterProET500AB6 is a

Secretly went for medical beauty treatment? Phased display of character art upgrades in 'Zhu Xian World' Secretly went for medical beauty treatment? Phased display of character art upgrades in 'Zhu Xian World' Apr 30, 2024 pm 02:50 PM

After the second beta test of "Zhu Xian World" ended, players' evaluations were polarized. After the second test, the official also listed a tuning list to make adjustments in five aspects: economy, development, gameplay, functions, and art. It means that corresponding optimization measures will be made in response to problems reported by players. Today, "Zhu Xian World" released a demonstration of the progress of character medical beauty in the explosive reform plan. Through screen comparison, we will show you the phased results of the project team's radical character changes in the past few months. Which version do you think looks better? The following is the exposure plan previously announced by "Zhu Xian World":

How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

How to save JSON data to database in Golang? How to save JSON data to database in Golang? Jun 06, 2024 am 11:24 AM

JSON data can be saved into a MySQL database by using the gjson library or the json.Unmarshal function. The gjson library provides convenience methods to parse JSON fields, and the json.Unmarshal function requires a target type pointer to unmarshal JSON data. Both methods require preparing SQL statements and performing insert operations to persist the data into the database.

How to connect to remote database using Golang? How to connect to remote database using Golang? Jun 01, 2024 pm 08:31 PM

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.

See all articles