Installation of Oracle Database 11g Enterprise on CentOS (the most detailed and simple tutorial in the whole network)

Installation of Oracle Database 11g Enterprise on CentOS

environment

  • VMware Workstation 15 Pro
  • CentOS 7 64 bit (CentOS-7-x86_64-DVD-1810.iso)

If the environment is not ready, you can refer to: Installing CentOS for VMware virtual machines

tool

  • SecureCRT 8.7
  • SecureFX 8.7
  • Navicat Premium 12
  • PL/SQL

Installation package

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0

  • p13390677_112040_Linux-x86-64_1of7.zip
  • p13390677_112040_Linux-x86-64_2of7.zip

client

  • instantclient-basic-windows.x64-11.2.0.4.0.zip

Create users and user groups

# Add user group
groupadd -g 502 oinstall
groupadd -g 503 dba
groupadd -g 504 oper
groupadd -g 505 asmadmin

# Add user
useradd -u 502 -g oinstall -G oinstall,dba,asmadmin,oper -s /bin/bash -m oracle

# Set user password
passwd oracle
# Set oracle user password
Af8JPoRh2lyM

Upload software installation package

Operating user: oracle

# Switch users
su - oracle

Upload the software installation package to the / home/oracle directory

Install dependent packages

Operating user: root

Note: there may be a prompt that there is no software package available, which will not affect the subsequent operations

yum install -y automake autotools-dev binutils bzip2 elfutils expat \
gawk gcc gcc-multilib g++-multilib lib32ncurses5 lib32z1 \
ksh less lib32z1 libaio1 libaio-dev libc6-dev libc6-dev-i386 \
libc6-i386 libelf-dev libltdl-dev libodbcinstq4-1 libodbcinstq4-1:i386 \
libpth-dev libpthread-stubs0-dev libstdc++5 make openssh-server rlwrap \
rpm sysstat unixodbc unixodbc-dev unzip x11-utils zlibc unzip cifs-utils \
libXext.x86_64  glibc.i686

Firewall settings

Operating user: root

This step is not necessary, because the firewall has been closed when installing the virtual machine according to the previous steps

# If the firewall is on, add port 1521 to the firewall
firewall-cmd  --zone=public  --add-port=1521/tcp  --permanent
firewall-cmd  --reload
firewall-cmd  --list-port

# Or turn off the firewall and set startup not to start
systemctl stop firewalld
systemctl disable firewalld

Modify operating system configuration

Operating user: root

vim /etc/security/limits.conf

# vim shortcut key: shift + g jump to the end of the file
oracle          soft      nproc   2047
oracle          hard      nproc   16384
oracle          soft      nofile  1024
oracle          hard      nofile  65536
oracle          soft      stack   10240

Assign administrator privileges to oracle users

If the ordinary user sudo cannot obtain the administrator permission, an error will be reported

Ordinary users obtain administrator privileges

# Add oracle user to sudoers as root user
sudo vim /etc/sudoers

Add a line under root

oracle  ALL=(ALL)       ALL

vim shortcut key:

  • y: Copy
  • p: Paste
# Force save
:wq!

Unzip the Oracle database installation package

Operating user: oracle

# Operation directory / home/oracle
unzip p13390677_112040_Linux-x86-64_1of7.zip 
unzip p13390677_112040_Linux-x86-64_2of7.zip 

Create Oracle installation directory

Operating user: oracle

# -p represents recursive creation of multi-level directory ~ the wavy line represents the root directory of the currently logged in user, where the root directory of the Oracle user is / home/oracle
mkdir -p ~/oracle11g

Modify environment variables

Operating user: oracle

# ~Represents the current user's root directory / home/oracle
vim ~/.bash_profile

Add the following configuration items at the end of the file

export ORACLE_BASE=/home/oracle/oracle11g
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export NLS_LANG=.AL32UTF8
export PATH=${PATH}:${ORACLE_HOME}/bin/:$ORACLE_HOME/lib64

Make environment variables effective

source ~/.bash_profile

Modify Oracle profile

Silent installation db_install.rsp file modification

Operating user: oracle

Copy file template

# /home/oracle
cp /home/oracle/database/response/db_install.rsp .

Note: copy the last one of the commands Cannot be omitted, indicating that DB will be used_ install. Copy the RSP file from the / home/oracle/database/response directory to the current directory.

Right db_install.rsp file for editing.

vim db_install.rsp

