Official document of oracle Database
1, Check environment
[root@node82 ~]# cat /etc/centos-release CentOS Linux release 7.6.1810 (Core)
Verify that the processor architecture matches the Oracle Software version to be installed. If you do not see the expected output, you cannot install software on the system.
Check memory and swap partitions
free -m or free -g
Note: if you deploy oralce database, you should also ensure that there is swap partition and the space is greater than 128M.
2, Database installation
2.1 database version
(Enterprise Edition): Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
See the attachment for the installation package. The name of the compressed package is as follows:
2.2 parameter modification
2.2.1 limits.conf file modification
Modify the restrictions of the user's SHELL, and modify / etc / security / limits Conf file
Enter the command VI / etc / security / limits Press the conf I key to enter the editing mode and add the following contents (it is recommended to copy directly)
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
2.2.2 modification of login file
Modify / etc / PAM D / login file
Enter the command: VI / etc / PAM D / login, i key to enter the editing mode, and add the following contents to the end of the file
Tail.
session required /lib64/security/pam_limits.so session required pam_limits.so
2.2.3 sysctl.conf file modification
Enter the command: VI / etc / sysctl Press conf and i to enter the editing mode and add the following contents to the file:
fs.file-max = 6815744 fs.aio-max-nr = 1048576 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
Refresh input:
#sysctl -p
**2.2.4 modification of / etc / profile file**
Enter the command: vi /etc/profile, press the i key to enter the editing mode, and add the following contents to the file.
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
3, Installation preparation
3.1 improve the dependency package
For different versions, please refer to Official documents
sudo yum -y install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel compat-libstdc++-33.x86_64 ksh
If compat libstdc + + has not been installed
Solution: sudo yum list all |grep "compat libstdc + +"
**3.2 creating users and groups**
Create relevant users and groups as owners of the software installation and support group.
To create an Oracle user and password, enter the following command:
groupadd dba groupadd oinstall useradd oracle -g oinstall -G dba ##Make Oracle users belong to both groups passwd oracle
Then you will be asked to enter the password. Enter the password twice at will, but it must be consistent. Press enter to confirm.
tips: Linux view user's groups < user1 > < user2 > < user3 >
3.3 create database software directory
Create database software directory and data file storage directory. The location of the directory is determined according to your own situation. Note
If you want disk space, enter the following command:
mkdir -p /home/oracle/app/{oracle,oraInventory,oradata}
3.4 change directory group
To change the directory ownership to Oracle users, enter the command:
chown -R oracle:oinstall /home/oracle/app
3.5 configuring environment variables
To configure the environment variables of oracle users, first switch to the newly created oracle user, enter: su - oracle, and then directly enter: VI bash_ Press the profile I key to enter the editing mode and add the following contents to the end of the file.
export ORACLE_BASE=/home/oracle/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
4, Installation process
4.1 decompression package
First copy the downloaded Oracle installation package to linux:
sudo yum -y install unzip --Install the decompression package (negligible) unzip p13390677_112040_Linux-x86-64_1of7.zip unzip p13390677_112040_Linux-x86-64_2of7.zip
After decompression, the cd enters the directory database after decompression. You can also view the files contained in the database after decompression by using ls command
cd database
4.2 copy the response template file
Oracle user logs in, su - oracle, and enters the following command:
mkdir etc cp /home/oracle/database/response/* /home/oracle/etc/
**4.3 setting response file permissions**
Switch to the root user, su - root, and enter the following command:
chown -R oracle.dba /home/oracle/etc chmod 700 /home/oracle/etc/*.rsp
**4.4 silent installation of oracle Software**
Switch back to oracle user, su - oracle
Modify the response file / home / Oracle / etc / DB for installing Oracle Software_ install. rsp
/home/oracle/app can be changed to a user-defined data directory. Enter the following command:
vi /home/oracle/etc/db_install.rsp
The parameters to be modified are as follows:
oracle.install.option=INSTALL_DB_SWONLY //Line 29 installation type ORACLE_HOSTNAME=localdomain //37 line host name, obtained through the hostname command UNIX_GROUP_NAME=oinstall//42 row installation group INVENTORY_LOCATION=/home/oracle/app/oraInventory //47 rows of INVENTORY items record SELECTED_LANGUAGES=en,zh_CN,zh_TW //78 line select language ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1 //Line 83 oracle_home It is consistent with the directory in the environment variable configured above ORACLE_BASE=/home/oracle/app/oracle //88 line oracle_base, and investment Record to the same level oracle.install.db.InstallEdition=EE //Enterprise version, oracle version 99 oracle.install.db.DBA_GROUP=dba //142 row dba user group oracle.install.db.OPER_GROUP=oinstall //147 row oper user group oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //160 rows of data Library type oracle.install.db.config.starterdb.globalDBName=orcl //165 lines globalDBName oracle.install.db.config.starterdb.SID=orcl //170 row SID oracle.install.db.config.starterdb.characterSet=ZHS16GBK//Specify character set oracle.install.db.config.starterdb.installExampleSchemas=false// whether Load template example oracle.install.db.config.starterdb.enableSecuritySettings=true// whether Enable security settings oracle.install.db.config.starterdb.memoryLimit=512 //192 / 200 line automatic pipe Minimum memory for processing memory(M) oracle.install.db.config.starterdb.password.ALL=LINKCLD_ORCL //23 row setting Make sure all database users use the same password DECLINE_SECURITY_UPDATES=true //Line 385 set security update
Under oracle user, switch su - oracle to cd database under database directory, and enter the following command:
./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp
Start the installation. If the prompt [WARNING] is ignored during the installation, the installation program is still in progress
If [FATAL] appears, the installer has stopped. Execute until the following page appears:
The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run /home/oracle/app/oraInventory/orainstRoot.sh /home/oracle/app/product/11.2.0/db_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software.
Open a new window and switch to the root user, su - root
Then execute the above two scripts, and the commands are as follows:
sh /home/oracle/app/oraInventory/orainstRoot.sh sh /home/oracle/app/product/11.2.0/db_1/root.sh
After the script is executed, return to the above interface and press enter
4.5 add environment variables for oracle users
Under oracle user, su - oracle, edit the document, and enter the following command: VI ~/ bash_ profile
Press i to enter the editing mode, and add the following contents directly at the end:
export TNS_ADMIN=$ORACLE_HOME/network/admin export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib export ORACLE_OWNER=oracle export SPFILE_PATH=$ORACLE_HOME/dbs export ORA_NLS10=$ORACLE_HOME/nls/data
Enter the following command to make the above settings effective:
source /home/oracle/.bash_profile
4.6 configuring a silent network
Under Oracle user, su - oracle, enter the following command:
$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/etc/netca.rsp ##Configure silent listener
If the following error is reported:
UnsatisfiedLinkError exception loading native library: njni11 java.lang.UnsatisfiedLinkError: /home/oracle/app/oracle/product/11.2.0/db_1/lib/libnjni11.so: libclntsh.so.11.1: cannle: No such file or directory
resolvent:
cp /home/oracle/app/oracle/product/11.2.0/db_1/inventory/Scripts/ext/lib/libcl ntsh.so.11.1 /home/oracle/app/oracle/product/11.2.0/db_1/lib
Execute the following command again:
netca /silent /responseFile /home/oracle/etc/netca.rsp
Tips are as follows:
Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0
Enter the following command to view:
ss -antp|grep 1521
4.7 modifying the silent installation configuration
To modify the response file that only installs the database, enter the following command:
vi /home/oracle/etc/dbca.rsp
Modify the following parameters:
GDBNAME="orcl.localdomain " //Row 78 name of global database = SID + host domain name SID="orcl" //149 line SID CHARACTERSET="ZHS16GBK" //415 line code NATIONALCHARACTERSET="AL16UTF16" //425 line code DATAFILEDESTINATION = /home/oracle/app/oradata //Line 356
**4.8 silent database installation**
Under Oracle user, su - oracle enter the following command:
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp
After executing the above commands, the screen will turn into a whiteboard. In fact, at this time, enter sys and system of oracle
Enter the password twice, and then the percentage progress of execution will be displayed. At the same time, it will prompt that the log file of oracle is / u01 / APP / oracle / cfgtoollogs / DBCA / orcl / orcl Log, and then check and modify the permission of oracle command (6751). If the permission is wrong, enter the following command to modify:
chmod 6751 $ORACLE_HOME/bin/oracle
4.9 case inspection after database establishment
Start the listening port and enter the following command: lsnrctl start
After the database is created, check the instance and enter the following command:
ps -ef | grep ora | grep -v grep | wc -l ps -ef | grep ora | grep -v grep ps -ef|grep oracle|egrep -v "bash|su|grep|ps"
It is normal to check the sqlplus process. You can configure the following service files
oracle 3695 3413 0 14:46 pts/1 00:00:00 sqlplus oracle 11082 1 0 15:19 ? 00:00:00 /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr LISTENER -inherit
After building the database, listen to the status check and enter the following command: lsnrctl status
5, Power on
5.1 configuration modification
Switch to the root user, su – root, and enter the following command:
vi /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
Add the following to the document:
ORACLE_HOME_LISTNER=$ORACLE_HOME //Add at line 65
After saving and exiting, enter the following command:
vi /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbshut
Add the following to the document:
ORACLE_HOME_LISTNER=$ORACLE_HOME //Add at line 39
Exit after saving, and then enter: vi /etc/oratab to change the N at the end to Y, as follows:
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
5.2 create startup file
Modify the file configuration, switch to the root user, su – root, and enter the following command:
vi /etc/rc.d/init.d/oracled
Paste the following contents into a new file, ORACLE_HOME = self installed directory
#! /bin/bash # chkconfig: 345 90 10 # description: The Oracle Database is an Object-Relational Database Management System. # # processname: oracle . /etc/rc.d/init.d/functions LOCKFILE=/var/lock/subsys/oracle ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1 ORACLE_USER=oracle case "$1" in 'start') if [ -f $LOCKFILE ]; then echo $0 already running. exit 1 fi echo -n $"Starting Oracle Database:" su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start" su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" ##su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole" touch $LOCKFILE ;; 'stop') if [ ! -f $LOCKFILE ]; then echo $0 already stopping. exit 1 fi echo -n $"Stopping Oracle Database:" su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop" su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut" ##su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole" rm -f $LOCKFILE ;; 'restart') $0 stop $0 start ;; 'status') if [ -f $LOCKFILE ]; then echo $0 started. else echo $0 stopped. fi ;; *) echo "Usage: $0 [start|stop|status]" exit 1 esac exit 0
Modify the permission configuration. Under the same root user, su – root, enter the following command:
chown oracle.dba /etc/init.d/oracled chmod a+x /etc/init.d/oracled chkconfig --add oracled chkconfig oracled on //Add Oracle D service startup
Set sudo permission of oracle user, and use systemctl command to manage oracle D service. Enter as follows
Command: chatr - I / etc / sudoers
visudo
i key to enter the editing mode, and add a line around 95 lines of the file, as follows:
oracle ALL=(ALL) NOPASSWD: /etc/init.d/oracled,/usr/bin/systemctl * oracled*
The startup, shutdown and restart commands of oracle service are as follows:
su - oracle //su – root can also sudo systemctl start oracled sudo systemctl stop oracled sudo systemctl restart oracled