Oracle에서 사용자에게 부여된 권한과 역할을 찾으려면 어떻게 해야 합니까?
Linux, Oracle 10g을 사용하고 있습니다.나는 test라는 이름의 사용자를 하나 만들고 동일한 사용자에게 세션 생성 및 사전 선택 권한을 부여했습니다.
또한 동일한 사용자에게 sysdba와 sysoper 역할을 부여했습니다.
이제 사용자에게 부여된 모든 권한과 역할을 표시합니다.다음 쿼리를 찾았지만 세션 생성 및 사전 선택 권한만 표시됩니다.
select privilege
from dba_sys_privs
where grantee='SAMPLE'
order by 1;
문제 해결을 도와주시기 바랍니다.
감사해요.
VAV의 답변 외에 첫 번째 답변은 제 환경에서 가장 유용했습니다.
select * from USER_ROLE_PRIVS where USERNAME='SAMPLE';
select * from USER_TAB_PRIVS where Grantee = 'SAMPLE';
select * from USER_SYS_PRIVS where USERNAME = 'SAMPLE';
http://docs.oracle.com/cd/B10501_01/server.920/a96521/privs.htm#15665 를 참조해 주세요.
USER_SYS_PRIVS, USER_를 확인합니다.TAB_PRIVS, USER_ROLE_PRIVS 테이블과 이러한 선택문
SELECT * FROM USER_SYS_PRIVS;
SELECT * FROM USER_TAB_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;
다른 답변은 모두 납득이 가지 않아 독자적인 해결책을 작성했습니다.
Oracle 11g의 경우
USER를 원하는 사용자 이름으로 바꿉니다.
부여된 역할:
SELECT *
FROM DBA_ROLE_PRIVS
WHERE GRANTEE = 'USER';
사용자에게 직접 부여된 권한:
SELECT *
FROM DBA_TAB_PRIVS
WHERE GRANTEE = 'USER';
사용자에게 부여된 권한:
SELECT *
FROM DBA_TAB_PRIVS
WHERE GRANTEE IN (SELECT granted_role
FROM DBA_ROLE_PRIVS
WHERE GRANTEE = 'USER');
부여된 시스템 권한:
SELECT *
FROM DBA_SYS_PRIVS
WHERE GRANTEE = 'USER';
현재 연결되어 있는 사용자를 검색하려면 테이블 이름의 DBA를 USER로 바꾸고 WHERE 절을 제거할 수 있습니다.
이전 제안을 조합하여 개인 권한(즉, 'USER' 권한)을 결정하고 다음을 사용합니다.
-- your permissions
select * from USER_ROLE_PRIVS where USERNAME= USER;
select * from USER_TAB_PRIVS where Grantee = USER;
select * from USER_SYS_PRIVS where USERNAME = USER;
-- granted role permissions
select * from ROLE_ROLE_PRIVS where ROLE IN (select granted_role from USER_ROLE_PRIVS where USERNAME= USER);
select * from ROLE_TAB_PRIVS where ROLE IN (select granted_role from USER_ROLE_PRIVS where USERNAME= USER);
select * from ROLE_SYS_PRIVS where ROLE IN (select granted_role from USER_ROLE_PRIVS where USERNAME= USER);
일부 역할을 통해 사용자에게 권한이 주어진 경우 SQL 이하를 사용할 수 있습니다.
select * from ROLE_ROLE_PRIVS where ROLE = 'ROLE_NAME';
select * from ROLE_TAB_PRIVS where ROLE = 'ROLE_NAME';
select * from ROLE_SYS_PRIVS where ROLE = 'ROLE_NAME';
SELECT *
FROM DBA_ROLE_PRIVS
WHERE UPPER(GRANTEE) LIKE '%XYZ%';
select *
from ROLE_TAB_PRIVS
where role in (
select granted_role
from dba_role_privs
where granted_role in ('ROLE1','ROLE2')
)
SQL을 항상 유용하게 사용: -:)
-- ===================================================
-- &role_name will be "enter value for 'role_name'".
-- Date: 2015 NOV 11.
-- sample code: define role_name=&role_name
-- sample code: where role like '%&&role_name%'
-- ===================================================
define role_name=&role_name
select * from ROLE_ROLE_PRIVS where ROLE = '&&role_name';
select * from ROLE_SYS_PRIVS where ROLE = '&&role_name';
select role, privilege,count(*)
from ROLE_TAB_PRIVS
where ROLE = '&&role_name'
group by role, privilege
order by role, privilege asc
;
제가 이해할 수 있는 유일한 결과는 권한을 얻고자 하는 사용자와 먼저 연결한 후 다음 쿼리를 실행하는 것이었습니다.
SELECT GRANTEE, PRIVILEGE, TABLE_NAME FROM USER_TAB_PRIVS;
언급URL : https://stackoverflow.com/questions/15066408/how-to-find-the-privileges-and-roles-granted-to-a-user-in-oracle
'programing' 카테고리의 다른 글
| WordPress get_query_var() (0) | 2023.03.25 |
|---|---|
| Angular에서 텍스트를 지우는 방법UI 자동 검색 입력 (0) | 2023.03.20 |
| WordPress 루트 디렉터리 경로를 검색하시겠습니까? (0) | 2023.03.20 |
| ng-bind-html의 angularjs 코드 컴파일 방법 (0) | 2023.03.20 |
| angularjs 단위로 이벤트를 트리거한 요소에 접근하는 방법 (0) | 2023.03.20 |