데이터베이스

DATABASE STEP 36 - ACCOUNT

IT의 큰손 2023. 3. 30. 20:01
728x90

★ Account

  • 사용자 관련 > DCL
  • 계정 생성, 삭제, 잠금 제어
  • 리소스 접근 권한 제어

■ 계정 생성하기

  • 권한을 가지고 있는 계정만 가능하다. > 관리자급 (sys, system)
  • 사용방법
create user 계정명 identified by 암호 > 계정 생성
alter user 계정명 indentified by 암호 > 암호 변경
drop user 계정명 > 계정 삭제
  • 새로 생성된 계정은 아무 권한이 없다 > 접속할 권한도 없다.
  • 사용자에게 권한 부여하기
    • grant 권한명 to 유저명
  • 사용자에게 권한 제거하기
    • revoke 권한명 from 유저명;
  • 권한 종류
- create user
- create session
- create table
- create view
- create sequence
- create procedure
..
- drop user
- drop any table
  • 권한의 집합 > ROLE
  • 1. Connect : 사용자가 DB 접속 + 기본적 행동
  • 2. Resource : 사용자가 객체 조작
  • 3. DBA : 준관리자급 권한

■ 사용 ex)

  • ex1) 유저 생성
create user hong identified by java1234;
alter user hong identified by 1111;
drop user hong;
  • ex2) 권한부여 grant
grant create session to hong;
grant create table to hong;
  • ex3) 대다수가 주는 권한부여
create user team identified by java1234;
grant connect, resource, create view to team; -- 일반 계정
grant connect, resource, dba to team; --학습용
728x90