Understand the Oracle database and installation

Install Oracle Experiment

Oracle database overview

★ The most popular large-scale relational database
★ Produced by Oracle, the latest version is Oracle19c, and the most popular version is 12c
★ Take the 64-bit enterprise version Oracle12c as an example
★ CIS mode, support for SQL query language
★ Stability and high performance , Security and other aspects are better than other databases, so it is often used in government and corporate
★Official website: https://www.oracle.com/cn
The difference between 64-bit and 32-bit systems: the maximum memory supported by 32-bit systems does not exceed 4G , 64-bit maximum support 2TB

System and configuration requirements

  1. Physical memory, not less than 1GB,
  2. Swap partition (swap swap partition should not be less than 4G)
    ★When the physical memory is 1~2GB, swap is set to 1.5~2 times of the
    physical memory ★When the physical memory is 2~16GB, the swap setting is the same size as the physical memory
  3. Disk space, no less than 15GB
  4. Has a fixed FQDN name, it is not recommended to change it after installation

Oracle features

  1. Complete data management functions:
    1) Mass of
    data 2) Persistence of data storage
    3) Data sharing
    4) Data reliability

  2. Complete relational products:
    1) Information criteria—all information of a relational DBMS should be logically expressed in a way, that is, the values ​​in the table are explicitly expressed;
    2) Guidelines to ensure access
    3) View update criteria—as long as they are formed The data in the table of the view changes, and the data in the corresponding view changes at the same time.
    4) Data physical and logical independence criteria

  3. Distributed processing function:
    ORACLE database has provided distributed processing capabilities since the 5th edition, and has a relatively complete distributed database function in the 7th edition. An ORACLE distributed database consists of oraclerdbms, sql Net, SQL CONNECT and others Non-ORACLE relational product composition.

  4. ORACLE can easily realize the operation of data warehouse.
    This is a trend of technological development.

Advantages of Oracle

■ Strong availability

■ Strong scalability

■ Strong data security

■ Strong stability

Installation practice

Basic operations: turn off the firewall, turn off the core protection, clear the iptables rules

1. First, add a hard disk to the virtual machine, no less than 15G (here 40G) and create a file system to mount

[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
……省略部分
Building a new DOS disklabel with disk identifier 0x9bde58e1.
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 直接回车
First sector (2048-83886079, default 2048): 直接回车
Using default value 2048
Last sector, +sectors or +size{
    
    K,M,G} (2048-83886079, default 83886079): 直接回车
Using default value 83886079
Partition 1 of type Linux and of size 40 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost ~]# mkfs -t xfs /dev/sdb1    ##对磁盘sdb1进行格式转换
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=2621376 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=10485504, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=5119, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost ~]# mkdir /orc
[root@localhost ~]# vi /etc/hostname    ##修改主机名
HOSTNAME=oracle
[root@localhost ~]# vim /etc/hosts
oracle  192.168.10.10
[root@localhost ~]# hostnamectl set-hostname oracle
[root@localhost ~]# su
[root@oracle ~]# vi /etc/fstab   ##挂载文件系统/dev/sdb1到/orc目录
……省略部分
/dev/sdb1 /orc xfs defaults 0 0
[root@oracle ~]# mount -a     ##生效挂载
[root@oracle ~]# df -Th    ##查看挂载
Filesystem              Type      Size  Used Avail Use% Mounted on
……省略部分
tmpfs                   tmpfs     781M     0  781M   0% /run/user/0
/dev/sdb1               xfs        40G   33M   40G   1% /orc

2. Installation front environment

[root@oracle ~]# yum -y install \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc gcc-c++ \
glibc glibc-devel \
ksh \
libaio libaio-devel \
libgcc libstdc++ libstdc++-devel \
libXi libXtst \
make \
sysstat \
unixODBC unixODBC-devel

3. Adjust the kernel parameters

