Oracle 11gR2 설치
Oracle 11gR2 설치
Silent Installation 방식이며 OFA(Optimal Flexible Architecture) 를 따른다.
환경
- CentOS 6.8 64bit
- Memory 4GB
- Swap 8GB (Swap must be enabled double the size of RAM)
- Storage Size 50GB
호스트네임 변경
1 2 3 4 5 |
]# vi /etc/sysconfig/network HOSTNAME=oraserv1.systemv.pe.kr ]# vi /etc/hosts 192.168.96.42 oraserv1.systemv.pe.kr oraserv1 ]# /etc/init.d/network restart |
Selinux 설정 변경
1 2 |
]# vi /etc/selinux/config SELINUX=disable |
Kernel 3.10 설치
1 2 3 4 5 |
]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ]# rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm ]# sed -i "s/enabled=1/enabled=0/g" /etc/yum.repos.d/elrepo.repo ]# yum --enablerepo=elrepo-kernel install kernel-lt ]# sed -i "s/default=1/default=0/g" /boot/grub/grub.conf |
설치 완료하고 나서 reboot.
계정생성
1 2 3 4 5 |
groupadd -g 500 oinstall groupadd -g 501 dba groupadd -g 502 oper useradd -u 500 -g oinstall -G dba,oper oracle |
의존성 패키지 설치
1 2 3 4 |
]# yum install compat-libstdc++-33.x86_64 elfutils-libelf-devel.x86_64 elfutils-libelf-devel-static.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc-devel.x86_64 ksh.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgomp.x86_64 libstdc++-devel.x86_64 sysstat.x86_64 unzip unixODBC.i686 unixODBC-devel.i686 unixODBC.x86_64 unixODBC-devel.x86_64 ]# yum remove ksh ]# wget ftp://ftp.pbone.net/mirror/www.whiteboxlinux.org/whitebox/4/en/os/x86_64/WhiteBox/RPMS/pdksh-5.2.14-30.x86_64.rpm ]# yum localinstall pdksh-5.2.14-30.x86_64.rpm |
OFA 디렉토리 생성
1 2 3 |
mkdir -p /u01/app/oracle/product/11.2.0/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 = 2147483648 # 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 = 95325 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/90-nproc.conf
1 2 |
* - nproc 16384 root soft nproc unlimited |
/etc/pam.d/login
1 |
session required pam_limits.so |
/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 11gR2 바이너리 설치 파일을 다음과 같이 압축 해제.
1 2 3 4 5 |
]$ mkdir -p orainst/11.2.0 ]$ cp *.zip orainst/11.2.0/ ]$ cd orainst/11.2.0 ]$ unzip linux.x64_11gR2_database_1of2.zip ]$ unzip linux.x64_11gR2_database_2of2.zip |
Silent 설치를 위한 파일 작성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ cd orainst/11.2.0/database $ cp response/db_install.rsp inst.rsp $ vim inst.rsp oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11.2.0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=oraserv1 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/home/oracle/orainst/11.2.0/database/stage/products.xml SELECTED_LANGUAGES=en ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper 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/11.2.0/database/inst.rsp [oracle@oraserv1 database]$ Oracle Database 11g의 설치을(를) 성공했습니다. 자세한 내용은 '/u01/app/oraInventory/logs/silentInstall2017-02-14_11-04-17PM.log'을(를) 확인하십시오. 루트 사용자로 다음 스크립트를 실행합니다. 1. /u01/app/oracle/product/11.2.0/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/11.2.0/db_1 export ORACLE_BASE=/u01/app/oracle export TNS_ADMIN=$ORACLE_HOME/network/admin export ADR_BASE=$ORACLE_BASE/diag export ORACLE_SID=O11R2 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 inito11c.ora db_name='O11R2' 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/flash_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/O11R2/control01.ctl, /u02/dbfile/O11R2/control02.ctl) job_queue_processes=10 fast_start_mttr_target=500 compatible ='11.2.0' |
inito11c.ora 를 위와 같이 작성하고 다음과 같이 디렉토리를 작성한다.
1 2 3 4 5 6 7 8 |
$ mkdir -p /u01/app/oracle/admin/orcl/adump $ mkdir -p /u01/app/oracle/flash_recovery_area $ mkdir -p /u01/dbfile/O11R2 # mkdir -p /u02/dbfile/O11R2 $ mkdir -p /u01/oraredo/O11R2 # mkdir -p /u02/oraredo/O11R2 # chown -R oracle:dba /u01 # chown -R oracle:dba /u02 |
oracle 사용자의 기본 그룹을 dba 로 변경합니다.
1 |
]# usermode -g dba oracle |
다음과 같은 내용으로 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 O11R2 MAXLOGFILES 16 MAXLOGMEMBERS 4 MAXDATAFILES 1024 MAXINSTANCES 1 MAXLOGHISTORY 680 character set "UTF8" DATAFILE '/u01/dbfile/O11R2/system01.dbf' SIZE 500M REUSE EXTENT MANAGEMENT LOCAL UNDO TABLESPACE undotbs1 DATAFILE '/u01/dbfile/O11R2/undotbs01.dbf' SIZE 800M SYSAUX DATAFILE '/u01/dbfile/O11R2/sysaux01.dbf' SIZE 500M DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/dbfile/O11R2/temp01.dbf' SIZE 500M DEFAULT TABLESPACE USERS DATAFILE '/u01/dbfile/O11R2/users01.dbf' SIZE 20M LOGFILE GROUP 1 ('/u01/oraredo/O11R2/redo01a.rdo', '/u02/oraredo/O11R2/redo01b.rdo') SIZE 50M, GROUP 2 ('/u01/oraredo/O11R2/redo02a.rdo', '/u02/oraredo/O11R2/redo02b.rdo') SIZE 50M, GROUP 3 ('/u01/oraredo/O11R2/redo03a.rdo', '/u02/oraredo/O11R2/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=O11R2) (SID_NAME=O11R2) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1) ) ) |
그리고 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 11.2.0.1.0 - Production on 24-FEB-2017 01:22:08 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/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.systemv.pe.kr)(PORT=1521))) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 24-FEB-2017 01:22:11 Uptime 0 days 0 hr. 0 min. 7 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/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.systemv.pe.kr)(PORT=1521))) The listener supports no services The command completed successfully |
SYS 패스워드 파일 생성.
1 2 |
]$ cd $ORACLE_HOME/dbs ]$ orapwd file=orapwO11R2 password=foo |
EM 수동 구성
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 |
]$ emca -config dbcontrol db -repos create STARTED EMCA at Feb 26, 2017 2:21:17 AM EM Configuration Assistant, Version 11.2.0.0.2 Production Copyright (c) 2003, 2005, Oracle. All rights reserved. Enter the following information: Database SID: O11R2 Listener port number: 1521 Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0/db_1 ]: Password for SYS user: Password for DBSNMP user: Password for SYSMAN user: Email address for notifications (optional): Outgoing Mail (SMTP) server for notifications (optional): ----------------------------------------------------------------- You have specified the following settings Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1 Local hostname ................ oraserv1.systemv.pe.kr Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/db_1 Listener port number ................ 1521 Database SID ................ O11R2 Email address for notifications ............... Outgoing Mail (SMTP) server for notifications ............... ----------------------------------------------------------------- Do you wish to continue? [yes(Y)/no(N)]: Y |
EM 시작/중지
시작과 중지는 다음과 같이 합니다.
1 2 3 |
emctl start dbconsole emctl stop dbconsole emctl status dbconsole |