
- 시스템 권한
: 유저가 db에서 특정 작업을 수행할 수 있게 해주는 권한
ex.create, alter, drop등
- 객체 권한
: 유저가 특정 객체를 select 또는 변경할 수 있는 권한
ex.select, update, delete, insert
create user king3
identified by tiger;
grant connect to king3;
KING3 @ ORA19 > select *
2 from session_privs;
PRIVILEGE
----------------------------------------
SET CONTAINER
CREATE SESSION --> 접속할 수 있는 권한
grant create table to king3;
KING3 @ ORA19 > select *
from session_privs;
PRIVILEGE
----------------------------------------
SET CONTAINER
CREATE TABLE
CREATE SESSION
grant select on emp to king3;
KING3 @ ORA19 > select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------- ---------- ----------
DEPTNO
----------
7839 KING PRESIDENT 81/11/17 5000
10
7698 BLAKE MANAGER 7839 81/05/01 2850
30
7782 CLARK MANAGER 7839 81/05/09 2450
10
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------- ---------- ----------
DEPTNO
----------
7566 JONES MANAGER 7839 81/04/01 2975
20
7654 MARTIN SALESMAN 7698 81/09/10 1250 1400
30
7499 ALLEN SALESMAN 7698 81/02/11 1600 300
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------- ---------- ----------
DEPTNO
----------
7844 TURNER SALESMAN 7698 81/08/21 1500 0
30
7900 JAMES CLERK 7698 81/12/11 950
30
7521 WARD SALESMAN 7698 81/02/23 1250 500
30
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------- ---------- ----------
DEPTNO
----------
7902 FORD ANALYST 7566 81/12/11 3000
20
7369 SMITH CLERK 7902 80/12/09 800
20
7788 SCOTT ANALYST 7566 82/12/22 3000
20
EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- -------- ---------- ----------
DEPTNO
----------
7876 ADAMS CLERK 7788 83/01/15 1100
20
7934 MILLER CLERK 7782 82/01/11 1300
10
14 행이 선택되었습니다.
KING3 @ ORA19 >
-- scott.emp를 emp라고 부르겠다는 의미
create public synonym emp
for scott.emp;
public synonym을 만들고나면
scott.emp가 아니라 emp만 써도 됨
KING3 @ ORA19 > select * from emp;
.
.
.
14 행이 선택되었습니다.
KING3 @ ORA19 >
grant update on emp to king3;
KING3 @ ORA19 > update emp
set sal = 0;
14 행이 업데이트되었습니다.
- 시스템 권한
:create table,alter table등
- 객체 권한
:select on emp,update on emp,delete on emp,insert on emp등
KING3 @ ORA19 > drop table emp;
drop table emp
*
1행에 오류:
ORA-00942: 테이블 또는 뷰가 존재하지 않습니다
KING3 @ ORA19 > drop table scott.emp;
drop table scott.emp
*
1행에 오류:
ORA-01031: 권한이 불충분합니다
grant drop any table to king3;
KING3 @ ORA19 > flashback table scott.emp to before drop;
플래시백이 완료되었습니다.
KING3 @ ORA19 >
-- scott 유저에서
grant delete on emp to king3;
-- king3 유저에서
KING3 @ ORA19 > delete from emp;
14 행이 삭제되었습니다.
KING3 @ ORA19 > commit;
커밋이 완료되었습니다.
KING3 @ ORA19 > connect scott/tiger
연결되었습니다.
SCOTT @ ORA19 > alter table emp enable row movement;
테이블이 변경되었습니다.
SCOTT @ ORA19 > flashback table emp to timestamp
2 ( systimestamp - interval '10' minute);
플래시백이 완료되었습니다.
SCOTT @ ORA19 > select count(*) from emp;
COUNT(*)
----------
14
orange에서
select *
from dba_tables
where owner='HR';
select 'create public synonym ' || table_name || ' for hr.' || table_name || ';'
from dba_tables
where owner='HR';
create public synonym COUNTRIES for hr.COUNTRIES;
create public synonym DEPARTMENTS for hr.DEPARTMENTS;
create public synonym EMPLOYEES for hr.EMPLOYEES;
create public synonym JOBS for hr.JOBS;
create public synonym JOB_HISTORY for hr.JOB_HISTORY;
create public synonym LOCATIONS for hr.LOCATIONS;
create public synonym REGIONS for hr.REGIONS;
select 'grant select on ' || table_name || ' to king3;'
from dba_tables
where owner='HR';
grant select on COUNTRIES to king3;
grant select on DEPARTMENTS to king3;
grant select on EMPLOYEES to king3;
grant select on JOBS to king3;
grant select on JOB_HISTORY to king3;
grant select on LOCATIONS to king3;
grant select on REGIONS to king3;
putty에서
KING3 @ ORA19 > select count(*) from COUNTRIES;
COUNT(*)
----------
25
KING3 @ ORA19 > select count(*) from DEPARTMENTS;
COUNT(*)
----------
27
KING3 @ ORA19 > select count(*) from EMPLOYEES;
COUNT(*)
----------
107
KING3 @ ORA19 > select count(*) from JOBS;
COUNT(*)
----------
19
KING3 @ ORA19 > select count(*) from JOB_HISTORY;
COUNT(*)
----------
10
KING3 @ ORA19 > select count(*) from LOCATIONS;
COUNT(*)
----------
23
KING3 @ ORA19 > select count(*) from REGIONS;
COUNT(*)
----------
4
KING3 @ ORA19 >


- 최소 권한을 보유하게끔 권장
- 개인정보 유출이 의심되는 보안관련 패치가 나오면 무조건 패치를 씌워야됨
putty에서 king3에 접속해두고
orange에서
-- 1. 내가 가지고 있는 시스템 권한 확인
select *
from session_privs;
-- 2. 내가 가지고 있는 객체 권한 확인
select *
from user_tab_privs;