Oracle 12c 설치
Oracle 12c 설치
Silent Installation 방식이며 OFA(Optimal Flexible Architecture) 를 따른다.
환경
- CentOS 7 64bit
- Memory 8GB
- Swap 16GB (Swap must be enabled double the size of RAM)
- Storage Size 40GB
호스트네임 변경
1 2 3 4 |
hostnamectl set-hostname oraserv1 hostnamectl set-hostname oraserv1 --static hostnamectl set-hostname "Server1 of Oracle Database" --pretty hostnamectl set-hostname oraserv1 --transient |
계정생성
1 2 3 4 5 6 7 8 9 10 11 |
groupadd -g 500 oinstall groupadd -g 501 dba groupadd -g 502 oper groupadd -g 503 backupdba groupadd -g 504 dgdba groupadd -g 505 kmdba groupadd -g 506 asmdba groupadd -g 507 asmoper groupadd -g 508 asmadmin useradd -u 500 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle |
의존성 패키지 설치
1 |
yum install compat-libcap1-1.10 compat-libstdc++-* libstdc++-devel-* sysstat-10.1.5* gcc-4.* gcc-c++-4.* ksh* glibc-devel-* libaio-* libaio-devel-* |
OFA 디렉토리 생성
1 2 3 |
mkdir -p /u01/app/oracle/product/12.1.0.2/db_1 mkdir -p /u01/app/oraInventory chown oracle:oinstall -R /u01 |
sysctl.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
fs.aio-max-nr = 1048576 # It is recommended to have a minimum of 256 as value for every 4MB of RAM you have. # So for 8GB RAM = 2048 * 4MB = 2048 * 256 = 524288 fs.file-max = 6815744 # It sets the maximum number of shared memory segments that server can handle. # As Oracle recommends the value should be at least 4096, # it says that we cannot find more than 4096 number of shared memory segments at any instance on the server. # Note that SHMMNI value is in numbers. # # No change it should be 4096. It must be increased if you have more than at least one fourth (1024) Oracle Databases running on the server. Which we never recommend. kernel.shmmni = 4096 # It defines the total amount of shared memory PAGES that can be used system-wide. # It means that to the use all the physical memory this value should be less than or equal to total physical memory size. # For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. # Note that SHMALL value is a number of pages. # # If you want the maximum size of SGA on this server to be 5GB, then this parameter value should be 5*1024*1024*1024 = 5368709120 bytes. This, in turn, says that you should not have any database with more than 5GB of SGA. But you can have multiple databases with each 5GB of SGA or even less. This is the fact why Oracle recommends to have this value more than half of the memory to utilize it for SGA(s). # # By chance, if your SGA size is more than 5GB say it is 7GB then 2 shared memory areas will be allocated to SGA with one of 5GB and two of 2GB sizes, which doesn's perform well. kernel.shmmax = 4294967296 # It defines the total amount of shared memory PAGES that can be used system-wide. It means that to the use all the physical memory this value should be less than or equal to total physical memory size. For DBA's, it means that sum of all SGA sizes on the server should be less than or equal to SHMALL value. Note that SHMALL value is a number of pages. # By default the page size on Linux is 4KB. The total size of RAM is 8GB. Let us leave at least 1GB of RAM for Linux kernel to run, with which consider 7GB can be used for Oracle Databases. Now value of SHMALL can be: # # (7*1024*1024)KB/4KB = 1835008 kernel.shmall = 1835008 kernel.sem = 250 32000 100 128 # This parameter defines the range of port numbers that system can use for programs which want to connect to the server without a specific port number. # # Now, it makes sense if you have come across somebody advising you not to use port numbers for listener beyond 9000. Also, just look back to documents on OEM installation, Oracle uses and advises all the default port numbers less than 9000. net.ipv4.ip_local_port_range = 9000 65500 # This parameter defines the default and maximum RECEIVE socket memory through TCP. net.core.rmem_default = 262144 net.core.rmem_max = 4194304 # This parameter defines the default and maximum SEND socket memory through TCP. net.core.wmem_default = 262144 net.core.wmem_max = 1048586 |
/etc/security/limits.conf
1 2 3 4 5 6 7 |
# http://www.tecmint.com/setting-up-prerequisites-for-oracle-12c-installation/ oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768 |
/etc/security/limits.d/20-nproc.conf
1 2 |
* - nproc 16384 root soft nproc unlimited |
/etc/oraInst.loc
1 2 3 4 5 6 |
]# vim /etc/oraInst.loc inventory_loc=/u01/app/oraInventory inst_group=oinstall ]# chown oracle:oinstall /etc/oraInst.loc ]# chmod 664 /etc/oraInst.loc |
oracle 계정으로 로그인 한후에 Oracle 12c 바이너리 설치 파일을 다음과 같이 압축 해제.
1 2 3 4 5 |
]$ mkdir -p orainst/12.1.0.2 ]$ cp *.zip orainst/12.1.0.2/ ]$ cd orainst/12.1.0.2 ]$ unzip linuxamd64_12102_database_1of2.zip ]$ unzip linuxamd64_12102_database_2of2.zip |
Silent 설치를 위한 파일 작성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$ cd orainst/12.1.0.2/database $ cp response/db_install.rsp inst.rsp $ vim inst.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=oraserv1 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.BACKUPDBA_GROUP=backupdba oracle.install.db.DGDBA_GROUP=dgdba oracle.install.db.KMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=dba DECLINE_SECURITY_UPDATES=true |
Silent 설치 파일 설행.
1 2 3 4 5 6 7 8 9 10 11 12 |
[oracle@oraserv1 database]$ ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/orainst/12.1.0.2/database/inst.rsp [oracle@oraserv1 database]$ Oracle Database 12c의 설치을(를) 성공했습니다. 자세한 내용은 '/u01/app/oraInventory/logs/silentInstall2017-02-14_11-04-17PM.log'을(를) 확인하십시오. 루트 사용자로 다음 스크립트를 실행합니다. 1. /u01/app/oracle/product/12.1.0.2/db_1/root.sh Successfully Setup Software. [oracle@oraserv1 database]$ |
설치 시간은 시스템에 따라 다르지만 설치하는 동안에 java 프로세스가 동작한다. 그리고 설치가 성공하면 위와같이 메시지가 나온다.
oracle bashrc 설정.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1 export ORACLE_BASE=/u01/app/oracle export TNS_ADMIN=$ORACLE_HOME/network/admin export ADR_BASE=$ORACLE_BASE/diag export ORACLE_SID=o12c export LD_LIBRARY_PATH=/usr/lib64:$ORACLE_HOME/lib export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export PATH=$ORACLE_HOME/bin:$PATH export PS1='[\h:\u:\W:${ORACLE_SID}]$ ' alias cdob='cd $ORACLE_BASE' alias cdoh='cd $ORACLE_HOME' alias tns='cd $ORACLE_HOME/network/admin' alias envo='env | grep ORACLE' umask 022 envo |
Create Database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#]$ cd $ORACLE_HOME/dbs #]$ cp init.org inito12c.ora db_name='o12c' memory_target=1G memory_max_target=1G processes = 200 audit_file_dest='/u01/app/oracle/admin/orcl/adump' audit_trail ='db' db_block_size=8192 db_domain='' db_recovery_file_dest='/u01/app/oracle/fast_recovery_area' db_recovery_file_dest_size=2G diagnostic_dest='/u01/app/oracle' dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)' open_cursors=499 remote_login_passwordfile='EXCLUSIVE' undo_management='AUTO' undo_tablespace='UNDOTBS1' # You may want to ensure that control files are created on separate physical # devices control_files = (/u01/dbfile/o12c/control01.ctl, /u02/dbfile/o12c/control02.ctl) job_queue_processes=10 fast_start_mttr_target=500 compatible ='11.2.0' |
inito12c.ora 를 위와 같이 작성하고 다음과 같이 디렉토리를 작성한다.
1 2 3 4 5 6 7 8 |
$ mkdir -p /u01/app/oracle/admin/orcl/adump $ mkdir -p /u01/app/oracle/fast_recovery_area $ mkdir -p /u01/dbfile/o12c $ mkdir -p /u02/dbfile/o12c $ mkdir -p /u01/oraredo/o12c $ mkdir -p /u02/oraredo/o12c # chown -R oracle:dba /u01 # chown -R oracle:dba /u02 |
다음과 같은 내용으로 credb.sql 파일로 작성한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
CREATE DATABASE o12c MAXLOGFILES 16 MAXLOGMEMBERS 4 MAXDATAFILES 1024 MAXINSTANCES 1 MAXLOGHISTORY 680 CHARACTER SET AL32UTF8 DATAFILE '/u01/dbfile/o12c/system01.dbf' SIZE 500M REUSE EXTENT MANAGEMENT LOCAL UNDO TABLESPACE undotbs1 DATAFILE '/u01/dbfile/o12c/undotbs01.dbf' SIZE 800M SYSAUX DATAFILE '/u01/dbfile/o12c/sysaux01.dbf' SIZE 500M DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/dbfile/o12c/temp01.dbf' SIZE 500M DEFAULT TABLESPACE USERS DATAFILE '/u01/dbfile/o12c/users01.dbf' SIZE 20M LOGFILE GROUP 1 ('/u01/oraredo/o12c/redo01a.rdo', '/u02/oraredo/o12c/redo01b.rdo') SIZE 50M, GROUP 2 ('/u01/oraredo/o12c/redo02a.rdo', '/u02/oraredo/o12c/redo02b.rdo') SIZE 50M, GROUP 3 ('/u01/oraredo/o12c/redo03a.rdo', '/u02/oraredo/o12c/redo03b.rdo') SIZE 50M USER sys IDENTIFIED BY foo USER system IDENTIFIED BY foo; |
oracle 을 nomount 로 시작시킨다. 그리고 위 credb.sql 를 실행한다.
1 2 3 4 |
$ sqlplus / as sysdba SQL> startup nomount; SQL> @credb.sql Database created. |
Create a Data Dictionary
1 2 3 4 5 6 7 8 |
SQL> show user USER is "SYS" SQL> @?/rdbms/admin/catalog.sql SQL> @?/rdbms/admin/catproc.sql SQL> connect system/foo SQL> @?/sqlplus/admin/pupbld |
Configure Listener
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
]$ vim $ORACLE_HOME/network/admin/listener.ora LISTENER = (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=oraserv1)(PORT=1521))) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=o12c) (SID_NAME=o12c) (ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1) ) ) |
외부인증을 위한 패스워드 파일을 생성한다. 이것을 생성하지 않으면 외부로부터 접속을 할때에 인증정보가 아무리 맞아도 ora-01017 메시지를 내보낸다. 다음과 같이 패스워드 파일을 생성해 준다.
1 |
orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=패스워드 entries=20 |
listener 를 시작.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[oracle@oraserv1 admin]$ lsnrctl start LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 17-FEB-2017 21:14:07 Copyright (c) 1991, 2014, Oracle. All rights reserved. Starting /u01/app/oracle/product/12.1.0.2/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 12.1.0.2.0 - Production System parameter file is /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/oraserv1/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraserv1)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production Start Date 17-FEB-2017 21:14:07 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/oraserv1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraserv1)(PORT=1521))) The listener supports no services The command completed successfully |
EM Database Express 12c 활성화.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
SQL> select dbms_xdb_config.gethttpport() from dual; DBMS_XDB_CONFIG.GETHTTPPORT() ---------------------- 0 SQL> exec dbms_xdb_config.sethttpport(8080); PL/SQL procedure successfully completed. SQL> select dbms_xdb.gethttpport() from dual; DBMS_XDB.GETHTTPPORT() ---------------------- 8080 |
lsnrctl status 에서 8080 포트가 보이면 정상. http://ip:8080/em 으로 접속해서 로그인 화면 나오면 정상입니다.