设为首页 收藏本站
查看: 873|回复: 0

[经验分享] CentOS 7 安装 oracle 12c

[复制链接]

尚未签到

发表于 2018-4-21 12:02:04 | 显示全部楼层 |阅读模式
[1]


  先决环境Install Desktop Environment, refer to here.
[2]Install required packages.
[root@dlp ~]#  yum-y install binutils compat-libcap1 gcc gcc-c++ glibc glibc.i686
glibc-devel glibc.i686 ksh libaio libaio.i686 libaio-devellibaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++l7.i686
libstdc++-devel libstdc++-devel.i686 compat-libstdc++-33
compat-libstdc++-33.i686 libXi libXi.i686 libXtst libXtst.i686 make
sysstat
[3]Edit Kernel parameters.
[root@dlp ~]#

  MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')
  
[root@dlp ~]#
  SHMMAX=$(expr $MEMTOTAL / 2)
  
[root@dlp ~]#
  SHMMNI=4096
  
[root@dlp ~]#
  PAGESIZE=$(getconf PAGE_SIZE)
[root@dlp ~]#

  cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = $SHMMAX
kernel.shmall = `expr [size=132%]$SHMMAX/$PAGESIZE \* [size=132%]$SHMMNI/16`
kernel.shmmni = $SHMMNI
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
[root@dlp ~]#  sysctl -p

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 6274715648
kernel.shmall = 392169728
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
[4]Create user and groups for Oracle Database service.
[root@dlp ~]#  i=54321; for group in oinstall dba backupdba oper dgdba kmdba; do
groupadd -g $i $group; i=`expr $i + 1`
done

[root@dlp ~]#  useradd -u 1200 -g oinstall -G dba,oper,backupdba,dgdba,kmdba -d /home/oracle oracle

[root@dlp ~]#  passwd oracle

Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@dlp ~]#  mkdir -p /u01/app/oracle

[root@dlp ~]#  chown -R oracle:oinstall /u01/app

[root@dlp ~]#  chmod -R 775 /u01

[root@dlp ~]#

  vi /etc/pam.d/login
  # near line 14: add

session    required     pam_selinux.so open
session    required     pam_namespace.sosession    required     pam_limits.sosession    optional     pam_keyinit.so force revoke
session    include      system-auth
-session   optional     pam_ck_connector.so
[root@dlp ~]#

  vi /etc/security/limits.conf
  # add to the end

oracle  soft  nproc   2047
oracle  hard  nproc   16384
oracle  soft  nofile  1024
oracle  hard  nofile  65536
oracle  soft  stack   10240
oracle  hard  stack   32768
[5]图形化安装Oracle 12C Login with the user "oracle" and set environment variables.
  dlp login:
  oracle
  Password:

[oracle@dlp ~]$

  vi ~/.bash_profile
  # add to the end
  

  umask 022
export ORACLE_BASE=/u01/app/oracle
  # create a temporary directory for installation
  
[oracle@dlp ~]$
  mkdir tmp
  

[1]Login and work with oracle admin user which you create in pre-requirements settings.
DSC0000.png
[2]  Download Oracle Databse 12c for Linux and upload on your server.
http://www.oracle.com/technology/software/products/database/index.html
[3]After uploading Oracle files, move to a tmp directory and run an Installer like follows.
[oracle@dlp ~]$  cd tmp

[oracle@dlp tmp]$  unzip linuxamd64_12102_database_1of2.zip

[oracle@dlp tmp]$  unzip linuxamd64_12102_database_2of2.zip

[oracle@dlp tmp]$  ./database/runInstaller
[4]Oracle Installer starts like follows. First, Set your email address
and password for receiving some infomation from Oracle like security
issues and so on.
DSC0001.png
[5]On this example, Select "Install database software only".
DSC0002.png
[6]On this example, Select "Single Instance Database ***".
DSC0003.png
[7]Select your language.
DSC0004.png
[8]Select which edition you install.
DSC0005.png
[9]Specify the base directory and files for Oracle. On this example, keep default and proceed to next.
DSC0006.png
[10]Specify the installed directory. On this example, keep default and proceed to next.
DSC0007.png
[11]Specify the priviledged group. On this example, keep default and proceed to next.
DSC0008.png
[12]Pre-requirements are checked. If some settings are not configured
for recomendations, notification is displayed like follows.Confirm them
again.
DSC0009.png
[13]The summary is shown for configuration. Click "Install" if it's OK all.
DSC00010.png
[14]Installation starts.
DSC00011.png
[15]Following screen is shown, then open a terminal and execute follwong commands with the root user.
DSC00012.png
[root@dlp ~]#  /u01/app/oraInventory/orainstRoot.sh

Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@dlp ~]#[root@dlp ~]#  /u01/app/oracle/product/12.1.0/dbhome_1/root.sh

Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.1.0/dbhome_1Enter the full pathname of the local bin directory: [/usr/local/bin]:  # Enter

   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[16]Installation completed. Click "Close" button.
DSC00013.png
[17]Set Environment variables for Oracle user.
[oracle@dlp ~]$

  vi ~/.bash_profile
  # add to the end
  

  export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@dlp ~]$

  source ~/.bash_profile
  
