I. 데이터베이스 엔진 설치
1. DB 설치 준비
A) DB 설치 파일 압축 해제
DB_HOME 경로 생성 후 설치 파일 압축 해제
mkdir -p $ORACLE_HOME unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
[ora19c:/home/oracle]> mkdir -p $ORACLE_HOME [ora19c:/home/oracle]> unzip /mnt/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
B) OPatch 업데이트
설치시 RU 패치를 동시에 적용할 경우 OPatch 파일을 최신 버전으로 업데이트
$ORACLE_HOME/OPatch/opatch version mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.old unzip <zip 파일이 있는 경로>/p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME chown -R oracle:oinstall $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch/opatch version
C) Response 파일 생성
Database response 파일 생성
cat > ~/db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/19c/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.rootconfig.executeRootScript=false <ctrl+C>
[ora19c:/home/oracle]> cat > ~/db_install.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/19c/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.rootconfig.executeRootScript=false ^C
2. DB 설치
A) DB 설치 전 검증
Database 설치 전 검사
export CV_ASSUME_DISTID=OEL7 # $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -executePrereqs $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -executePrereqs -applyRU <RU 파일 압축 해제 경로>
[ora19c:/home/oracle]> $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -executePrereqs -applyRU /media/sf_oracle/19.21/35642822 패치 적용을 위해 홈을 준비하는 중... /media/sf_oracle/19.21/35642822 패치 적용 중... 패치를 성공적으로 적용했습니다. 로그를 찾을 수 있는 위치: /tmp/InstallActions2024-01-08_12-04-52PM/installerPatchActions_2024-01-08_12-04-52PM.log Oracle Database 설정 마법사 실행 중... 필요 조건 검사가 성공적으로 실행되었습니다. 설치 세션 로그 이동 위치: /u01/app/oraInventory/logs/InstallActions2024-01-08_12-04-52PM
B) DB 설치
Database 설치
export CV_ASSUME_DISTID=OEL7 # $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -waitForCompletion $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -waitForCompletion -applyRU <RU 파일 압축 해제 경로>
[ora19c:/home/oracle]> $ORACLE_HOME/runInstaller -silent -responseFile ~/db_install.rsp -waitForCompletion -applyRU /media/sf_oracle/19.21/35642822 패치 적용을 위해 홈을 준비하는 중... /media/sf_oracle/19.21/35642822 패치 적용 중... 패치를 성공적으로 적용했습니다. 로그를 찾을 수 있는 위치: /tmp/InstallActions2024-01-08_01-02-50PM/installerPatchActions_2024-01-08_01-02-50PM.log Oracle Database 설정 마법사 실행 중.... 이 세션에 대한 응답 파일을 다음에서 찾을 수 있습니다. /u01/app/oracle/product/19c/db_1/install/response/db_2024-01-08_01-02-50PM.rsp 다음 위치에서 이 설치 세션의 로그를 찾을 수 있습니다. /tmp/InstallActions2024-01-08_01-02-50PM/installActions2024-01-08_01-02-50PM.log 루트 사용자로 다음 스크립트를 실행합니다. 1. /u01/app/oraInventory/orainstRoot.sh 2. /u01/app/oracle/product/19c/db_1/root.sh 다음 노드에서 /u01/app/oraInventory/orainstRoot.sh을(를) 실행하십시오. [ora19c] 다음 노드에서 /u01/app/oracle/product/19c/db_1/root.sh을(를) 실행하십시오. [ora19c] Successfully Setup Software. 설치 세션 로그 이동 위치: /u01/app/oraInventory/logs/InstallActions2024-01-08_01-02-50PM
C) root 스크립트 실행
orainstRoot.sh 및 root.sh 스크립트 실행
/u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/19c/db_1/root.sh
[root@ora19c ~]# /u01/app/oraInventory/orainstRoot.sh 다음 권한 변경 중/u01/app/oraInventory. 그룹에 대한 읽기, 쓰기 권한을 추가하는 중입니다. 월드에 대한 읽기, 쓰기, 실행 권한을 제거하는 중입니다. 그룹 이름 변경 중 /u01/app/oraInventory 대상 oinstall. 스크립트 실행이 완료되었습니다. [root@ora19c ~]# /u01/app/oracle/product/19c/db_1/root.sh Check /u01/app/oracle/product/19c/db_1/install/root_ora19c_2024-01-08_13-08-31-788905146.log for the output of root script
{}
II. 데이터베이스 생성
{}
1. 준비 작업
A) 리스너 생성
리스너 갯수와 이름 그리고 사용할 포트에 맞게 response 파일 내의 변수를 설정하기 바랍니다.
Listener response 파일 생성
cat > ~/netca.rsp [GENERAL] RESPONSEFILE_VERSION="19.0" CREATE_TYPE="CUSTOM" SHOW_GUI=false [oracle.net.ca] INSTALLED_COMPONENTS={"server","net8","javavm"} INSTALL_TYPE=""typical"" LISTENER_NUMBER=1 LISTENER_NAMES={"LISTENER"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""LISTENER"" NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
리스너 생성
netca -silent -responsefile ~/netca.rsp
[ora19c:/home/oracle]> $ORACLE_HOME/bin/netca -silent -responsefile ~/netca.rsp 명령행 인수 분석: 매개변수 "silent" = true 매개변수 "responsefile" = /home/oracle/netca.rsp 명령행 인수 분석을 완료했습니다. Oracle Net Service 구성: 프로파일 구성이 완료되었습니다. Oracle Net 리스너 시작: 실행 중인 리스너 제어: /u01/app/oracle/product/19c/db_1/bin/lsnrctl start LISTENER 리스너 제어가 완료되었습니다. 리스너가 성공적으로 시작되었습니다. 리스너 구성이 완료되었습니다. Oracle Net Service 구성을 성공했습니다. 종료 코드는 다음과 같습니다. 0
리스너 생성 결과 확인
lsnrctl status <리스너명>
[ora19c:/home/oracle]> lsnrctl status LISTENER LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-JAN-2024 14:22:21 Copyright (c) 1991, 2023, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora19c)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 08-JAN-2024 14:20:24 Uptime 0 days 0 hr. 1 min. 57 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/19c/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/ora19c/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora19c)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Services Summary... Service "orcl19c" has 1 instance(s). Instance "orcl19c", status READY, has 1 handler(s) for this service... Service "orcl19cXDB" has 1 instance(s). Instance "orcl19c", status READY, has 1 handler(s) for this service... The command completed successfully
B) 파일 저장 경로 생성
데이터 파일, FRA 경로 생성 및 권한 변경
mkdir -p /oradata/ORCL19C/online # 데이터 파일을 저장할 경로 mkdir -p /FRA/ORCL19C/online # FRA 설정 경로 chown -R oracle:oinstall /oradata chown -R oracle:oinstall /FRA
[root@ora19c ~]# mkdir -p /oradata/ORCL19C/online [root@ora19c ~]# mkdir -p /FRA/ORCL19C/online [root@ora19c ~]# chown -R oracle:oinstall /oradata [root@ora19c ~]# chown -R oracle:oinstall /FRA
C) DB 생성 스크립트 생성
DB 생성 스크립트 추출
dbca -silent -generateScripts -gdbName <글로벌DB명> -templateName New_Database.dbt -scriptDest <스크립트 저장 경로> -createAsContainerDatabase <CDB 여부> -databaseConfigType <DB 타입> -memoryMgmtType <메모리 관리 타입> -totalMemory <DB에 할당할 메모리 크기(MB)> -characterSet <문자셋> -nationalCharacterSet <National 문자셋> -storageType <스토리지 타입> -redoLogFileSize <Redo Log 크기(MB)> -databaseType <DB 용도> -datafileDestination <db_create_file_dest> -recoveryAreaDestination <db_recovery_file_dest> -recoveryAreaSize <FRA 영역 크기(MB)> -emConfiguration <EM 설정> -listeners <리스너명>
[ora19c:/home/oracle]> dbca -silent -generateScripts -gdbName orcl19c -templateName New_Database.dbt -scriptDest ~/dbca_scripts -createAsContainerDatabase false -databaseConfigType SINGLE -memoryMgmtType AUTO_SGA -totalMemory 2000 -characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 -storageType FS -redoLogFileSize 200 -databaseType MULTIPURPOSE -datafileDestination /oradata -recoveryAreaDestination /FRA -recoveryAreaSize 20000 -emConfiguration none -listeners LISTENER DB 작업 준비 5% 완료 Oracle 인스턴스 생성 및 시작 중 6% 완료 9% 완료 데이터베이스 파일 생성 중 10% 완료 14% 완료 데이터 딕셔너리 뷰 생성 중 15% 완료 18% 완료 20% 완료 22% 완료 23% 완료 27% 완료 Oracle JVM 34% 완료 41% 완료 48% 완료 50% 완료 Oracle Text 53% 완료 55% 완료 Oracle Multimedia 68% 완료 Oracle OLAP 73% 완료 Oracle Spatial 74% 완료 82% 완료 데이터베이스 생성 완료 중 84% 완료 85% 완료 86% 완료 사후 구성 작업 실행 중 100% 완료 스크립트 "/home/oracle/dbca_scripts" 생성을 성공했습니다. 자세한 내용은 로그 파일 "/u01/app/oracle/cfgtoollogs/dbca/orcl19c/orcl19c0.log"을(를) 참조하십시오.
D) 스크립트 수정
파라미터(init.ora) 수정
nls_language="AMERICAN" # 변경 audit_trail=none # 변경 # db_create_online_log_dest_1="/oradata" # 추가 # 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=1500m ########################################### # Shared Server ########################################### dispatchers="(PROTOCOL=TCP) (SERVICE=orcl19cXDB)" ########################################### # Miscellaneous ########################################### compatible=19.0.0 diagnostic_dest=/u01/app/oracle ########################################### # Network Registration ########################################### #local_listener=LISTENER_ORCL19C ########################################### # Database Identification ########################################### db_name="orcl19c" ########################################### # Security and Auditing ########################################### audit_file_dest="/u01/app/oracle/admin/orcl19c/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=500m ########################################### # Cache and I/O ########################################### db_block_size=8192 ########################################### # Cursors and Library Cache ########################################### open_cursors=300 ########################################### # File Configuration ########################################### control_files=("/oradata/ORCL19C/control01.ctl", "/FRA/ORCL19C/control02.ctl") db_recovery_file_dest="/FRA" db_recovery_file_dest_size=20000m ########################################### # Processes and Sessions ########################################### processes=300
<인스턴스 명>.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/orapwd file=/u01/app/oracle/product/19c/db_1/dbs/orapworcl19c force=y format=12 @/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
DB 생성(CreateDB.sql) 스크립트 수정
DATAFILE '/oradata/ORCL19C/system01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL -- 파일 크기 수정 SYSAUX DATAFILE '/oradata/ORCL19C/sysaux01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED -- 파일 크기 수정 SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oradata/ORCL19C/temp01.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED -- 파일 크기 수정 SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/oradata/ORCL19C/undotbs01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED -- 파일 크기 수정 LOGFILE GROUP 1 ('/oradata/ORCL19C/online/redo01.log','/FRA/ORCL19C/online/redo01.log') SIZE 200M, -- Redo 로그 이중화 추가 GROUP 2 ('/oradata/ORCL19C/online/redo02.log','/FRA/ORCL19C/online/redo02.log') SIZE 200M, -- Redo 로그 이중화 추가 GROUP 3 ('/oradata/ORCL19C/online/redo03.log','/FRA/ORCL19C/online/redo03.log') SIZE 200M -- Redo 로그 이중화 추가
SET VERIFY OFF connect "SYS"/"&&sysPassword" as SYSDBA set echo on spool /home/oracle/dbca_scripts/CreateDB.log append startup nomount pfile="/home/oracle/dbca_scripts/init.ora"; CREATE DATABASE "orcl19c" MAXINSTANCES 8 MAXLOGHISTORY 1 MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 DATAFILE '/oradata/ORCL19C/system01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/oradata/ORCL19C/sysaux01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oradata/ORCL19C/temp01.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/oradata/ORCL19C/undotbs01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 LOGFILE GROUP 1 ('/oradata/ORCL19C/online/redo01.log','/FRA/ORCL19C/online/redo01.log') SIZE 200M, GROUP 2 ('/oradata/ORCL19C/online/redo02.log','/FRA/ORCL19C/online/redo02.log') SIZE 200M, GROUP 3 ('/oradata/ORCL19C/online/redo03.log','/FRA/ORCL19C/online/redo03.log') SIZE 200M USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword"; spool off
2. DB 생성
A) 스크립트 실행
DB 생성 스크립트 수행 : 설치 노드 최종 수행
~/dbca_scripts/<인스턴스명>.sh
dump 파일 경로와 파라미터 파일 생성 후 database 생성
[ora19c:/home/oracle]> ~/dbca_scripts/orcl19c.sh /etc/oratab에 추가해야 할 항목: orcl19c:/u01/app/oracle/product/19c/db_1:Y SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jan 8 14:26:03 2024 Version 19.21.0.0.0 Copyright (c) 1982, 2022, 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 1577054648 bytes Fixed Size 8925624 bytes Variable Size 385875968 bytes Database Buffers 1174405120 bytes Redo Buffers 7847936 bytes SQL> CREATE DATABASE "orcl19c" 2 MAXINSTANCES 8 3 MAXLOGHISTORY 1 4 MAXLOGFILES 16 5 MAXLOGMEMBERS 3 6 MAXDATAFILES 100 7 DATAFILE '/oradata/ORCL19C/system01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED 8 EXTENT MANAGEMENT LOCAL 9 SYSAUX DATAFILE '/oradata/ORCL19C/sysaux01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED 10 SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/oradata/ORCL19C/temp01.dbf' SIZE 500M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED 11 SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/oradata/ORCL19C/undotbs01.dbf' SIZE 1000M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED 12 CHARACTER SET AL32UTF8 13 NATIONAL CHARACTER SET AL16UTF16 14 LOGFILE GROUP 1 ('/oradata/ORCL19C/online/redo01.log','/FRA/ORCL19C/online/redo01.log') SIZE 200M, 15 GROUP 2 ('/oradata/ORCL19C/online/redo02.log','/FRA/ORCL19C/online/redo02.log') SIZE 200M, 16 GROUP 3 ('/oradata/ORCL19C/online/redo03.log','/FRA/ORCL19C/online/redo03.log') SIZE 200M 17 USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword"; ...... << 생략 >> ...... SQL> SET serveroutput off SQL> SQL> SQL> Rem ===================================================================== SQL> Rem Run component validation procedure SQL> Rem ===================================================================== SQL> SQL> SET serveroutput on SQL> EXECUTE dbms_registry_sys.validate_components; PL/SQL procedure successfully completed. SQL> SET serveroutput off SQL> SQL> SQL> Rem =========================================================================== SQL> Rem END utlrp.sql SQL> Rem =========================================================================== SQL> select 'utlrp_end: ' || to_char(sysdate, 'HH:MI:SS') from dual; 'UTLRP_END:'||TO_CH ------------------- utlrp_end: 02:41:46 1 row selected. 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> connect "SYS"/"&&sysPassword" as SYSDBA Connected to an idle instance. SQL> startup ; ORACLE instance started. Total System Global Area 1577054648 bytes Fixed Size 8925624 bytes Variable Size 385875968 bytes Database Buffers 1174405120 bytes Redo Buffers 7847936 bytes Database mounted. Database opened. SQL> spool off SQL> exit; Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.21.0.0.0
{}