## 개인 PC에 DB 설치하기
1.오라클 사이트에서 11g 다운로드
2.압축해제
3.setup.exe 실행
=>중간 system 암호 입력
=>manager 두번 입력
------------------------------------------
##접속
1.작업표시줄 : cmd => 명령 프롬프트
C:\Users\user>sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on 수 1월 5 17:04:32 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter user-name: system
Enter password:
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL>
==>system 으로 접속 완료
----------------------------------------------------
# 유저 생성 : aa01,aa02,aa03
SQL> create user aa01 identified by aa01;
===> create user 유저명 identified by 패스워드;
===> 유저 생성만으로는 사용할 수 없다.
===> 권한을 줘야 사용가능
# 권한 주기
SQL> grant connect, resource, create view, create synonym to aa01;
# 코드만
create user aa01 identified by aa01;
grant connect, resource, create view, create synonym to aa01;
#접속해제
SQL> exit
--------------------------------------
#로컬-디벨로퍼 연결
접속>새접속
호스트:127.0.0.1 또는 localhost
1521
xe
#로컬의 aa01
=>hr 스키마
#로컬의 aa02
?!
#로컬의 aa03
=>scott 스키마 (교재 스키마)
---------------
#로컬-aa01 유저
create table emp
as
select * from hr.emp;
==> 테이블 또는 뷰가 존재하지 않는다고 에러 뜸!!
==> hr에 emp 테이블이 없고, 권한도 주지 않았음.!!
해결
==> system 권한으로 들어가서 hr의 계정 활성화 시킨후
-hr은 lock이 걸려있다->unlock해줘야 한다.
alter user hr account unlock;
==> hr 패스워드 변경:system
alter user hr identified by hr;
==> hr 계정으로 로그인하여 권한 주기
grant select on EMPLOYEES to public;
grant select on DEPARTMENTS to public;
grant select on LOCATIONS to public;
--------------------
# 로컬 - aa01 로그인
create table emp
as
select * from hr.employees;
create table dept
as
select * from hr.DEPARTMENTS;
create table locations
as
select * from hr.LOCATIONS;
'Lobo's study room > 오라클DB' 카테고리의 다른 글
[실습]커피숍 DB 만들기 (0) | 2022.02.10 |
---|---|
Oracle DB 트랜잭션 (0) | 2022.02.10 |
Oracle DB의 INDEX와 시퀀스 (0) | 2022.02.10 |
Oracle DB의 DML (0) | 2022.02.10 |
Oracle DB의 DDL (0) | 2022.02.10 |