개요
USE_TRUNCATE_PRIVILEGE 파라미터를 활성화하면 특정 테이블에 대해 TRUNCATE 권한을 사용자에게 부여할 수 있습니다. truncate on table 권한 설정을 부여받은 유저는 해당 테이블의 데이터를 직접 삭제(TRUNCATE)할 수 있습니다.
참고
Tibero 5 r73542 버전 이상부터 USE_TRUNCATE_PRIVILEGE 파라미터 설정 가능합니다.
방법
TRUNCATE ON TABLE 권한 설정 및 확인
SQL> conn sys
Enter Password: ****
Connected to Tibero.
SQL> create table testtable (a number);
Table 'TESTTABLE' created.
SQL> insert into testtable values (10);
1 row inserted.
SQL> commit;
Commit completed.
SQL> grant select on testtable to testuser;
Granted.
SQL
복사
sys의 test table을 test user가 조회할 수 있는지 확인합니다.
SQL> conn testuser
Enter Password: ****
Connected to Tibero.
SQL> select * from sys.testtable;
A
----------
10
1 row selected.
SQL
복사
해당 상황에서 해당 테이블을 truncate 하려면 아래와 같이 오류가 발생합니다.
SQL> truncate table sys.testtable;
TBR-17004: Permission denied.
SQL
복사
truncate 권한 부여 후 재시도 및 정상 작동 확인
아래와 같이 truncate 가 정상적으로 되었음을 확인할 수 있습니다.
SQL> conn sys
Enter Password: ******
Connected to Tibero.
SQL> alter system set USE_TRUNCATE_PRIVILEGE=Y;
System altered.
SQL> show parameter USE_TRUNCATE_PRIVILEGE
NAME TYPE VALUE
---------------------------- -------- -----------------------------------------
USE_TRUNCATE_PRIVILEGE Y_N YES
SQL> grant truncate on testtable to testuser;
Granted.
SQL> conn testuser
Enter Password: ****
Connected to Tibero.
SQL> select * from sys.testtable;
A
----------
10
1 row selected.
SQL> truncate table sys.testtable;
Table 'SYS.TESTTABLE' truncated.
SQL> select * from sys.testtable;
0 row selected.
SQL
복사