출처 :http://cafe.naver.com/2007jsp.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=580

-- 먼저 로그인을 합니다.

% sqlplus /as sysdba

-- 오라클 시작 및 종료

SQL>startup restrict;    open까지 실행하고 일반사용자는 사용할 수 없음
SQL>startup force;       자동종료후 다시시작
SQL>startup nomount;
SQL>alter database mount;
SQL>alter database open;

-- 간단하게 하고 싶다!!!!
SQL>startup
SQL>shutdown abort

-- 디비에 뭐가 있나??

SQL>select * from v$database;

SQL>select * from all_users; 현재 생성된 사용자
SQL>select * from v$sga;

SQL>show sga   메모리 사용보기
SQL>show parameter;
SQL>select * from dba_users;

-- 사용자 생성, 변경, 삭제
%sqlplus system/manager
SQL>create user 사용자indetified by 암호
     2>default tablespace system  ( <- 별로 안좋은 설정. tablespace 만들고 한다. )
     3>temporary tablespace temp

     4>quota 1M on system;

변경
SQL>alter user 사용자 identified by 암호;

삭제
SQL>drop user 사용자 cascade; (가지고 있는 모든객체화 함께 삭제)

권한과 룰
create session, table, index, view, sequence, cluster
drop  " 
alter  "

grant [시스템권한] to [사용자명] with admin option;


보통은 사용자 추가후...

grant resource, connect to 사용자;  로 사용한다고 하더라

-- 전체테이블보기
select table_name from dba_tables

--제약조건 확인
SQL>select * from user_constrainsts where table_name='EMP';

-- 각테이블의 컬럼내용보기
SQL>desc [table_name];

-- 똑같은 구조의 테이블작성
SQL>create table emp_temp as select * from emp;

-- user 테이블스페이스

테이블스페이스 생성
SQL>create tablespace insa datafile '/disk2/oracle/insa_01.dbf'(절대경로/파일이름) size 1M;

테이블스페이스 크기추가
SQL>alter tablespace insa add datafile '/disk2/oracle/insa_02.dbf' size 1M;

데이터 파일 크기 변경
SQL>alter tablespace insa datafile '/disk2/oracle/insa_01.dbf' resize 3M;

데이터 파일 자동변경
SQL>alter tablespace insta datafile '/disk2/oracle/insa_02.dbf'
     2>autoextend on next 1M maxsize 10M;

테이블 스페이스삭제
SQL>drop tablespace insa including contents;
SQL>exit 한후에 디렉토리의 화일을 직접삭제...

-- 기본테이블스페이스
SQL>create user gracian identified by gracian1234 default tablespace system;

현재 기본테이블스페이스확인
SQL>select username, default_tablespace from dba_users;

 로컬리 테이블스페이스
SQL>create tablespace account datafile '/disk1/oracle/account_01.dbf' size 1M
     2>extent management local uniform size 50k;

Posted by 나비:D
:
BLOG main image
by 나비:D

공지사항

카테고리

분류 전체보기 (278)
Programming? (0)
---------------------------.. (0)
나비의삽질 (5)
Application (177)
SQL (51)
Web (27)
etc. (14)
Omnia (0)
---------------------------.. (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

달력

«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Total :
Today : Yesterday :