[oracle@dlp ~]$
  rm -rf tmp
  


  创建监听Create Oracle Net Listener that is the network service on Oracle.
[1]Login with the oracle admin user and input a command "netca" like follows.
[oracle@dlp ~]$ netca
  

[2]Check a box "Listener Configuration" and go next.
DSC00014.png
[3]Go next.
DSC00015.png
[4]Set Listner's name. Input any one you like.
DSC00016.png
[5]This example goes next with keeping default "TCP".
DSC00017.png
[6]Set a port. This example goes next with keeping default.
DSC00018.png
[7]If you'd like to create more Listeners, Answer "Yes". This example selects "No".
DSC00019.png
[8]Configuration completed.
DSC00020.png
[9]After creating Listener, tnslsnr listens on the port you configured like follows.
[oracle@dlp ~]$

  ss -napt
  

State      Recv-Q Send-Q          Local Address:Port       Peer Address:Port
LISTEN     0      128                         *:22                    *:*
LISTEN     0      128                 127.0.0.1:631                   *:*
LISTEN     0      100                 127.0.0.1:25                    *:*
ESTAB      0      52                  10.0.0.30:22             10.0.0.5:50113
LISTEN     0      128                        :::1521                 :::*      users:(("tnslsnr",3988,9))
LISTEN     0      128                        :::22                   :::*
LISTEN     0      128                       ::1:631                  :::*
LISTEN     0      100                       ::1:25                   :::*
[oracle@dlp ~]$

  tnsping localhost
  

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 04-JUL-2015 01:03:07
Copyright (c) 1997, 2014, Oracle.  All rights reserved.
Used parameter files:
Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)
(PORT=1521)))
OK (0 msec)

  创建数据库 Create a Database.
[1]Login with the oracle admin user and input a command "dbca" like follows.
[oracle@dlp ~]$ dbc
  

[2]Select "Create Database" and go next.
DSC00021.png
[3]On this example, select "Advanced Mode" and go next.
DSC00022.png
[4]This example selects "General Purpose ***" and go next.
DSC00023.png
[5]Set Grobal Database name and SID like follows. Input any one you like.
DSC00024.png
[6]This example goes next with keeping default.
DSC00025.png
[7]Set passwords. Please set a password for a user for security.
DSC00026.png
[8]Configure Listener. On this example, keep default and go next.
DSC00027.png
[9]Configure Storage settings. On this example, keep default and go next.
DSC00028.png
[10]Configure sample schema and scripts. If you'd like to add them, Set them.
DSC00029.png
[11]Configure memory settings. After setting, go to next tab.
DSC00030.png
[12]Specify max processes.
DSC00031.png
[13]Set Character setting.
DSC00032.png
[14]Select a connection mode. If your server does not have many clients,Select Dedicated server mode. If your server has many clients, Select
Shared server mode.
DSC00033.png
[15]Go next.
DSC00034.png
[16]Configuration completed. Click "Finish" button to finish.
DSC00035.png
[17]Database creation starts.
DSC00036.png
[18]After completing to create a database, Click "Close" to finish.
DSC00037.png
[19]Add Database SID to the environment variables.
[oracle@dlp ~]$

  vi /etc/oratab
  # change like follows
  
dlp:/u01/app/oracle/product/12.1.0/dbhome_1:
  Y
[oracle@dlp ~]$

  vi ~/.bash_profile
  # add to the end
  

  export ORACLE_SID=dlp

  To access to the Enterprise Manager, it's possible to manage Database on Web GUI.
[1]After creating database, database service is running and it's possible to access to Enterprise Manager, too. Access to the URL which was displayedwhen database creation finished, then Login form is shown and it's possible to login with a database user.
DSC00038.png
[2]Just logined. It's possible to manage Database on here.
DSC00039.png

  


  Create Systemd file for Oracle Database services.
[1]Login as root user and create Systemd files.
[root@dlp ~]#

  vi /etc/sysconfig/dlp.oracledb
  # create new : define environment variables
  
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
ORACLE_SID=dlp
  # configure listener service
  
[root@dlp ~]#
  vi /usr/lib/systemd/system/dlp@lsnrctl.service
  # this is an example, modify for free
  

[Unit]
Description=oracle net listener
After=network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/dlp.oracledb
ExecStart=/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start
ExecStop=/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl stop
User=oracle
[Install]
WantedBy=multi-user.target  # configure database service
  
[root@dlp ~]#
  vi /usr/lib/systemd/system/dlp@oracledb.service
  # this is an example, modify for free
  

[Unit]
Description=oracle net listener
After=network.target lsnrctl.service
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/dlp.oracledb
ExecStart=/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.1.0/dbhome_1
ExecStop=/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbshut /u01/app/oracle/product/12.1.0/dbhome_1
User=oracle
[Install]
WantedBy=multi-user.target
[root@dlp ~]#

  systemctl daemon-reload
  
[root@dlp ~]#
  systemctl enable dlp@lsnrctl dlp@oracledb
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-450016-1-1.html 上篇帖子: centos7.2下源码部署lnmp 下篇帖子: Centos7 安装 PHP7最新版
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表