Oracle 19c를 CentOS7에 CUI에서 설치

Oracle 19c를 CentOS7.7에 CUI에서 설치해보십시오.



참고
Database Installation Guide for Linux

환경



CentOS Linux release 7.7.1908

사전 준비



Oracle Preinstallation RPM 설치



참고 : Installing Oracle Database Using RPM Packages - Running RPM Packages to Install Oracle Database

/tmp 등 적절한 위치에 다운로드한 후 yum에서 localinstall로 실행
# curl -OL https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

Oracle 본체 설치



아래 사이트에서 설치용 rpm 다운로드
htps //w w. 오 c. 코 m/다타바세/테 ch의 ㄉ기에 s/오라 cぇ-다바세-그 f와 ぁ레-드 w응아 ds. HTML
htps //w w. 오라 cぇ. 이 m/테 ch네와 rk/jp/다바세/엔테 rp 리세-에 치온/도w응아 ds/어서 x. HTML

다운로드한 rpm 파일을 지정하여 설치 수행
# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm

Loaded plugins: fastestmirror, langpacks
Examining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution
gitlab_gitlab-ee/x86_64/signature                                                       |  836 B  00:00:00
gitlab_gitlab-ee/x86_64/signature                                                       | 1.0 kB  00:00:00 !!!
gitlab_gitlab-ee-source/signature                                                       |  836 B  00:00:00
gitlab_gitlab-ee-source/signature                                                       |  951 B  00:00:00 !!!

Dependencies Resolved

==============================================================================================================
 Package                          Arch             Version      Repository                               Size
==============================================================================================================
Installing:
 oracle-database-ee-19c           x86_64           1.0-1        /oracle-database-ee-19c-1.0-1.x86_64     6.9 G

Transaction Summary
==============================================================================================================
Install  1 Package

Total size: 6.9 G
Installed size: 6.9 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracle-database-ee-19c-1.0-1.x86_64                                                        1/1
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script 
 as root: /etc/init.d/oracledb_ORCLCDB-19c configure
  Verifying  : oracle-database-ee-19c-1.0-1.x86_64                                                        1/1

Installed:
  oracle-database-ee-19c.x86_64 0:1.0-1

Complete!

기본적으로/opt/oracle 아래에 설치됩니다.

데이터베이스 작성 및 configure



※ ORACLE_SID와 ORACLE_HOME을 환경 변수로 설정하고 configure를 실행합니다.
# export ORACLE_BASE=/opt/oracle
# export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
# export ORACLE_SID=ORCLCDB
# /etc/init.d/oracledb_ORCLCDB-19c configure

Configuring Oracle Database ORCLCDB.
[WARNING] [DBT-11209] Current available memory is less than the required available memory (1,515MB) 
 for creating the database.
   CAUSE: Following nodes do not have required available memory :
 Node:localhost         Available memory:930.7305MB (953068.0KB)

Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.

Database configuration completed successfully.
 The passwords were auto generated, you must change them by connecting 
 to the database using 'sqlplus / as sysdba' as the oracle user.

oradata 이하의 파일 구성



기본적으로 다음과 같은 느낌
※ ORACLE_SID=ORCLCDB
/opt/oracle/oradata
|--ORCLCDB
|  |--control01.ctl
|  |--control02.ctl
|  |--ORCLPDB1
|  |  |--sysaux01.dbf
|  |  |--system01.dbf
|  |  |--temp01.dbf
|  |  |--undotbs01.dbf
|  |  |--users01.dbf
|  |--pdbseed
|  |  |--sysaux01.dbf
|  |  |--system01.dbf
|  |  |--temp012019-11-02_02-33-18-414-AM.dbf
|  |  |--undotbs01.dbf
|  |--redo01.log
|  |--redo02.log
|  |--redo03.log
|  |--sysaux01.dbf
|  |--system01.dbf
|  |--temp01.dbf
|  |--undotbs01.dbf
|  |--users01.dbf

포트 개방


# firewall-cmd --permanent --add-port=1521/tcp
# firewall-cmd --permanent --add-port=5500/tcp
# firewall-cmd --reload

사용자 : oracle에서 DB를 사용하기위한 환경 설정



oracle 사용자로 전환
# su - oracle

~/.bash_profile에 환경 변수를 추가하고 $ORACLE_HOME/bin에 대한 경로도 통과
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

※ ORACLE_SID, ORACLE_HOME은 configure 실행시와 동일한 설정
(먼저 여기를 설정하고 나서 sudo로 configure해도 좋을지도)

