출처 : http://ntalbs.tistory.com/100
샘플 스크립트
oracle_db_creation_script_sample.tar.gz
오라클 데이터베이스를 생성할 때 보통은 DBCA를 이용한다.
그러나 DBCA만 사용해 DB를 생성하다보면, DBCA를 사용할 수 없는 상황에는 당황하게 된다.
다음은 DBCA를 이용할 수 없는 경우 오라클 데이터베이스를 생성하는 절차다.
- SID, ORACLE_HOME 설정
export
ORACLE_SID=testdbexport ORACLE_HOME=
/path/to/oracle/home
- 초기화 파라미터 파일 생성 (minimal)
$ORACLE_HOME/dbs에 init<SID>.ora 파일을 만든다.control_files = (
/path/to/control1
.ctl,
/path/to/control2
.ctl,
/path/to/control3
.ctl)
undo_management = AUTO
undo_tablespace = UNDOTBS1
db_name =
test
db_block_size = 8192
sga_max_size = 1073741824
# 1GBsga_target = 1073741824 # 1GB
- 패스워드 파일 생성
$ORACLE_HOME
/bin/orapwd
file
=$ORACLE_HOME
/dbs/pwd
{sid}.ora password=oracle entries=5
- 인스턴스 기동
$ sqlplus
'/as sysdba'
SQL> startup nomount
- CREATE DATABASE 문 실행
create
database
test
dblogfile
group
1 (
'/path/to/redo1.log'
)
size
100M,
group
2 (
'/path/to/redo2.log'
)
size
100M,
group
3 (
'/path/to/redo3.log'
)
size
100M
character
set
ko16ksc5601
national
character
set
al16utf16
datafile
'/path/to/system.dbf'
size
500M autoextend
on
next
10M maxsize unlimited extent management
local
sysaux datafile
'/path/to/sysaux.dbf'
size
100M autoextend
on
next
10M maxsize unlimited
undo tablespace undotbs1 datafile
'/path/to/undotbs1.dbf'
size
100M
default
temporary
tablespace
temp
tempfile
'/path/to/temp01.dbf'
size
100M;
CREATE DATABASE 문 Syntax는 다음과 같다.CREATE DATABASE [database name]
[CONTROLFILE REUSE]
[LOGFILE [GROUP integer] file specification]
[MAXLOGFILES integer]
[MAXLOGMEMBERS integer]
[MAXLOGHISTORY integer]
[MAXDATAFILES integer]
[MAXINSTANCES integer]
[ARCHIVELOG|NOARCHIVELOG]
[CHARACTER SET charset]
[NATIONAL CHARACTER SET charset]
[DATAFILE filespec [autoextend]]
[DEFAULT TEMPORARY TABLESPACE tablespace filespec]
[UNDO TABLESPACE tablespace DATAFILE filespec]
[SET TIME_ZONE [time_zone_region]];
- Data Dictionary View 생성 스크립트 실행
$ORACLE_HOME
/rdbms/admin/CATALOG
.sql$ORACLE_HOME
/rdbms/admin/CATPROC
.sql
- SPFILE 생성
SQL>
create
spfile
from
pfile;
- 추가 테이블스페이스 생성
- sys, system 계정 암호 변경