[root@oracle ~]# vim /etc/sysctl.conf   ##调整内核参数
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295  
kernel.shmmni = 4096kernel.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  
[root@oracle ~]# sysctl -p   ##生效内核参数
fs.aio-max-nr = 1048576   #异步IO请求数目 推荐值是:1048576 其实它等于 1024*1024 也就是 1024K 个
fs.file-max = 6815744   #打开的文件句柄的最大数量,防止文件描述符耗尽的问题
kernel.shmall = 2097152    #共享内存总量 页为单位,内存除以4K所得
kernel.shmmax = 4294967295  
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128  #SEMMSL: 每个信号集的最大信号数量 SEMMNS:用于控制整个 Linux 系统中信号的最大数 SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量 SEMMNI :内核参数用于控制整个 Linux 系统中信号集的最大数量
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.用户环境配置

4. User environment configuration

[root@oracle ~]# groupadd oinstall  ##创建oinstall组账号
[root@oracle ~]# groupadd dba   ##创建dba组账号
[root@oracle ~]# useradd -g oinstall -G dba oracle #将oracle和dba账号添加到oinstall组账号
[root@oracle ~]# passwd oracle    ##给Oracle用户设置密码
Changing password for user oracle.
New password: 
BAD PASSWORD: The password is shorter than 7 characters
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@oracle ~]# mkdir -p /orc/app/oracle
[root@oracle ~]# chown -R oracle:oinstall /orc/app/    ##改变属主和属组
[root@oracle ~]# chmod -R 755 /orc/app/oracle/     ##给与755权限
[root@oracle ~]# vim /home/oracle/.bash_profile  ##配置oracle用户环境配置
#PATH=$PATH:$HOME/.local/bin:$HOME/bin
#export PATH
umask 022     ##设置文件权限
ORACLE_BASE=/orc/app/oracle
ORACLE_HOME=/orc/app/oracle/product/12.2.0/dbhome_1/
ORACLE_SID=orcl
NLS_LANG="SIMPLIFIED CHINESE_CHINA".UTF8
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
LANG=zh_CN.UTF-8

export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SID

5. Oracle user resource limit

[root@oracle ~]# vim /etc/pam.d/login   ##利用pam模块认证
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
[root@oracle ~]# vim /etc/security/limits.conf
oracle        soft    nproc           2047        #单用户可使用的进程数量
oracle        hard    nproc           16384
oracle        soft    nofile          1024        #用户可打开的文件数量
oracle        hard    nofile          65536
oracle        soft    stack           10240       #堆栈设置
[root@oracle ~]# vim /etc/profile
if [ $USER = "oracle" ]
 then
   if [ $SHELL = "/bin/ksh" ]
     then
       ulimit -p 16384      #缓冲区大小
       ulimit -n 65536
   else
     ulimit -u 16384 -n 65536
   fi
fi
[root@oracle ~]# source /etc/profile

6. Switch to Linux virtual machine graphical interface operation

[root@oracle ~]# su - oracle
[root@oracle ~]# xhost +
[root@oracle abc]$ ls /home/abc/   ##查看软件包,放在abc目录下
linuxx64_12201_database.zip
[root@oracle abc]$ unzip linuxx64_12201_database.zip   ##解压缩Oracle软件包
[oracle@oracle abc]$ cd /home/abc/database/   ##进入解压后的database/目录
[oracle@oracle ~]$ export DISPLAY=:0.0   ##声明像素初始化
[oracle@oracle database]$ ls   ##查看目录下文件
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[oracle@oracle database]$ ./runInstaller    ##执行runInstaller脚本
正在启动 Oracle Universal Installer...

检查临时空间: 必须大于 500 MB。   实际为 167988 MB    通过
检查交换空间: 必须大于 150 MB。   实际为 16383 MB    通过
检查监视器: 监视器配置至少必须显示 256 种颜色
    >>> 无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了 DISPLAY 
……省略部分
是否继续? (y/n) [n] y
……省略部分               ##之后会弹出图形安装框