쉘에 설정 반영


$ source ~/.bash_profile

SQLcl로 연결



sqlplus라도 좋지만, 출력 성형이 편하고 보기 쉽기 때문에 SQLcl을 사용
$ sql / as sysdba

확인
# 出力を整形して見やすく設定
SQL> set sqlformat ansiconsole

# コンテナ内を確認
SQL> SELECT NAME, CON_ID, DBID, CON_UID, GUID FROM V$CONTAINERS ORDER BY CON_ID;
NAME         CON_ID         DBID      CON_UID GUID
CDB$ROOT          1   2794305375            1 86B637B62FDF7A65E053F706E80A27CA
PDB$SEED          2   1304945324   1304945324 964D5C96F6B71383E055000000000001
ORCLPDB1          3   3849451649   3849451649 964D860AFD092C9CE055000000000001

# PDBステータスを確認
SQL> SELECT PDB_ID, PDB_NAME, STATUS FROM DBA_PDBS ORDER BY PDB_ID;
  PDB_ID PDB_NAME   STATUS
       2 PDB$SEED   NORMAL
       3 ORCLPDB1   NORMAL

# PDBのOPEN_MODEを確認
SQL> SELECT NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;
NAME       OPEN_MODE    RESTRICTED   OPEN_TIME
PDB$SEED   READ ONLY    NO           02-NOV-19 02.44.48.418000000 AM +09:00
ORCLPDB1   READ WRITE   NO           02-NOV-19 02.45.10.232000000 AM +09:00

sys, system 암호 설정


SQL> alter user sys identified by sys_passwd;
SQL> alter user system identified by system_passwd;

※기본적으로 change_on_install, manager등의 패스워드로는 로그인할 수 없게 되어 있다

연결 대상 DB 변경



현재 연결 대상 확인
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

↑ CDB에 연결됨

연결 대상을 ORCLPDB1로 변경


SQL> alter session set container = ORCLPDB1;

TableSpace 만들기


CREATE TABLESPACE tbs_01
  DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/tbs_01.dbf' SIZE 10M 
  AUTOEXTEND ON NEXT 500K MAXSIZE 100M
  /

CREATE TEMPORARY TABLESPACE tbs_temp_01
  TEMPFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/tbs_temp_01.dbf'
  SIZE 5M AUTOEXTEND ON TABLESPACE GROUP tbs_grp01
  /

사용자 만들기


SQL> CREATE USER user01 IDENTIFIED BY passwd01
  DEFAULT TABLESPACE tbs_01
  TEMPORARY TABLESPACE tbs_temp_01
  /

SQL> GRANT CONNECT TO user01;
SQL> GRANT RESOURCE TO user01;

PDB (ORCLPDB1)에 연결해보십시오.



구문 : sql [user]/[password]@//[host]:[port]/[接続先DB];
$ sql user01/passwd01@//localhost:1521/ORCLPDB1

클라이언트 PC에서 SQL Developer로 연결



사용자 (user01)의 연결 설정



※user01은 orclpdb1에 작성했으므로, orclpdb1을 서비스명으로 지정한다


sys에서 CDB에 대한 연결 설정



※ CDB의 서비스명은 ORCLCDB를 지정


서비스명은 lsnrctl에서 확인 가능


$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 02-NOV-2019 19:32:52

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                02-NOV-2019 02:23:37
Uptime                    0 days 17 hr. 9 min. 16 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))
    (Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "964d860afd092c9ce055000000000001" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "orclpdb1" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
The command completed successfully

Enterprise Manager Express에 연결



참고 : 3.4.3 Starting EM Express for a PDB

대상을 CDB $ ROOT로 변경하고 CDB의 글로벌 포트를 활성화합니다.
SQL> alter session set container=CDB$ROOT;
SQL> exec dbms_xdb_config.setglobalportenabled(TRUE);

브라우저에서 Enterprise Manager Express URL에 액세스
https://192.168.137.71:5500/em

sys에서 PDB (orclpdb1)로 로그인






사용한 값




품목



검증 DB 서버 IP
192.168.137.71

연결 포트
1521년

EM용 포트
5500

ORACLE_SID
ORCLCDB

ORACLE_BASE
/opt/oracle

ORACLE_HOME
$ORACLE_BASE/product/19c/dbhome_1

user01
passwd01

sys
sys_passwd

시스템
system_passwd

좋은 웹페이지 즐겨찾기