The configuration items to be modified are as follows. Here, I will list the modified configuration items:

vim shortcut key: display line number: set nu

For the meaning of specific configuration items, you can read the notes, which are very detailed

# Line 29
oracle.install.option=INSTALL_DB_AND_CONFIG

# 37 lines
# In fact, it can be modified to your own host name or domain name (IP)
ORACLE_HOSTNAME=localhost 

# Line 42
UNIX_GROUP_NAME=oinstall

# Line 49
INVENTORY_LOCATION=/home/oracle/oraInventory

# 86 lines
SELECTED_LANGUAGES=en,zh_CN

# Line 91
ORACLE_HOME=/home/oracle/oracle11g/product/11.2.0/dbhome_1

# 96 lines
ORACLE_BASE=/home/oracle/oracle11g

# 107 lines
oracle.install.db.InstallEdition=EE

# 154 lines
oracle.install.db.DBA_GROUP=dba

# 160 lines
oracle.install.db.OPER_GROUP=oper

# Line 189
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

# 194 lines
oracle.install.db.config.starterdb.globalDBName=orcl

# Line 199
oracle.install.db.config.starterdb.SID=orcl

# 213 lines (default)
oracle.install.db.config.starterdb.characterSet=AL32UTF8

# Line 221 (default)
oracle.install.db.config.starterdb.memoryOption=true

# Line 229
oracle.install.db.config.starterdb.memoryLimit=1024

# Line 235 (default)
oracle.install.db.config.starterdb.installExampleSchemas=false

# Line 262 all schemas in the starter database
oracle.install.db.config.starterdb.password.ALL=DdKUQbzz9fm2

# Line 290 (default)
oracle.install.db.config.starterdb.control=DB_CONTROL

# Line 311 (default)
oracle.install.db.config.starterdb.automatedBackup.enable=false

# Line 336
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

# Line 344
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/oracle11g/oradata

# Line 351
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/oracle11g/fast_recovery_area

# 400 lines
DECLINE_SECURITY_UPDATES=true

Silent installation DB_ install. Detailed explanation of RSP file

####################################################################

## Copyright(c) Oracle Corporation1998,2008. All rights reserved.           ##

## Specify values for the variables listedbelow to customize your installation.    ##

## Each variable is associated with acomment. The comment                 ##

## can help to populate the variables withthe appropriate values.               ##

## IMPORTANT NOTE: This file contains plaintext passwords and            ##

## should be secured to have readpermission only by oracle user               ##

## or db administrator who owns thisinstallation.                           ##

##Description of the whole file, which contains parameter description and confidentiality of password information in silent file   ##

####################################################################

#------------------------------------------------------------------------------

# Do not change the following system generatedvalue. Mark the version of the response file, which must be consistent with the version to be#The installed database version is the same. The installation inspection cannot be passed and cannot be changed

#------------------------------------------------------------------------------

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

#------------------------------------------------------------------------------

# Specify the installation option.

# It can be one of the following:

# 1. INSTALL_DB_SWONLY

# 2. INSTALL_DB_AND_CONFIG

# 3. UPGRADE_DB

#Select installation type: 1 Only install database software 2 Install database software and build database 3 Upgrade database

#-------------------------------------------------------------------------------

oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------

# Specify the hostname of the system as setduring the install. It can be used

# to force the installation to use analternative hostname rather than using the

# first hostname found on the system.(e.g., for systems with multiple hostnames

# and network interfaces) specifies the host name of the operating system, which is obtained through the hostname command

#-------------------------------------------------------------------------------

ORACLE_HOSTNAME=ora11gr2

#-------------------------------------------------------------------------------

# Specify the Unix group to be set for theinventory directory. 

#Specify the owner of oracle inventory directory, usually oinstall or dba

#-------------------------------------------------------------------------------

UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------

# Specify the location which holds theinventory files.

#Specify the path of oracle inventory directory of product list. If it is on Win platform, it can be omitted

#-------------------------------------------------------------------------------

INVENTORY_LOCATION=/u01/app/oracle/oraInventory

#-------------------------------------------------------------------------------

# Specify the languages in which thecomponents will be installed. 

# en  : English                  ja   : Japanese                 

# fr  : French                   ko   : Korean                   

# ar  : Arabic                   es   : Latin American Spanish   

# bn  : Bengali                  lv   : Latvian                  

# pt_BR: Brazilian Portuguese       lt   : Lithuanian               

# bg  : Bulgarian                ms   : Malay                    

