Installing the Oracle database on a Linux system

Source: Internet
Author: User
Tags chmod dba gpg iptables sqlplus

Pre-Preparation: I use a CentOS 64-bit system on a virtual machine. So need to set up network card, time, Epel source, install some necessary software.

1.1 After installing the Linux system on the virtual machine, select virtual machine settings, network adapter, network connection, and so on bridge mode

1.2 then enter the system configuration Nic .

Permanent modification:

Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0 (device name)

Type=ethernet (Network type)

Onboot=yes (boot from boot)

bootproto=static (static IP) DHCP is dynamic IP none is not specified

ipaddr=192.168.1.21

netmask=255.255.255.0

gateway=192.168.1.1

network=192.168.1.0

dns1=192.168.1.1

Immediate effect:

Service Network restart

1.3 Turn off the firewall : When using a network program, you must turn off the firewall, or it will not connect

1) Permanent, no recovery after reboot
Open: Chkconfig iptables on
OFF: Chkconfig iptables off

2) immediate effect, recovery after restart
Open: Service iptables start
Close: Service iptables stop

If it's a firewall firewall

Stop: Systemctl Stop Firewalld.service

Disable boot: systemctl disable Firewalld.service

Start: Systemctl start Firewalld.service

Boot start: Systemctl enable Firewalld.service

1.4 Setting the system time

Set Hardware time manually

Hwclock--set--date= "05/1/2015 19:24"

Time format: Month/day/year space: minutes: seconds

---------------

Write hardware time to system time

Hwclock--hctosys

Clock--hctosys

1.5 Setting the Epel source

RPM-IVH https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

1.6 Installing the Unzip tool

Yum Install unzip

The official installation starts here

2.1 Installing Oracle-rdbms-server-11gr2-preinstall

Installing the Oracle database on Linux, in the environment preparation, such as the installation of RPM package, the tuning of the kernel parameters, and so on, not only more complex, some parameter values will also be due to the unreasonable manual settings for future operation has a certain impact, but also the entire installation process is the most time-consuming part. On the Oracle Linux 6_64bit, a Oracle-rdbms-server-11gr2-preinstall package is available that automates the processing of the RPM packages that need to be installed, the kernel parameters that need to be tuned, It does save a lot of time for the DBA to install the database. There is a similar feature on Oracle Linux 5 and Oracle Linux 4 called oracle-validated

The role he has played:

(1) Automatic installation of the RPM package required by Oracle

(2) Automatically create Oracle users and group groups

(3) automatic configuration of/etc/sysctl.conf kernel parameters

(4) automatic configuration/etc/security/limits.conf parameters

(5) Turn off Numa=off (turn off non-uniform memory access)

Pre-installation Check

A, check the network environment, to ensure that the network unblocked

Cat/etc/issue

b. Check if Yum is installed

Rpm-qa | grep Yum

C, install the Oracle-rdbms-server-11gr2-preinstall package follow the steps below step by step

Switch to directory/etc/yum.repos.d/

cd/etc/yum.repos.d/

wget Http://public-yum.oracle.com/public-yum-ol6.repo (Note: If wget is not installed, you need to perform Yum install wget first)

(vi Public-yum-ol6.repo) This can be manually added, or it can be a previously added epel source to see if the installation

cd/etc/pki/rpm-gpg/

wget Http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6-O rpm-gpg-key-oracle

GPG--quiet--with-fingerprint./rpm-gpg-key-oracle

Yum Install Oracle-rdbms-server-11gr2-preinstall

Verify

[Email protected] yum.repos.d]# cat/etc/passwd |grep Oracle

Oracle:x:54321:54321::/home/oracle:/bin/bash

[[email protected] yum.repos.d]# Cat/etc/group |grep dba

Dba:x:54322:oracle

[Email protected] yum.repos.d]#

2.2 Edit/etc/pam.d/login

Vi/etc/pam.d/login

Add the following line:

Session required/lib64/security/pam_limits.so

Session Required Pam_limits.so

2.3 Edit/etc/profile

Vi/etc/profile

Add the following line:

if [$USER = "Oracle"]; Then

if [$SHELL = "/bin/ksh"]; Then

Ulimit-p 16384

Ulimit-n 65536

Else

Ulimit-u 16384-n 65536

Fi

Fi

2.4 Pre-Create the installation directory

  

CD/

Create a oralce_base directory

Mkdir-p/u01/app/oracle

Create a Oracle_home directory

Mkdir-p/u01/app/oracle/product/11.2.0/db_1

Create an Oracle data file storage Directory

Mkdir-p/u01/app/oracle/product/11.2.0/oradata

Create the Oracle installation process log directory

Mkdir-p/u01/app/oracle/orainventory

2.5 Set the group and permissions that the owner of the directory belongs to

Set the app directory owner to be an Oracle user and the Oinstall group to which it belongs

Chown-r Oracle.oinstall/u01/app

Set the Orainventory directory owner to be an Oracle user and the group to which it belongs

Chown-r oracle.dba/u01/app/oracle/orainventory

Set the user who owns the app directory to have read, write, and execute permissions for the directory

Chmod-r 775/u01/app/

2.6 Upload the Oracle installation source file and unzip to the/u01/app/oracle directory

2.7 Creating Orainst.loc

Create a Orainst.loc file and add content

Vi/etc/orainst.loc

Inventory_loc=/u01/app/oracle/orainventory

Inst_group=oinstall

To set the ownership of ORAINST.LOC files by Oracle users and their Oinstall groups

Chown Oracle:oinstall/etc/orainst.loc

Set the user and group that the Orainst.loc file belongs to has read, write, and execute permissions for the directory

chmod 664/etc/orainst.loc

2.8 Setting environment variables for user Oracle

