필자가 자주 가는 카폐에 어떤분이 권한 문제로 고민을 하길래 간단히 예를 들어 보았다
시나리오는 아래와 같다.
- 시나리오 : scott 계정과 rchwin 이란 계정이 있는데 scott 계정의 dept 테이블을
rchwin 계정이 select 하려고 할때 발생하는 문제 및 해결방법
1. scott 계정으로 접속하여 dept 테이블 select 권한을 rchwin 에게 부여.
SQL> conn scott/tiger
SQL> select * from DEPT;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> grant select on dept to rchwin;
Grant succeeded.
2. rchwin 계정으로 로그인.
SQL> conn rchwin/패스
3. 테이블 조회를 하려고 하니 안됨
SQL> select * from dept;
select * from dept
*
ERROR at line 1:
ORA-00942: table or view does not exist
4. 스키마를 지정해주니 조회 됨
SQL> select * from scott.dept ;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
5. 일일이 스키마 지정하는게 번거롭고 스키마 지정없이 질의가 가능하게 하려면 시노님 생성
SQL> create synonym dept for scott.dept;;
Synonym created.
SQL> select * from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
6. 해당 OBJECT 의 속성을 보니 SYNOYM 으로 확인 가능
SQL> select object_name, object_type, created from user_objects where object_name = 'DEPT';
OBJECT_NAME OBJECT_TYPE CREATED
------------------------------ ------------------- --------------
DEPT SYNONYM 09-MAY-2008

이 글의 권한은 dbtown.net 에 있습니다.
자료를 스크랩하실땐 출처를 밝혀주세요 ^^
Skin Technical Note
Sites validated CSS, XHTML & IE6, IE7, FireFox, Opera and Safari Accessiable. Generator & Powered by Zeroboard XE. This site inspired by Slabovia and developed by WTA