# fr_CA: Canadian French          es_MX: Mexican Spanish          

# ca  : Catalan                  no   : Norwegian                

# hr  : Croatian                  pl   : Polish                   

# cs  : Czech                    pt   : Portuguese               

# da  : Danish                   ro   : Romanian                 

# nl  : Dutch                    ru   : Russian                  

# ar_EG: Egyptian                 zh_CN: Simplified Chinese       

# en_GB: English (Great Britain)     sk   :Slovak                   

# et  : Estonian                  sl   : Slovenian                

# fi  : Finnish                   es_ES: Spanish                  

# de  : German                  sv   : Swedish                   

# el  : Greek                    th   : Thai                     

# iw  : Hebrew                  zh_TW:Traditional Chinese      

# hu  : Hungarian                tr   : Turkish                  

# is  : Icelandic                  uk  : Ukrainian                

# in  : Indonesian                vi   :Vietnamese               

# it  : Italian                                                  

# Example : SELECTED_LANGUAGES=en,fr,ja

#Specify the database language. You can select multiple, separated by commas. Select en, zh_ CN (English and simplified Chinese)

#------------------------------------------------------------------------------

SELECTED_LANGUAGES=en,zh_CN

#------------------------------------------------------------------------------

# Specify the complete path of the OracleHome. Set ORALCE_ Path to home

#------------------------------------------------------------------------------

ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

#------------------------------------------------------------------------------

# Specify the complete path of the OracleBase.  Set ORALCE_ Path to base

#------------------------------------------------------------------------------

ORACLE_BASE=/u01/app/oracle

#------------------------------------------------------------------------------

# Specify the installation edition of thecomponent.           

# The value should contain only one ofthese choices.       

# EE    : EnterpriseEdition                               

# SE    : Standard Edition                                 

# SEONE  Standard Edition One

# PE    : Personal Edition (WINDOWS ONLY)

#Select the version of Oracle installation database software (enterprise version, Standard Version, Standard Version 1). Different versions have different functions

#Refer to Appendix D for detailed version differences

#------------------------------------------------------------------------------

oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------

# This variable is used to enable ordisable custom install.

# true : Components mentioned as part of 'customComponents' property

#are considered for install.

# false : Value for 'customComponents' isnot considered.

#Whether to customize Oracle components. If false is selected, the default components will be used

#If you select true, you need to list the components to be installed one by one in the following parameter.

#After installing the corresponding copyright, all components will be installed. If there is a lack of a component in the later stage, it will be very troublesome to install it again.

#------------------------------------------------------------------------------

oracle.install.db.isCustomInstall=true

#------------------------------------------------------------------------------

# This variable is considered only if'IsCustomInstall' is set to true.

# Description: List of Enterprise EditionOptions you would like to install.

#              The following choices areavailable. You may specify any

#              combination of thesechoices.  The components you chooseshould

#              be specified in the form"internal-component-name:version"

#              Below is a list of components youmay specify to install.

#              oracle.rdbms.partitioning:11.2.0.1.0- Oracle Partitioning

#              oracle.rdbms.dm:11.2.0.1.0- Oracle Data Mining

#              oracle.rdbms.dv:11.2.0.1.0- Oracle Database Vault

#              oracle.rdbms.lbac:11.2.0.1.0- Oracle Label Security

#              oracle.rdbms.rat:11.2.0.1.0- Oracle Real Application Testing

#              oracle.oraolap:11.2.0.1.0- Oracle OLAP

# oracle. install. db. If iscustominstall = true, you must manually select the components to be installed

#------------------------------------------------------------------------------

oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0

###############################################################################

# PRIVILEGED OPERATING SYSTEM GROUPS                                         

# Provide values for the OS groups to whichOSDBA and OSOPER privileges       #

# needs to be granted. If the install isbeing performed as a member of the          #

# group "dba", then that will beused unless specified otherwise below.               #

#Specify user groups with OSDBA and osopr permissions, usually dba groups

###############################################################################

#------------------------------------------------------------------------------

# The DBA_GROUP is the OS group which is tobe granted OSDBA privileges.

#------------------------------------------------------------------------------

oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------

# The OPER_GROUP is the OS group which isto be granted OSOPER privileges.

#------------------------------------------------------------------------------

oracle.install.db.OPER_GROUP=oinstall

#------------------------------------------------------------------------------

# Specify the cluster node names selectedduring the installation.

#If RAC is installed, specify all nodes here

