출처 : http://ntalbs.tistory.com/100
샘플 스크립트
oracle_db_creation_script_sample.tar.gz
오라클 데이터베이스를 생성할 때 보통은 DBCA를 이용한다.
그러나 DBCA만 사용해 DB를 생성하다보면, DBCA를 사용할 수 없는 상황에는 당황하게 된다.
다음은 DBCA를 이용할 수 없는 경우 오라클 데이터베이스를 생성하는 절차다.
- SID, ORACLE_HOME 설정
exportORACLE_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 = AUTOundo_tablespace = UNDOTBS1db_name =testdb_block_size = 8192sga_max_size = 1073741824# 1GBsga_target = 1073741824 # 1GB
- 패스워드 파일 생성
$ORACLE_HOME/bin/orapwdfile=$ORACLE_HOME/dbs/pwd{sid}.ora password=oracle entries=5
- 인스턴스 기동
$ sqlplus'/as sysdba'SQL> startup nomount
- CREATE DATABASE 문 실행
createdatabasetestdblogfilegroup1 ('/path/to/redo1.log')size100M,group2 ('/path/to/redo2.log')size100M,group3 ('/path/to/redo3.log')size100Mcharactersetko16ksc5601nationalcharactersetal16utf16datafile'/path/to/system.dbf'size500M autoextendonnext10M maxsize unlimited extent managementlocalsysaux datafile'/path/to/sysaux.dbf'size100M autoextendonnext10M maxsize unlimitedundo tablespace undotbs1 datafile'/path/to/undotbs1.dbf'size100Mdefaulttemporarytablespacetemptempfile'/path/to/temp01.dbf'size100M;
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>createspfilefrompfile;
- 추가 테이블스페이스 생성
- sys, system 계정 암호 변경
