반응형

EX)
IS 라는 테이블


select * from "IS"    .................. OK
select * from "is"    .................. ERROR


즉,
쌍따옴표를 쓰되
테이블명의 대 소문자를 구분한다는 것!


cf)
MSSQL은 []괄호를 쓴다..
대소문자는 M$의 특성상 구분하지 않음.
반응형
반응형

order by cast(mid as unsigned) asc

반응형
반응형

------------------------------------------
--tablespace
------------------------------------------
--생성
CREATE TABLESPACE kimtest
DATAFILE '$ORACLE_BASE/oradata/green/kimtest.dbf' SIZE 50M AUTOEXTEND ON NEXT 5M;

--수정
ALTER DATABASE DATAFILE '$ORACLE_BASE/oradata/green/cmsdemo.dbf' AUTOEXTEND ON NEXT 10M MAXSIZE 10000M;

--삭제
DROP TABLESPACE kimtest INCLUDING CONTENTS;

--이동 (table을 tablespace 이동
ALTER INDEX 인덱스_이름 REBUILD TABLESPACE 옮길_테이블스페이스_이름;

--보기 (system 전체 tablespace)
SELECT  tablespace_name, file_name, bytes
FROM    dba_data_files;

--보기 (유저 table 목록 보기)
SELECT * FROM tab;

------------------------------------------
--user
------------------------------------------
--생성
CREATE USER kimtest IDENTIFIED BY kimtest DEFAULT TABLESPACE kimtest;

--권한주기
GRANT CONNECT, RESOURCE, CREATE TABLE TO kimtest;

--삭제(include user's tables)
DROP USER kimitest cascade;

--보기 (oracle server 접속 유저 보기)
select * from v$session where type = 'USER'


------------------------------------------
--Exporting & Importing
------------------------------------------
--Database
# exp system/manager file=wcms4.dmp full=y log=wcms4.log
  (compress=y grants=y rows=y)
  (rows=n : only schema backup)
# imp system/manager file=wcms4.dmp full=y commit=y
  (grants=y rows=y)

--User Object
# exp system/manager file=wcms4.dmp owner=wcms4
# imp system/manager file=wcms4.dmp fromuser=wcms4 touser=wcms4 commit=y
  (full=n grants=y rows=y)

--Tablespace
# exp system file=wcms4_1.dmp tablespaces=wcms4
# imp system file=wcms4_1.dmp tablespaces=kimi fromuser=wcms4 touser=kimi
# imp system file=jongno-wcms4-20040202.dmp fromuser=cmsuser touser=jongnoweb


------------------------------------------
--Oracle 시작과 종료
------------------------------------------
-- # lsnrctl start
-- # dbshut
-- # sqlplus /nolog
-- SQL> connect /as sysdba
-- SQL> startup
-- SQL> shutdown immediate
------------------------------------------



------------------------------------------
--Table
------------------------------------------
-- 속성보기
DESC MYTABLE;



-- 현재 사용자의 테이블 스페이스와 테이블 보기

select tablespace_name, table_name from tabs;





기타

◆ DB에 있는 모든 Table 이름보기

select table_name from user_tables



◆ Table의 Primary Key 찾기

select * from user_ind_columns where table_name = 'CodeTable'



◆ 서로 연결되는 Key를 찾는 방법

select constraint_name, constraint_type, r_constraint_name

from user_constraints where table_name = 'TABLE_NAME



◆ Constraint 확인

select table_name, constraint_name, constraint_type

from user_constraints

where table_name in ('DEPARTMENT','EMPLOYEE');



◆ Parameter정보 보기 (한/영코드값, 버젼정보등을 볼수있다.)

select * from nls_database_parameters
반응형
반응형

쿼리
select 'aa' || 'board' as sumchar;

결과
sumchar = 'aaboard'
반응형

+ Recent posts