#------------------------------------------------------------------------------

oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------

# Specify the type of database to create.

# It can be one of the following:

# - GENERAL_PURPOSE/TRANSACTION_PROCESSING         

# - DATA_WAREHOUSE                               

#Select the purpose of the database, general purpose / transaction processing, data warehouse

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#------------------------------------------------------------------------------

# Specify the Starter Database GlobalDatabase Name.  Specify GlobalName

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.globalDBName=ora11g

#------------------------------------------------------------------------------

# Specify the Starter Database SID. Specify sid

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.SID=ora11g

#------------------------------------------------------------------------------

# Specify the Starter Database characterset.

# It can be one of the following:

# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252,EE8ISO8859P2,

# EE8MSWIN1250, NE8ISO8859P10,NEE8ISO8859P4, BLT8MSWIN1257,

# BLT8ISO8859P13, CL8ISO8859P5,CL8MSWIN1251, AR8ISO8859P6,

# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253,IW8ISO8859P8,

# IW8MSWIN1255, JA16EUC, JA16EUCTILDE,JA16SJIS, JA16SJISTILDE,

# KO16MSWIN949, ZHS16GBK, TH8TISASCII,ZHT32EUC, ZHT16MSWIN950,

# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254,VN8MSWIN1258

#Select a character set. Incorrect character set brings countless troubles to data display and storage.

#ZHS16GBK simplified Chinese library is usually selected for Chinese. It is recommended to select the AL32UTF8 international character set of unicode

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------

# This variable should be set to true ifAutomatic Memory Management

# in Database is desired.

# If Automatic Memory Management is notdesired, and memory allocation

# is to be done manually, then set it tofalse.

#11g New feature of automatic memory management, that is SGA_TARGET and PAG_AGGREGATE_TARGET all#There is no need to set it. Oracle will automatically adjust the size of two parts.

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.memoryOption=true

#------------------------------------------------------------------------------

# Specify the total memory allocation forthe database. Value(in MB) should be

# at least 256 MB, and should not exceedthe total physical memory available on the system.

# Example:oracle.install.db.config.starterdb.memoryLimit=512

#Specifies the size of Oracle automatic management memory, with a minimum of 256MB

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.memoryLimit=

#------------------------------------------------------------------------------

# This variable controls whether to loadExample Schemas onto the starter

# database or not. Load template sample

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.installExampleSchemas=false

#------------------------------------------------------------------------------

# This variable includes enabling auditsettings, configuring password profiles

# and revoking some grants to public. Thesesettings are provided by default.

# These settings may also be disabled.    Enable security settings

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.enableSecuritySettings=true

###############################################################################

# Passwords can be supplied for thefollowing four schemas in the                         #

# starter database:                                                               #

#   SYS                                                                     #

#   SYSTEM                                                                  #

#  SYSMAN (used by Enterprise Manager)                                         #

#  DBSNMP (used by Enterprise Manager)                                         #

# Same password can be used for allaccounts (not recommended)                         #

# or different passwords for each accountcan be provided (recommended)                  #

#Set database user password

###############################################################################

#------------------------------------------------------------------------------

# This variable holds the password that isto be used for all schemas in the

# starter database.

#Set all database users to use the same password, and other database users do not need to set it separately.

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.password.ALL=oracle

#-------------------------------------------------------------------------------

# Specify the SYS password for the starterdatabase.

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.password.SYS=

#-------------------------------------------------------------------------------

# Specify the SYSTEM password for thestarter database.

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.password.SYSTEM=

#-------------------------------------------------------------------------------

# Specify the SYSMAN password for thestarter database.

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.password.SYSMAN=

#-------------------------------------------------------------------------------

# Specify the DBSNMP password for thestarter database.

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.password.DBSNMP=

#-------------------------------------------------------------------------------

# Specify the management option to beselected for the starter database.

# It can be one of the following:

# 1. GRID_CONTROL

# 2. DB_CONTROL

#DB local database management tool_ Control, remote centralized management tool GRID_CONTROL

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.control=DB_CONTROL

#-------------------------------------------------------------------------------

# Specify the Management Service to use ifGrid Control is selected to manage

# the database. GRID_CONTROL needs to set the remote path URL of grid control

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

#-------------------------------------------------------------------------------

# This variable indicates whether toreceive email notification for critical

# alerts when using DB control. Whether to enable Email notification. After enabling, alarm and other information will be sent to the specified mailbox

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

