① grant dba与grant sysdba有什么区别
DBA是一种角色,赋予了操作数据的权限。而SYSDBA则是一个特殊的系统用户,使用此用户连接数据库时无需输入密码,并且能够访问所有表。
DBA角色的创建和分配通常由数据库管理员执行,能够执行大多数与数据库相关的操作,如创建表、执行查询和管理用户权限等。而SYSDBA用户拥有更广泛的权限,包括但不限于启动和关闭数据库、恢复数据库以及执行其他系统级操作。
值得注意的是,SYSDBA拥有极大的权限,因此仅应由最信任的用户使用。滥用此权限可能对数据库造成严重损害。相比之下,DBA虽然也拥有强大的权限,但其作用范围主要集中在数据操作上。
在实际应用中,DBA角色和SYSDBA用户之间的区别可能不会总是那么明显,特别是在小型数据库环境中。然而,在大型复杂系统中,明确区分这两个概念是至关重要的,以确保数据的安全性和系统的稳定性。
总之,DBA和SYSDBA在数据库管理中的角色和权限有着本质的区别。DBA主要用于执行数据操作,而SYSDBA则负责系统级的任务。正确理解并合理利用这两个概念,有助于提高数据库管理的效率和安全性。
② “是否允许连接到数据库引擎”和“登录”有什么区别
“是否允许连接到数据库引擎”和“登录”的区别
sql server 2005中登录名的状态里面有个设置选项,里面包括了“是否允许连接到数据库引擎”选项为“授予”、“拒绝”,还有一个“登录”选项,包括“启用”,“禁用”。这两项有什么区别吗?
下面分享一些个人的了解。
用户要访问访问数据库时,首先必须具备联接到数据库引擎的权限,下一步DBMS会根据用户提供的账户信息进行核实,如果此用户被启用,则成功连接到相应数据库。
分别在“是否允许连接到数据库引擎”“登录”选项中选择:“拒绝”,“启用”以及“授予”,“禁用”两组设置值。
连接数据库得到以下提示:
如果在“是否允许连接到数据库引擎”中选择“拒绝”,相当于执行了语句:
view plain to clipboardprint?
DENY CONNECT SQL TO [user_xxgl]
DENY CONNECT SQL TO [user_xxgl]
此时不管DBMS发现当前试图连接的用户是user_xxgl时,就直接把它踢掉了,不管其是否输入正确的密码信息。此选项其对sysadmin 无效。
如果在“登录”中选择“禁用”,相当于执行了语句:
view plain to clipboardprint?
ALTER LOGIN [user_xxgl] DISABLE
ALTER LOGIN [user_xxgl] DISABLE
此时不管DBMS发现当前试图连接的用户是user_xxgl时,并且用户输入了正确的密码信息后,才提示用户:此用户被停职了,密码正确也没用。此选项无法应用于windows平台上的用户及用户组。
关于这两个的不同微软的讨论区,有些讨论:
In order to successfully login, you'd need to both Grant permission to connect to the database engine and Enable the login.
Granting permission to the DB Engine basically says this login can connect to this server instance...enabling/disabling a login does just that - enables or disables it's ability to login to the instance.
If you still have trouble after this, also take a look at the default database for the login and make sure the login has permission to access that database. For more information, see the following topics in BOL:
CREATE LOGIN (server level login to allow permission at the instance level)
CREATE USER (database level user that maps to a login to allow permissions at a particular database level)
Once you have the user in a database, you'll need to grant permissions to that user to allow it to do whatever you are trying to do with it (i.e. select, update, delete, etc.)
alter login disable will block all logins from connecting to sql server.
denying connect sql to the login will not block members of the sysadmin fixed server role from logging in because denys do not apply to sysadmins.
Disabled logins can be impersonated via execute as login = 'login_name' but they can't directly connect.
For a given databse, you can deny the connect permission to the user associated with the login and this will block access to the user. If the login is a sysadmin then the database user will be dbo and you cannot block out the dbo.