본문 바로가기
DB/SQLPLUS

[ORACLE] ROLE(롤)

by KhyeonS 2022. 6. 20.

이번엔 롤에 대해서 알아 볼 것이다..


 롤 
  롤은 'CREATE ROLE ROLE1'식으로 만드는데 암호를 부여할 수도 있다. 롤_명은 사용자나 다른 롤_명과 당연히 중복될 수 없다. not identified, identified, by password, externally 등을 옵션으로 사용할 수 있다. 롤을 생성하는 방법은 사용자를 생성하는 방법과 동일하고, 관리자가 생성해 주어야 한다.
  Oracle에서의 권한은 
  일반적으로 connect, resource, dba, select, insert, delete, 그리고 update 등이 있고
User : create user, alter user, drop user
Session : create session, alter session
Table : create table, create any table, alter any table, drop any table, insert any table, update any table, delete any table, select any table
Index : create any index, alter any index, drop any index
View : 
Sequence :
Synonym :
Profile :
Role :

grant connect, resource to mary with admin option; 해서 admin 권한으로 connect와 resource를 쓸 수 있는 권한을 mary 사용자에게 준다. mary는 connect와 resource를 관리자가 다른 사용자에게 부여하듯이 다른 사용자에게 부여할 수 있다. 

 

 Role에 줄 수 있는 권한은 
User : create user, alter user, drop user
Session : create session, alter session
Table : create table, create any table, alter any table, drop any table, insert any                    table, update any table, delete any table, select any table
Index : create any index, alter any index, drop any index
View, Sequence, Synonym, Profile, 그리고 Role 등이 있다.

 사용자 관리에 있어서는 권한 위임과 Role을 잘 알고 있어야 한다.


●예제

SQL> create user tester2 identified by tester2 default tablespace system tempora
ry tablespace TEMP;

사용자가 생성되었습니다.

경   과: 00:00:00.00
SQL> alter user
  2  tester1 identified by rootoor;

사용자가 변경되었습니다.

경   과: 00:00:00.00
SQL> grant connect, resource, dba to tester1;

권한이 부여되었습니다.

경   과: 00:00:00.01
SQL> revoke dba from tester1;

권한이 취소되었습니다.

경   과: 00:00:00.01
SQL> commit;

커밋이 완료되었습니다.

경   과: 00:00:00.00
SQL> show user;
USER은 "SYS"입니다
SQL> create ROLE user_create;

롤이 생성되었습니다.

경   과: 00:00:00.00
SQL> grant create user, alter user to user_create;

권한이 부여되었습니다.

경   과: 00:00:00.00
SQL>

alter user tester1 account unlock/ lock;

SQL> create user tester2 identified by tester2 default tablespace system tempora
ry tablespace TEMP;

사용자가 생성되었습니다.

경   과: 00:00:00.00
SQL> alter user
  2  tester1 identified by rootoor;

사용자가 변경되었습니다.

경   과: 00:00:00.00
SQL> grant connect, resource, dba to tester1;

권한이 부여되었습니다.

경   과: 00:00:00.01
SQL> revoke dba from tester1;

권한이 취소되었습니다.

경   과: 00:00:00.01
SQL> commit;

커밋이 완료되었습니다.

경   과: 00:00:00.00
SQL> show user;
USER은 "SYS"입니다
SQL> create ROLE user_create;

롤이 생성되었습니다.

경   과: 00:00:00.00
SQL> grant create user, alter user to user_create;

권한이 부여되었습니다.

경   과: 00:00:00.00
SQL>grant user_create to scott, hr; //권한 부여

oe 사용자 에서는 관리자만 할수 있기 때문에 만들수 없다.

'DB > SQLPLUS' 카테고리의 다른 글

[ORACLE] MERGE(머지)  (0) 2022.06.20
[ORACLE] Sysnonym(동의어)  (0) 2022.06.20
[ORACLE] SEQUNCE(시퀀스)  (0) 2022.06.20
[ORACLE] INDEX(인덱스)  (0) 2022.06.20
[ORACLE] VIEW(뷰)  (0) 2022.06.20

댓글