#-------------------------------------------------------------------------------

# Specify the email address to which thenotifications are to be sent. Set notification EMAIL address

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.dbcontrol.emailAddress=

#-------------------------------------------------------------------------------

# Specify the SMTP server used for emailnotifications. Set up EMAIL mail server

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.dbcontrol.SMTPServer=

###############################################################################

# SPECIFY BACKUP AND RECOVERY OPTIONS                                      #

# Out-of-box backup and recovery optionsfor the database can be mentioned                #

# using the entries below.                                                         #

#Out of box (out of box experience) is abbreviated as OOBE

#Products give users a good first impression and use experience

###############################################################################

#------------------------------------------------------------------------------

# This variable is to be set to false ifautomated backup is not required. Else

# this can be set to true. Set automatic backup, which is the same as that in OUI.

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.automatedBackup.enable=false

#------------------------------------------------------------------------------

# Regardless of the type of storage that ischosen for backup and recovery, if

# automated backups are enabled, a job willbe scheduled to run daily at

# 2:00 AM to backup the database. This jobwill run as the operating system

# user that is specified in this variable. Automatic backup will start a job and specify the system user ID that starts the job

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.automatedBackup.osuid=

#-------------------------------------------------------------------------------

# Regardless of the type of storage that ischosen for backup and recovery, if

# automated backups are enabled, a job willbe scheduled to run daily at

# 2:00 AM to backup the database. This jobwill run as the operating system user

# specified by the above entry. Thefollowing entry stores the password for the

# above operating system user. Automatic backup will start a job, and the password of OSUser needs to be specified

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.automatedBackup.ospwd=

#-------------------------------------------------------------------------------

# Specify the type of storage to use forthe database.

# It can be one of the following:

# - FILE_SYSTEM_STORAGE

# - ASM_STORAGE

#Automatic backup requires specifying whether the file system used to store database files or ASM

#------------------------------------------------------------------------------

oracle.install.db.config.starterdb.storageType=

#-------------------------------------------------------------------------------

# Specify the database file location whichis a directory for datafiles, control

# files, redo logs.        

# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM

#Only when the file system is used to store database files, the storage directory of data files, control files and redo logs needs to be specified

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

#-------------------------------------------------------------------------------

# Specify the backup and recovery location.

# Applicable only whenoracle.install.db.config.starterdb.storage=FILE_SYSTEM

#Only when the file system is used to store database files, the backup and recovery directory needs to be specified

#-------------------------------------------------------------------------------

oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

#-------------------------------------------------------------------------------

# Specify the existing ASM disk groups tobe used for storage.

# Applicable only whenoracle.install.db.config.starterdb.storage=ASM

#You need to specify the disk group to store database files using ASM

#-------------------------------------------------------------------------------

oracle.install.db.config.asm.diskGroup=

#-------------------------------------------------------------------------------

# Specify the password for ASMSNMP user ofthe ASM instance.                 

# Applicable only whenoracle.install.db.config.starterdb.storage=ASM_SYSTEM

#You need to specify the ASM instance password before using ASM to store database files

#-------------------------------------------------------------------------------

oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------

# Specify the My Oracle Support AccountUsername.

# Example   :MYORACLESUPPORT_USERNAME=metalink

#Specify metalink account user name

#------------------------------------------------------------------------------

MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------

# Specify the My Oracle Support AccountUsername password.

# Example   : MYORACLESUPPORT_PASSWORD=password

# Specify metalink account password

#------------------------------------------------------------------------------

MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------

# Specify whether to enable the user to setthe password for

# My Oracle Support credentials. The valuecan be either true or false.

# If left blank it will be assumed to befalse.

# Example   : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true

# Can users set metalink password

#------------------------------------------------------------------------------

SECURITY_UPDATES_VIA_MYORACLESUPPORT=

#------------------------------------------------------------------------------

# Specify whether user wants to give anyproxy details for connection.

# The value can be either true or false. Ifleft blank it will be assumed to be false.

# Example   : DECLINE_SECURITY_UPDATES=false

# False indicates that security updates do not need to be set. Note that there is a suspected BUG in the silent installation of 11.2

# The Response File must be specified as true, otherwise an error will be prompted, regardless of whether the email address is filled in correctly

#------------------------------------------------------------------------------

DECLINE_SECURITY_UPDATES=true

#------------------------------------------------------------------------------

# Specify the Proxy server name. Lengthshould be greater than zero.

