Centos 7 Oracle 12C 超详细安装
时间:2022-03-05 18:19
[1] |
.
|
[2] | Install required packages. |
[root@dlp ~]#
-y install binutils compat-libcap1 gcc gcc-c++ glibc glibc.i686 glibc-devel glibc.i686 ksh libaio libaio.i686 libaio-devel
libaio-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 ~]#
[root@dlp ~]#
>> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmax = $SHMMAX kernel.shmall = `expr \( $SHMMAX / $PAGESIZE \) \* \( $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 -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
[root@dlp ~]#
groupadd -g $i $group; i=`expr $i + 1` done -u 1200 -g oinstall -G dba,oper,backupdba,dgdba,kmdba -d /home/oracle oracle
[root@dlp ~]# oracle
Changing password for user oracle. New password: Retype new password: passwd: all authentication tokens updated successfully. [root@dlp ~]# -p /u01/app/oracle
[root@dlp ~]# -R oracle:oinstall /u01/app
[root@dlp ~]# -R 775 /u01
[root@dlp ~]#
/etc/pam.d/login
# near line 14: add
|
dlp login:
Password:oracle
[oracle@dlp ~]$
~/.bash_profile
# add to the end
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE=/u01/app/oracle
# create a temporary directory for installation
[oracle@dlp ~]$
tmp
[1] | . |
[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 ~]$
tmp
[oracle@dlp tmp]$ linuxamd64_12102_database_1of2.zip
[oracle@dlp tmp]$ 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. |
[5] | On this example, Select "Install database software only". |
[6] | On this example, Select "Single Instance Database ***". |
[7] | Select your language. |
[8] | Select which edition you install. |
[9] | Specify the base directory and files for Oracle. On this example, keep default and proceed to next. |
[10] | Specify the installed directory. On this example, keep default and proceed to next. |
[11] | Specify the priviledged group. On this example, keep default and proceed to next. |
[12] | Pre-requirements are checked. If some settings are not configured for recomendations, notification is displayed like follows.Confirm them again. |
[13] | The summary is shown for configuration. Click "Install" if it‘s OK all. |
[14] | Installation starts. |
[15] | Following screen is shown, then open a terminal and execute follwong commands with the root user. |
[root@dlp ~]#
/u01/app/oraInventory/orainstRoot.sh
|
[17] | Set Environment variables for Oracle user. |
[oracle@dlp ~]$
~/.bash_profile
# add to the end
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export PATH=$PATH:$ORACLE_HOME/bin
source ~/.bash_profile
[oracle@dlp ~]$
-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. |
[3] | Go next. |
[4] | Set Listner‘s name. Input any one you like. |
[5] | This example goes next with keeping default "TCP". |
[6] | Set a port. This example goes next with keeping default. |
[7] | If you‘d like to create more Listeners, Answer "Yes". This example selects "No". |
[8] | Configuration completed. |
[9] | After creating Listener, tnslsnr listens on the port you configured like follows. |
-napt
创建数据库 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. |
[3] | On this example, select "Advanced Mode" and go next. |
[4] | This example selects "General Purpose ***" and go next. |
[5] | Set Grobal Database name and SID like follows. Input any one you like. |
[6] | This example goes next with keeping default. |
[7] | Set passwords. Please set a password for a user for security. |
[8] | Configure Listener. On this example, keep default and go next. |
[9] | Configure Storage settings. On this example, keep default and go next. |
[10] | Configure sample schema and scripts. If you‘d like to add them, Set them. |
[11] | Configure memory settings. After setting, go to next tab. |
[12] | Specify max processes. |
[13] | Set Character setting. |
[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. |
[15] | Go next. |
[16] | Configuration completed. Click "Finish" button to finish. |
[17] | Database creation starts. |
[18] | After completing to create a database, Click "Close" to finish. |
[19] | Add Database SID to the environment variables. |
[oracle@dlp ~]$
/etc/oratab
# change like follows
dlp:/u01/app/oracle/product/12.1.0/dbhome_1:
Y
[oracle@dlp ~]$
~/.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] | , database service is running and it‘s possible to access to Enterprise Manager, too. Access to the URL which was displayed when database creation finished, then Login form is shown and it‘s possible to login with a database user. |
[2] | Just logined. It‘s possible to manage Database on here. |
Create Systemd file for Oracle Database services.
[root@dlp ~]#
/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 ~]# /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 ~]# /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 daemon-reload
[root@dlp ~]# enable dlp@lsnrctl dlp@oracledb
|