Oracle #5 - DCL

ennakoidaยท2023๋…„ 6์›” 18์ผ
0

Oracle

๋ชฉ๋ก ๋ณด๊ธฐ
5/13

๐Ÿ“ DCL

DCL (Data Control Language) : Grant (๊ถŒํ•œ ๋ถ€์—ฌ), Revoke (๊ถŒํ•œ ์ƒ์„ฑ)

GRANT

-- *********** ์‹œ์Šคํ…œ ์„ธ์…˜์œผ๋กœ ์‹คํ–‰ *************

CREATE USER USER02 IDENTIFIED BY USER02; -- USER02 ๊ณ„์ • ์ƒ์„ฑ ํ›„
GRANT CONNECT, RESOURCE TO USER02; -- ๊ถŒํ•œ ๋ถ€์—ฌ (์ ‘์†๊ถŒํ•œ, ์ƒ์„ฑ๊ถŒํ•œ)
-- *********** ์‹œ์Šคํ…œ ์„ธ์…˜์œผ๋กœ ์‹คํ–‰ *************

-- ์„ธ๋ถ€ ๊ถŒํ•œ ๋ถ€์—ฌ

GRANT SELECT ON USER01.COFFEE TO USER02;
GRANT INSERT ON USER01.COFFEE TO USER02;
-- GRANT๋ฅผ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ถŒํ•œ ๋ถ€์—ฌ

GRANT ์ ์šฉ ํ™•์ธ

-- *********** USER02 ์„ธ์…˜์œผ๋กœ ์‹คํ–‰ *************

SELECT * FROM USER01.COFFEE;
INSERT INTO USER01.COFFEE VALUES('์นด๋ˆ„์ปคํ”ผ', 1500, '์นด๋ˆ„');
INSERT INTOUSER01.COFFEE VALUES('๋ฉ”๋จธ๋“œ์ปคํ”ผ', 1500, '๋ฉ”๋จธ๋“œ'); 
COMMIT; -- COMMIT์„ ํ•ด์ค˜์•ผ ๋‹ค๋ฅธ ๊ณณ์—์„œ๋„ ์ˆ˜์ •๋œ ๋‚ด์šฉ์„ ๋ณผ ์ˆ˜ ์žˆ์Œ

REVOKE

-- *********** ์‹œ์Šคํ…œ ์„ธ์…˜์œผ๋กœ ์‹คํ–‰ *************

REVOKE SELECT ON USER01.COFFEE FROM USER02;
REVOKE INSERT ON USER01.COFFEE FROM USER02;
-- REVOKE๋ฅผ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ถŒํ•œ ํšŒ์ˆ˜

0๊ฐœ์˜ ๋Œ“๊ธ€