Log in to an Oracle user

Su-oracle

Editing environment variables for Oracle users

Vi/home/oracle/.bash_profile

Add the following in the file:

#. Bash_profile

# Get the aliases and functions

if [ - F ~/. BASHRC ]; Then

. ~/. Bashrc

Fi

# User specific environment and startup programs

PATH=$PATH:$HOME/Bin

# User Add

umask 022

Export SHELL=/bin/bash

Export Oracle_base=/u01/app/Oracle

Export Oracle_home=$ORACLE _base/product/one. 2. 0/db_1

Export Oracle_sid=ORCL

Export Oracle_unqname=$ORACLE _sid

Export Oracle_owner=Oracle

Export Oracle_term=vt100

Export PATH=$PATH:$ORACLE _home/bin:$HOME /Bin

Export Ld_library_path=$ORACLE _home/lib:/lib:/usr/lib:/ usr/local/Lib

CLASSPATH=$ORACLE _home/JRE:$ORACLE _home/Jlib : $ORACLE _home /RDBMS/Jlib

CLASSPATH=$CLASSPATH:$ORACLE _home/network/ Jlib

Export CLASSPATH

Export Ora_nls33=$ORACLE _home/nls/admin/data

# Setting up Chinese environment

# Export Nls_lang="Simplified Chinese_china. ZHS16GBK "

Export Nls_lang= "American_america. ZHS16GBK "

# through locale command to view the authenticity of your own host LANG situation, or Echo $LANG

# User End

Execute the following command to have the configuration take effect immediately or with the Oracle user login to make the settings effective

SOURCE $HOME/.bash_profile

2.9 Setting the size of the system scratch space

Note: The default is twice times the physical memory, and also to prevent errors in subsequent startup of the database times ORA-00845, the following is an example of an error:

Sql> startup;

Ora-00845:memory_target not supported on the This system

Adjust the size of the SHM, this is relatively simple, the specific operation is as follows

Vi/etc/fstab

Modify the settings for the following line

TMPFS/DEV/SHM TMPFS Defaults 0 0

Change into

Tmpfs/dev/shm tmpfs defaults,size=2g 0 0 (my memory for the virtual machine is 1G)

Save exit

Re-mount the SHM to make it effective

Mount-o REMOUNT/DEV/SHM

df-h | grep SHM

2.10 Preparing the Oracle11201 silent installation answer file

Access to Oracle's installation files database directory

./runinstaller-silent-debug-force \

ORACLE.INSTALL.RESPONSEFILEVERSION=/ORACLE/INSTALL/RSPFMT_DBINSTALL_RESPONSE_SCHEMA_V11_2_0 \

Oracle.install.option=install_db_swonly \

Unix_group_name=oinstall \

Inventory_location=/u01/app/oracle/orainventory \

Oracle_home=/u01/app/oracle/product/11.2.0/db_1 \

Oracle_base=/u01/app/oracle \

Oracle.install.db.installedition=ee \

Oracle.install.db.eeoptionsselection=false \

ORACLE.INSTALL.DB.DBA_GROUP=DBA \

Oracle.install.db.oper_group=install \

Decline_security_updates=true

Do not move after the execution, to follow the prompts to view the log, directly see the next step to copy an SSH window to operate

2.11 View the installation log based on the above tips

tail-100f/u01/app/oracle/orainventory/logs/installactions2014 ...

Check that the logs are installed successfully and that all files must be removed for reinstallation if the installation fails.

Post-perfection: Configuring Oracle with operating system boot-related

3.1 Configuring the Dbstart and Dbshut commands

1. After installing the Oracle database: Execute Dbstart and Dbshut will prompt:

[Email protected] ~]$ Dbstart

Oracle_home_listner is isn't SET, unable to auto-start Oracle Net Listener

Usage:/u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart oracle_home

The reason for the error is that there is a problem with Oracle_home_listner settings in the Dbstart and Dbshut script files

Edit two files separately (Dbstart and Dbshut)

Found: oracle_home_listner=$1, modified to

Oracle_home_listner= $ORACLE _home, the command is as follows:

[Email protected] ~]$ VI $ORACLE _home/bin/dbstart

[Email protected] ~]$ VI $ORACLE _home/bin/dbshut

Tips:

Dbstart oracle_home_listner=$1 parameter is approximately 78 rows

Dbshut oracle_home_listner=$1 parameter is approximately 50 rows

VI Command:

: Set NU Displays line number

3.2 Set power on automatically run Oracle

The first step: Modify the/etc/oratab file with the following command:

[Email protected] ~]$ Vi/etc/oratab

Found: Orcl:/u01/oracle:n modified to: orcl:/u01/oracle:y Note: orcl:/u01/oracle:n should be identified according to the actual situation, ORCL is the name of the newly created library instance,/u01/oracle is or The absolute path of the Acle_home; Y represents the start-up with the system;

Step Two: Add Lsnrctl start and Dbstart to the rc.local file with the following command:

[Email protected] ~]# vi/etc/rc.d/rc.local

Add to:

Su oracle-lc "/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"

Su Oracle-lc/u01/app/oracle/product/11.2.0/db_1/bin/dbstart

Note: The first command has a space, so use quotation marks

3.3 Configuring Oracle Sqlplus Echo

Yum install-y rlwrap (if you do not set the echo Sqlplus cannot delete the character operation needs to be done under the root user)

Echo "Alias sqlplus= ' Rlwrap sqlplus '" >>/Home/Oracle/. Bash_profile

Echo "Alias rman= ' Rlwrap rman '" >>/Home/Oracle/. Bash_profile

Immediate effect

Source/home/oracle/.bash_profile

At this point, all the work has been done.

Installing the Oracle database on a Linux system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.