Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (25.92 KB, 3 trang )
11.8 Create a Database User Account
The logins that you created in How-To 11.5 or 11.6 provide access to SQL Server, but
not to any databases within SQL Server. This is much like giving someone a key to a
building, but not providing keys to offices within the building.
The fixed server role that you might have specified in How-To 11.7 gives the person
rights to perform serverwide administrative tasks such as creating or modifying
databases. Using the building analogy, this is something like giving an electrician
permission to rewire or modify the electrical service within the building. However,
neither of these settings actually grants access to databases within SQL Server. Before a
user can access a SQL Server database (somewhat like entering a locked office in the
building), he must be provided with the database user account.
I have been authenticated and logged into SQL Server and now I need to access data that
is stored within a SQL Server database. Without a specific database user account, I am
unable to access and use data that SQL Server manages.
Technique
Enterprise Manager provides the dialog boxes that are necessary to create user accounts
in any of its databases. Be sure to add the user to every database that he requires.
Otherwise, the user will not be able to use the data, run stored procedures, or otherwise
access the database.
Steps
Simply logging in to SQL Server does not automatically establish a person's database
identity. In other words, accessing SQL Server does not mean that SQL Server
recognizes the person as a valid database user.
This is particularly true when Windows NT/2000 authentication is used. After all, this
authentication mode means that anyone who logs in to Windows is able to access the
database. SQL Server needs to know exactly who the person is and what data and
database objects this person is allowed to access. A SQL Server user account is needed
for each user or group of users who is accessing SQL Server.
Each SQL Server database maintains an internal registry of user accounts that are
permitted into the database. This information is stored in the table named sysusers within
the database. The account information travels with the database's MDF file and is backed