#Proxy server name

# Example   : PROXY_HOST=proxy.domain.com

#------------------------------------------------------------------------------

PROXY_HOST=

#------------------------------------------------------------------------------

# Specify the proxy port number. Should beNumeric and atleast 2 chars.

#Proxy server port

# Example   : PROXY_PORT=25

#------------------------------------------------------------------------------

PROXY_PORT=

#------------------------------------------------------------------------------

# Specify the proxy user name. LeavePROXY_USER and PROXY_PWD

# blank if your proxy server requires noauthentication.

#Proxy server user name

# Example   : PROXY_USER=username

#------------------------------------------------------------------------------

PROXY_USER=

#------------------------------------------------------------------------------

# Specify the proxy password. LeavePROXY_USER and PROXY_PWD 

# blank if your proxy server requires noauthentication.

#Proxy server password

# Example   : PROXY_PWD=password

#------------------------------------------------------------------------------

PROXY_PWD=

Set virtual memory

Operating user: root

If the virtual memory is not set, an error will be reported in the later installation

Increase virtual memory

How large is the virtual memory setting: if you do not intend to turn on the sleep function and the physical memory is less than 8G, set swap to be as large as the physical memory. If the physical memory is more than 8G, set the swap space to 8G. When the physical memory is greater than 64G, it is not recommended to turn on the sleep function.

Use the swap on - s command to check whether swap is enabled. If there is no output, it means it is not enabled.

You can also use the free -h or free -m commands

If the total capacity of Swap is 0, it means that Swap is not enabled

Note: the virtual memory has been enabled when the virtual machine is installed. If it is not enabled, set it according to the following tutorial

Set virtual memory

# Create a 5GB file path / swap calculation: 5GB=1024*1024*5=5242880
sudo dd if=/dev/zero of=/swap bs=1024 count=5242880

# Set the permissions of this file to prevent illegal reading and writing of memory:
sudo chmod 600 /swap

# Make this file a swap file
sudo mkswap /swap

# Open swap
sudo swapon /swap

# Use the swap on - s command to check that swap has been successfully enabled
swapon -s 

swap will not be enabled automatically after system restart

If you need to enable swap automatically after startup, you need to modify the fstab file:

sudo vim /etc/fstab

# Add a line at the end of the file
/swap   swap    swap    sw  0   0

Delete virtual memory

# View swap partition file
cat /proc/swaps

# Close the partition and write the file path found above.
swapoff /swap

# Delete file
rm -rf /swap

# Edit the fstab file, delete or comment out the boot auto mount configuration we added in the fstab file before
vim /etc/fstab

# /dev/mapper/centos-swap swap                    swap    defaults        0 0

Reset virtual memory

You can delete and reset the original virtual memory, or set a new virtual memory partition and add it to the virtual memory

Silent installation of Oracle 11g

Operating user: oracle

# /home/oracle/database
./runInstaller -silent -ignoreSysPrereqs -responseFile /home/oracle/db_install.rsp

Next, wait silently for Oracle to install itself. The installation process will take some time. Just wait patiently

During this period, some log information will appear. The warning can be ignored and no error can be reported

[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (IMG dackobff-1603099057995)( https://blog.javaood.com/upload/image/image-20201019022017302.png )]

Execute script

Operating user: root

/home/oracle/oraInventory/orainstRoot.sh

/home/oracle/oracle11g/product/11.2.0/dbhome_1/root.sh

Navicat Premium remote connection

Use reference: Navicat Premium 12

PLSQL Developer remote connection

Use reference: PL/SQL Developer 14

localVM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.211.133)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = orcl)
    )
  )

Set startup

Operating user: root

vim /etc/oratab

# Change the N of the last line to Y

chmod 777 /etc/rc.d/rc.local

vim /etc/rc.d/rc.local

# Add a line at the end
su - oracle -lc dbstart

Operating user: Oracle

cd $ORACLE_HOME/bin

vim dbstart