7. Jump out of the graphical installation

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

8. Execute the script generated by the installation (cut root user)

[root@oracle ~]# /orc/app/oraInventory/orainstRoot.sh   ##切root执行脚本
更改权限/orc/app/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/orc/app/oraInventory 到 oinstall.
脚本的执行已完成。
[root@oracle ]# /orc/app/oracle/product/12.2.0/dbhome_1/root.sh  ##执行第二个脚本
Performing root user operation.
……省略部分
Enter the full pathname of the local bin directory: [/usr/local/bin]:   ## 这里直接回车就好
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...
……省略部分
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] : 
yes    ##输入yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /orc/app/oracle/product/12.2.0/dbhome_1/install/root_oracle_2020-10-22_23-32-31-721996353.log   ##这里要等一会儿
Finished installing Oracle Trace File Analyzer (TFA)   ##提示完成

9. Continue the installation after the script is executed

Insert picture description here
Insert picture description here
Insert picture description here

10. Find the directory where you downloaded the rpm package and install it

[root@oracle Downloads]# find / -name flash-player-npapi-32.0.0.445*
/root/Downloads/flash-player-npapi-32.0.0.445-release.x86_64.rpm
/tmp/gnome-software-CU60S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm
/tmp/gnome-software-27A3S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm
[root@oracle Downloads]# rpm -ivh /tmp/gnome-software-CU60S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm
警告:/tmp/gnome-software-CU60S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm:V4 DSA/SHA1 Signature, 密钥 ID f6777c67: NOKEY
准备中...                          ################################# [100%]
	软件包 flash-plugin-32.0.0.445-release.x86_64 已经安装
[root@oracle Downloads]# rpm -ivh /tmp/gnome-software-27A3S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm
警告:/tmp/gnome-software-27A3S0/flash-player-npapi-32.0.0.445-release.x86_64.rpm:V4 DSA/SHA1 Signature, 密钥 ID f6777c67: NOKEY
准备中...                          ################################# [100%]
	软件包 flash-plugin-32.0.0.445-release.x86_64 已经安装
[root@oracle ~]# cd /root/Downloads/
[root@oracle Downloads]# rpm -ivh flash-player-npapi-32.0.0.445-release.x86_64.rpm 
警告:flash-player-npapi-32.0.0.445-release.x86_64.rpm:V4 DSA/SHA1 Signature, 密钥 ID f6777c67: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:flash-plugin-32.0.0.445-release  ################################# [100%]

NOTICE:
Files belonging to older Flash plugins have been removed from the filesystem.  For your safety these files have been saved in /root/oldflashplugins.tar.gz.  You may remove this tarball if these files are no longer required.

11. Web access to Oracle

Insert picture description here
Insert picture description here

12. Terminal access to Oracle

[oracle@oracle ~]$ lsnrctl 

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 23-10-2020 00:38:41

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

欢迎来到LSNRCTL, 请键入"help"以获得信息。

LSNRCTL> start
TNS-01106: 使用名称LISTENER的监听程序已经启动
LSNRCTL> quit
[oracle@oracle ~]$ netstat -anupt |grep 1521     ##1521Oracle端口监听状态
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::1521                 :::*                    LISTEN      22630/tnslsnr       
tcp6       0      0 fe80::b80f:265:a54:1521 fe80::b80f:265:a5:17536 ESTABLISHED 22630/tnslsnr       
tcp6       0      0 fe80::b80f:265:a5:17536 fe80::b80f:265:a54:1521 ESTABLISHED 25687/ora_lreg_orcl 
tcp6       0      0 fe80::b80f:265:a54:1521 fe80::b80f:265:a5:20294 TIME_WAIT   -                   

12. SID is in use error

Insert picture description here

Solution:
Comment out the information in the red box in the figure below
Insert picture description here

Guess you like

Origin blog.csdn.net/CN_LiTianpeng/article/details/109225037