버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.


코드 블럭
languagebash
titleDBCA silent 모드로 스크립트 생성
dbca -silent -generateScripts -gdbName <글로벌DB명> -sid <ORACLE_SID> -templateName New_Database.dbt -scriptDest <스크립트 저장 경로> -createAsContainerDatabase <CDB 여부> -databaseConfigType <DB 타입> -memoryMgmtType <메모리 관리 타입> -totalMemory <DB에 할당할 메모리 크기(MB)> -characterSet <문자셋> -nationalCharacterSet <National 문자셋> -storageType <스토리지 타입> -useOMF <OMF 사용여부사용여부> -redoLogFileSize <Redo Log 크기(MB)> -databaseType <데이터베이스<DB 타입>용도> -datafileDestination <db_create_file_dest> -recoveryAreaDestination <db_recovery_file_dest> -recoveryAreaSize <FRA 영역 크기(MB)> -emConfiguration <EM 설정 여부>설정>


펼치기


서식 미적용
[orcl:/home/oracle]> dbca -silent -generateScripts -gdbName orcl -sid orcl -templateName New_Database.dbt -scriptDest ~/dbca_scripts -createAsContainerDatabase false -databaseConfigType SINGLE -memoryMgmtType AUTO_SGA -totalMemory 4000 -characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 -storageType ASM -useOMF true -redoLogFileSize 200 -databaseType MULTIPURPOSE -datafileDestination +DATA -recoveryAreaDestination +FRA -recoveryAreaSize 20000 -emConfiguration none
DB 작업 준비
4% 완료
Oracle Restart에 데이터베이스를 등록하는 중
7% 완료
Oracle 인스턴스 생성 및 시작 중
8% 완료
11% 완료
데이터베이스 파일 생성 중
12% 완료
16% 완료
데이터 딕셔너리 뷰 생성 중
17% 완료
20% 완료
22% 완료
24% 완료
25% 완료
29% 완료
Oracle JVM
36% 완료
42% 완료
49% 완료
51% 완료
Oracle Text
52% 완료
54% 완료
56% 완료
Oracle Multimedia
69% 완료
Oracle OLAP
73% 완료
Oracle Spatial
74% 완료
82% 완료
데이터베이스 생성 완료 중
84% 완료
85% 완료
87% 완료
사후 구성 작업 실행 중
100% 완료
스크립트 "/home/oracle/dbca_scripts" 생성을 성공했습니다.
자세한 내용은 로그 파일 "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log"을(를) 참조하십시오.



필요한 상황에 맞게 파라미터를 수정합니다.

코드 블럭
languagebash
title파라미터(init.ora) 수정
nls_language="AMERICAN" # 변경
audit_trail=none # 변경
db_create_online_log_dest_1="+DATA" # 추가
db_create_online_log_dest_2="+FRA" #추가


펼치기


서식 미적용
##############################################################################
# Copyright (c) 1991, 2013 by Oracle Corporation
##############################################################################

###########################################
# NLS
###########################################
nls_language="AMERICAN"
nls_territory="KOREA"

###########################################
# SGA Memory
###########################################
sga_target=3000m

###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=orclXDB)"

###########################################
# Miscellaneous
###########################################
compatible=19.0.0
diagnostic_dest=/u01/app/oracle

###########################################
# Network Registration
###########################################
#local_listener=LISTENER_ORCL

###########################################
# Database Identification
###########################################
db_name="orcl"

###########################################
# Security and Auditing
###########################################
audit_file_dest="/u01/app/oracle/admin/orcl/adump"
audit_trail=none
remote_login_passwordfile=EXCLUSIVE

###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_tablespace=UNDOTBS1

###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=1000m

###########################################
# Cache and I/O
###########################################
db_block_size=8192

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# File Configuration
###########################################
db_create_file_dest="+DATA"
db_create_online_log_dest_1="+DATA"
db_create_online_log_dest_2="+FRA"
db_recovery_file_dest="+FRA"
db_recovery_file_dest_size=20000m

###########################################
# Processes and Sessions
###########################################
processes=300



설치하지 않는 컴포넌트가 있을 경우 sql 파일을 수정합니다.

코드 블럭
languagebash
title<DB명>.sql 에서 미설치 컴포넌트 주석 처리
#@/home/oracle/dbca_scripts/context.sql
#@/home/oracle/dbca_scripts/ordinst.sql
#@/home/oracle/dbca_scripts/interMedia.sql
#@/home/oracle/dbca_scripts/cwmlite.sql
#@/home/oracle/dbca_scripts/spatial.sql


펼치기


