기술 정보
home
채널 소개
home

모든 테이블 대상 TRUNCATE 권한 부여 (TRUNCATE ANY TABLE)

문서 유형
기술 정보
분야
관리/환경설정
키워드
TRUNCATE ANY TABLE
ANY TABLE
1 more property

개요

USE_TRUNCATE_PRIVILEGE 파라미터를 활성화하면 모든 테이블에 대해 TRUNCATE 권한을 사용자에게 부여할 수 있습니다. TRUNCATE ANY TABLE 권한 설정을 부여받은 유저는 모든 테이블의 데이터를 직접 삭제(TRUNCATE)할 수 있습니다.
참고
Tibero 5 r73542 버전 이상부터 USE_TRUNCATE_PRIVILEGE 파라미터 설정 가능합니다.

방법

TRUNCATE ANY TABLE 권한 설정 및 확인

SQL> conn sys Enter Password: **** Connected to Tibero. SQL> create table testtable_a (a number); Table 'TESTTABLE_A' created. SQL> insert into testtable_a values (10); 1 row inserted. SQL> create table testtable_b (b number); Table 'TESTTABLEB' created. SQL> insert into testtable_b values (20); 1 row inserted. SQL> commit; Commit completed. SQL> grant select on testtable_a to testuser; Granted. SQL> grant select on testtable_b to testuser; Granted.
SQL
복사
sys의 testtable_a와 testtable_b를 test user가 조회할 수 있는지 확인합니다.
SQL> conn testuser Enter Password: **** Connected to Tibero. SQL> select * from sys.testtable_a; A ---------- 10 1 row selected. SQL> select * from sys.testtable_b; B ---------- 20 1 row selected.
SQL
복사
해당 상황에서 해당 테이블을 truncate 하려면 아래와 같이 오류가 발생합니다.
SQL> truncate table sys.testtable_a; TBR-17004: Permission denied. SQL> truncate table sys.testtable_b; TBR-17004: Permission denied.
SQL
복사

TRUNCATE ANY TABLE 권한 부여 후 재시도 및 정상 작동 확인

아래와 같이 truncate 가 정상적으로 되었음을 확인할 수 있습니다.
SQL> conn sys Enter Password: ****** Connected to Tibero. SQL> show parameter USE_TRUNCATE_PRIVILEGE NAME TYPE VALUE ---------------------------- -------- ----------------------------------------- USE_TRUNCATE_PRIVILEGE Y_N YES SQL> grant truncate any table to testuser; Granted. SQL> conn testuser Enter Password: **** Connected to Tibero. SQL> select * from sys.testtable_a; A ---------- 10 1 row selected. SQL> select * from sys.testtable_b; B ---------- 20 1 row selected. SQL> truncate table sys.testtable_a; Table 'SYS.TESTTABLE_A' truncated. SQL> select * from sys.testtable_a; 0 row selected. SQL> truncate table sys.testtable_b; Table 'SYS.TESTTABLE_B' truncated. SQL> select * from sys.testtable_b; 0 row selected.
SQL
복사