Beruflich Dokumente
Kultur Dokumente
Phan Hin
GII THIU
S phn chia kh nng qun tr v s dng h qun tr c s d liu SQL Server. Hnh thnh theo c cu
Ngi
ng nhp (login) Ngi dng (user) Quyn hn (permission) Nhm quyn (role)
GII THIU
Login Log in 1 SQL Service User & Permission & Role Database
R1
SQL Server
R2
P
3
NG NHP (LOGIN)
NG NHP (LOGIN)
tn_login
drop login tn_login Thay i ngi ng nhp alter login { [enable | disable] | with { password = | default_database = } }
5
drop user
tn_user
6
create role tn_user Xa nhm quyn exec sp_droprole drop role tn_role
tn_role
QUYN HN (PERMISSION)
To quyn hn Grant {ALL | permission} on table[ (column [,n])] to { user | role [, n] } [with grant option] with grant option : c php gn li quyn m mnh c cho ngi khc.
9
QUYN HN (PERMISSION)
Xa quyn hn Revoke [grant option for] {ALL | permission} on table[ (column [,n])] to { user | role [, n] } [cascade] grant option for : b tnh nng cp li quyn cho ngi khc (quyn vn c gi li). cascade: b tt c cc quyn ( cc k tha)
10
V D
ng nhp sa
Exec sp_addlogin u1, 123 Exec sp_addlogin u2, 123 Exec sp_adduser u1, u1 Exec sp_adduser u2, u2 Grant select on sinhvien to u1 with grant option
u1
c quyn dng 2 lnh - Select * from sinhvien - Grant select on sinhvien to u2 [with grant option] 11
V D
ng nhp vi u1
Grant select on sinhvien to u2 with grant option Vy u2 c quyn select v grant.
ng nhp vi sa
Revoke select on sinhvien to u1 cascade Xa ht quyn select v grant u1 v c u2 Revoke grant option for select on sinhvien to u1 cascade Xa quyn grant u1 v quyn select v grant u2
12