Oracle 문법 정리 - 유저 엑세스 제어
◆유저 액세스 제어
1.유저 생성(sys 계정으로 접속)
Create user demo identified by demo; |
2.권한 부여
grant create session , create table , create sequence ,create view to demo; |
권한 부여를 할 때 매번 위와 같이 작성하는 것에 한계를 느낌
3.롤 생성
create role manager; |
4.생성 롤에 권한 부여
grant create table, create view to manager; |
5.테스트
create user alice identified by alice;
grant manager to alice; |
6.암호 변경
Alter user demo identified by employ; |
7.객체 권한(n1으로 접속)
grant select on employees to demo; -- demo계정에게 자신의 employees테이블 select의 권한을 줌
grant update (department_name,location_id) on departments to demo,manager; -- demo계정과 manager(role)에게 department_id와location_id를 update할 수 있는 권한 부여 |
8.권한 전달 : 시스템의 모든 유저가 권한을 받도록 설정(alice 계정)
Grant select on departments to pulbic; |
9.sys의 grant 권한 주기
grant select, insert on departments to demo with grant option; -- 이 부분을 입력해주면 demo는 sys의 grant권한을 가지게 된다. -- demo계정은 다음이 가능해 진다. grant select on alice.departments to public; -- alice의 departments select의 권한을 demo가 모두에게 뿌린다. |