본문 바로가기

Oracle

oracle db - Archive 모드로 구동하기 SQL> alter system set log_archive_start=true scope=spfile; System altered. SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST='C:\Oracle\product\11.1.0\db_1\database\archive' scope=spfile; System altered. SQL> ALTER SYSTEM SET log_archive_format='arch_%t_%s_%r.arc' SCOPE=spfile; System altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORA-3.. 더보기
oracle procedure -- table type => 일차원 배열 create or replace procedure table_test(v_deptno in emp.deptno%TYPE) is type empno_table is table of emp.empno%TYPE index by binary_integer; type ename_table is table of emp.ename%TYPE index by binary_integer; type sal_table is table of emp.sal%TYPE index by binary_integer; empno_tab empno_table; ename_tab ename_table; sal_tab sal_table; i binary_integer := 0; begin dbms_o.. 더보기
demobld.sql 강좌 테스트용 scott user 생성 스크립트 오라클클럽의 SQL 강좌 테스트는 SCOTT 계정의 잠금을 해제하신 후 접속하여 실행하면 됩니다. SCOTT USER 잠금 해제오라클을 설치하면 기본적으로 SCOTT 사용자는 사용을 하지 못하게 잠겨있다. 아래 명령어로 잠근을 해제 할 수 있다 -- DBA 권한으로 접속 한다. SQL> ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK; -- SCOTT USER로 접속해보자 SQL> CONN soctt/tiger; 만약 SCOTT 계정이 존재하지 않다면 아래와 같이 SCOTT USER를 신규로 생성하고, 기본 테이블 및 데이터를 생성하면 된다. SCOTT USER 신규 생성 -- 1. DBA권한으로 접속하여 SCO.. 더보기
select rows to column create table t(a varchar2(1)); insert into t values('a'); insert into t values('b'); insert into t values('c'); insert into t values('d'); insert into t values('e'); insert into t values('f'); commit; SQL> SQL> --1 SQL> select a from t; A - a b c d e f 6 개의 행이 선택되었습니다. SQL> SQL> --2 SQL> select 2 rownum-1 p, 3 rownum c, 4 a 5 from t; P C A ---------- ---------- - 0 1 a 1 2 b 2 3 c 3 4 d 4 5 e 5 .. 더보기
sysdba SQL Qeury tablespace 공간 조회 sql select a.tablespace_name, totbytes,totblocks, freebytes, freeblocks, (totbytes - freebytes) as usedbytes, (totblocks - freeblocks) as usedblocks from ( select tablespace_name, sum(bytes) totbytes, sum(blocks) totblocks from dba_data_files group by tablespace_name -- tbs가 여러개 데이터 파일이 가질 수 있기 때문에 grouping ) a, ( select tablespace_name, sum(bytes) freebytes, sum(blocks) freeblo.. 더보기