*.tablespace생성
create tablespace 테이블스페이스명
datafile '~~물리적인경로' size ~
ex)
create tablespace jp2
datafile 'D:\study\oracle\jp2-1.dbf' size 100m

생생 조회.
select tablespace_name, file_name, user_bytes
from dba_data_files
where tablespace_name='JP2'

*.temporary tablespace생성
create temporary tablespace 테이블스페이스명
tempfile '~~물리적인경로' size ~
ex)
create temporary tablespace jp2_temp
tempfile 'D:\study\oracle\jp2temp-1.dbf' size 50m

*.user생성
create user user명
identified by 비번
[default tablespace 테이블스페이스명 사이즈]
[temporary tablespace 테이블스페이스명 사이즈] (일시적인 작업)
ex)
create user super
identified by man
default tablespace jp2
temporary tablespace jp2_temp

*.롤(role:권한들의 집합)부여
grant 권한,권한 to user명.
-dba :
-connet :
-resource :
ex)
grant connect, resource to super


*.scott의 table. 기존sql스크립으로 생성.
@D:\oracle\ora92\sqlplus\demo\demobld.sql

*.table생성
create table table명(
컬럼명 테이터타입(크기)[,..]
)
ex)
create table mtest(
m1 char(10),
m2 varchar2(10)
)

*.데이터 타입(문자/숫자/..)
*.문자
-char : 고정길이 문자형,2000byte,
-varchar2 : 가변길이 문자형,4000byte,
-long : 2g
ex)
  1* select m1,m2,m1||m2,m2||m1 from mtest
SQL> /

M1         M2         M1||M2               M2||M1
---------- ---------- -------------------- -----------------
abcde      qqq        abcde     qqq        qqqabcde
oracle     hahahoho   oracle    hahahoho   hahahohooracle

*.숫자
-number :
-number(p) : 저살슈 5저라,
-number(p,s) : 소수점 자리포함하여 5자리
ex)
create table stest(
s1 number,
s2 number(5),
s3 number(5,2)
);

*.날짜
-date
-timestamp
-timestamp with time zone
-timestamp with local time zone
ex)
create table dtest(
d1 date,
d2 timestamp
)


- - - - - - -
*.제약조건.

Posted by 말없제이
,