신문지한장

[SQL] oracle user 생성 및 삭제 본문

Oracle/sql&script

[SQL] oracle user 생성 및 삭제

신문지한장 2024. 12. 2. 16:45

OS : CentOS 7.9

 

DB : Oracle Database 19c(19.23.0)

 

1. user 계정 생성

SQL> create user testuser identified by 1234
default tablespace testtbs // default tablespace 지정하는 부분
temporary tablespace temp // temporary tablespace 지정하는 부분
quota unlimited on testtbs // 할당량 지정 : 무제한
quota 0m on system; // system tablespace 사용 못하게 지정

 

2. user default tablespace, temporary_tablespace 정보 확인

SQL> select username,account_status,default_tablespace,temporary_tablespace from dba_users order by 1;

* 12c 부터 적용되는 quota

SQL> alter user SCOTT quota unlimited on USERS;
SQL> grant unlimited tablespace to SCOTT;

 

3. 사용자 계정 삭제 연관되어 있는거까지 전부 삭제

SQL> drop user test cascade;

 

*PDB일 경우 사용자 계정 생성하기전 아래 파라미터 변경 필수

C##을 붙여야 계정생성이 가능해서 C## 제거하고 생성하기 위함

SQL> ALTER SESSION SET "_ORACLE_SCRIPT"=TRUE;