① 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.