서식 미적용
set verify off
ACCEPT sysPassword CHAR PROMPT 'Enter new password for SYS: ' HIDE
ACCEPT systemPassword CHAR PROMPT 'Enter new password for SYSTEM: ' HIDE
host /u01/app/oracle/product/19c/db_1/bin/srvctl add database -d orcl -o /u01/app/oracle/product/19c/db_1 -n orcl
host /u01/app/oracle/product/19c/db_1/bin/srvctl disable database -d orcl
host /u01/app/oracle/product/19c/db_1/bin/orapwd file=/u01/app/oracle/product/19c/db_1/dbs/orapworcl force=y format=12
host /u01/app/oracle/19c/grid/bin/setasmgidwrap o=/u01/app/oracle/product/19c/db_1/bin/oracle
@/home/oracle/dbca_scripts/CreateDB.sql
@/home/oracle/dbca_scripts/CreateDBFiles.sql
@/home/oracle/dbca_scripts/CreateDBCatalog.sql
@/home/oracle/dbca_scripts/JServer.sql
#@/home/oracle/dbca_scripts/context.sql
#@/home/oracle/dbca_scripts/ordinst.sql
#@/home/oracle/dbca_scripts/interMedia.sql
#@/home/oracle/dbca_scripts/cwmlite.sql
#@/home/oracle/dbca_scripts/spatial.sql
@/home/oracle/dbca_scripts/lockAccount.sql
@/home/oracle/dbca_scripts/postDBCreation.sql




코드 블럭
languagebash
titleDB 생성 스크립트 수행
./<DB명>.sh


펼치기


서식 미적용
[orcl:/home/oracle/dbca_scripts]> ./orcl.sh 

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jan 14 10:14:02 2020
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected.

Diskgroup altered.

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0
/etc/oratab   : orcl:/u01/app/oracle/product/19c/db_1:Y

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jan 14 10:14:03 2020
Version 19.5.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter new password for SYS: 
Enter new password for SYSTEM: 



Enter password for SYS: 


Connected to an idle instance.
SQL> spool /home/oracle/dbca_scripts/CreateDB.log append
SQL> startup nomount pfile="/home/oracle/dbca_scripts/init.ora";
ORACLE instance started.

Total System Global Area 3154113400 bytes
Fixed Size    8901496 bytes
Variable Size  637534208 bytes
Database Buffers 2499805184 bytes
Redo Buffers    7872512 bytes
SQL> CREATE DATABASE "orcl"
  2  MAXINSTANCES 8
  3  MAXLOGHISTORY 1
  4  MAXLOGFILES 16
  5  MAXLOGMEMBERS 3
  6  MAXDATAFILES 100
  7  DATAFILE SIZE 700M AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
  8  EXTENT MANAGEMENT LOCAL
  9  SYSAUX DATAFILE SIZE 550M AUTOEXTEND ON NEXT  10240K MAXSIZE UNLIMITED
 10  SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 20M AUTOEXTEND ON NEXT  640K MAXSIZE UNLIMITED
 11  SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE  SIZE 200M AUTOEXTEND ON NEXT  5120K MAXSIZE UNLIMITED
 12  CHARACTER SET AL32UTF8
 13  NATIONAL CHARACTER SET AL16UTF16
 14  LOGFILE GROUP 1  SIZE 200M,
 15  GROUP 2  SIZE 200M,
 16  GROUP 3  SIZE 200M
 17  USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";

Database created.

<< 중략 >>

SQL> select comp_id, status from dba_registry;

COMP_ID                        STATUS
------------------------------ --------------------------------------------
CATALOG                        VALID
CATPROC                        VALID
RAC                            OPTION OFF
JAVAVM                         VALID
XML                            VALID
CATJAVA                        VALID
XDB                            VALID
OWM                            VALID

8 rows selected.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host /u01/app/oracle/product/19c/db_1/bin/srvctl enable database -d orcl;

SQL> host /u01/app/oracle/product/19c/db_1/bin/srvctl start database -d orcl;

SQL> connect "SYS"/"&&sysPassword" as SYSDBA
Connected.
SQL> spool off
SQL> exit;
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0




코드 블럭
languagebash
titleDB 생성 결과 확인
crsctl stat res -t


펼치기


서식 미적용
[orcl:/home/oracle]> crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       ol7                      STABLE
ora.FRA.dg
               ONLINE  ONLINE       ol7                      STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       ol7                      STABLE
ora.asm
               ONLINE  ONLINE       ol7                      Started,STABLE
ora.ons
               OFFLINE OFFLINE      ol7                      STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ol7                      STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       ol7                      STABLE
ora.orcl.db
      1        ONLINE  ONLINE       ol7                      Open,HOME=/u01/app/o
                                                             racle/product/19c/db
                                                             _1,STABLE
--------------------------------------------------------------------------------



...