# Modify Oracle in line 80_ HOME_ LISTNER=$1 --> ORACLE_ HOME_ LISTNER=$ORACLE_ HOME
$1 Change to $ORACLE_HOME

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-mhykfdtf-1603099058015)( https://blog.javaood.com/upload/image/image-20201019130515142.png )]

Restart CentOS

Operating user: root

reboot

Then Navicat Premium and PL/SQL Developer test whether they can connect to Oracle database

Oracle architecture

In order to make other students better understand some basic concepts of Oracle, here are some introductions (there are still some differences in the architecture of Oracle and MySQL)

[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-1u8u1z7n-1603099058019)( https://blog.javaood.com/upload/image/image-20201019131811577.png )]

There are N databases under the MySQL database management system, and each database contains some tables. It can be understood that each database in the MySQL database management system is the basic unit of tables, and a database contains some tables.

There are also multiple users under the Oracle database management system. Each user contains some tables. It can be understood that the user in the Oracle database management system is the basic unit of the table, and a user contains some tables.

Note: To sum up, building a database in Oracle is to create a new user, because a user in Oracle is waiting for a database in MySQL

Unlock SCOTT user

[external link image transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-mbi2eb6c-1603099058021)( https://blog.javaood.com/upload/image/image-20201019132925214.png )]

The SCOTT user contains some test sample tables. Here you can unlock the users who use SCOTT

Operating user: oracle

sqlplus /nolog

conn /as sysdba

alter user scott account unlock;                                                                        
commit;

conn scott/tiger

# Enter the password and repeat the password (the same password set above is used here for convenience of memory: DdKUQbzz9fm2)
New password: DdKUQbzz9fm2
Retype new password: DdKUQbzz9fm2

# sign out
exit

[the external chain image transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the image and upload it directly (img-nk2nrcjn-1603099058026)( https://blog.javaood.com/upload/image/image-20201019133653996.png )]

Now test again and find that scott user can log in successfully

Create delete tablespace, create delete user and user authorization

[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-laq9uj5s-1603099058038)( https://blog.javaood.com/upload/image/image-20201019141809855.png )]

Tablespace: logical unit of ORACLE Database

Database - tablespace: a tablespace can be associated with multiple data files (physical structures)

Multiple tablespaces can be established under one database, multiple users can be established under one tablespace, and multiple tables can be established under one user.

Create and delete tablespaces

tablespace Is the name of the tablespace
datafile Specify the data file corresponding to the tablespace
size What is defined after is the initial size of the table space
autoextend on Automatic growth: when the table space is full, it will grow automatically
next What is specified after is the size of an automatic growth.

--Create tablespace
create tablespace test
datafile '/home/oracle/oracle11g/oradata/orcl/test.dbf'
size 100m
autoextend on
next 10m;

--Delete tablespace
drop tablespace test;

[the external chain picture transfer fails. The source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-n9l4imgs-1603099058041)( https://blog.javaood.com/upload/image/image-20201019143238574.png )]

Create and delete users

--Create user identified: Password (for convenience of memory, the same password is used here)
create user test
identified by DdKUQbzz9fm2
default tablespace test;


--delete user
 Syntax: drop user user name;
example: drop user test;

If the user owns the object, it cannot be deleted directly, otherwise an error value will be returned.
assign key words cascade,You can delete all objects of the user, and then delete the user.
Syntax: drop user user name cascade;
example: drop user test cascade;

[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-a1zx7n0j-1603099058044)( https://blog.javaood.com/upload/image/image-20201019143506305.png )]

User authorization

--Authorize users
--oracle Common roles in database
connect--Connection role
resource--Developer role
dba--Super administrator role


--to test User grant dba role
grant dba to test;
--Assign multiple roles
grant connect,resource,dba to test;

Three standard roles

  • Connect role
    • Temporary users, especially users who do not need to create tables, are usually given only connect role
    • connect is a simple permission to use oracle. This permission only has access to other users' tables, including select/insert/update and delete
    • Users with the connect role can also create tables, views, sequence s, cluster s, synonyms, session s, and other data link s
  • Resource role
    • More reliable and formal database users can grant resource role s
    • resource gives users additional permissions to create their own tables, sequences, procedures, triggers, indexes, and clusters
  • DBA role (database administrator role)
    • dba role has all system permissions
    • Including unlimited space quota and the ability to grant various permissions to other users. The system is owned by dba users

[external chain picture transfer failed. The source station may have anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-q8mvyeiq-1603099058046)( https://blog.javaood.com/upload/image/image-20201019144029487.png )]

Original text: https://blog.javaood.com/archives/o-r-a-c-l-e –d-a-t-a-b-a-s-e–1-1-g–e-n-t-e-r-p-r-i-s-e-zai-c-e-n-t-o-s-shang-de-an-zhuang

Tags: Database Oracle CentOS

Posted by sy-co on Tue, 10 May 2022 21:06:46 +0300