본문 바로가기

JAVA/JDBC

사용자 생성, 삭제, 연결, 권한 변경, 비밀번호 변경

먼저 기본적으로 sqlplus 라는 놈이 설치가 됬다. (환경변수까지 잘 설정되있음)

C:\oraclexe\app\oracle\product\11.2.0\server\bin\sqlplus.exe; 경로는 여기!!


cmd 창을 켜서 sqlplus에 접속하자



그다음, 설치할 때 입력했던 비밀번호로 system에 로그인하자!!


로그인에 성공하면




cjhm 이라는 이름과 1234라는 패스워드를 갖는 사용자를 생성하자!

create user userName identified by password;

1. 사용자 생성

create user cjhm identified by 1234;

성공!!!!



그 다음 모든 권한을 주자.

grant all privileges to userName;

2. 사용자 권한

grant all privileges to cjhm;

권한 주기 성공!! -- 참고로, 권한은 system이 줄 수 있고 , 이렇게 권한을 주면 admin과 같은 레벨이 된다.



drop user userName [cascade]; 

--cascade는 아래 존재하는 테이블까지 몽땅 삭제할 때 추가해주면 된다.

3. 사용자 삭제

drop user cjhm cascade;

사용자를 삭제할 때는 , system으로 접속하고 할 것. 현재 접속중일 때는 삭제 못함.


jar 파일 위치 : 

C:\oraclexe\app\oracle\product\11.2.0\server\jdbc\lib\ojdbc6.jar



conn userName/password;

4. 사용자 연결

conn cjhm/1234;



alter user userName identified by password;

5. 사용자 비밀번호 변경

alter user cjhm identified by 1111;




select username from all_users;

6. 모든 사용자 이름 조회

select username from all_users;



select table_name from user_tables;

7. 접속자의 모든 테이블 조회

select table_name from user_tables;




반응형