首页 技术 正文
技术 2022年11月20日
0 收藏 920 点赞 2,393 浏览 3958 个字

一、系统及安装包

操作系统:centos 7.4

oracle版本:oracle 11g r2

二、centos环境配置

安装数据库所需要的软件包

 [root@localhost data]# yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC*

创建运行oracle数据库的系统用户和用户组(root账户下创建)

[root@localhost]# groupadd oinstall  #创建用户组oinstall
[root@localhost]# groupadd dba  #创建用户组dba
[root@localhost]# useradd -g oinstall -g dba -d /data/oracle -m oracle  #创建oracle用户,并加入到oinstall和dba用户组
[root@localhost]# passwd oracle  #设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆
Changing password for user oracle.
New password:   # 密码
BAD PASSWORD: The password is shorter than characters
Retype new password:   # 确认密码
[root@localhost]# id oracle # 查看新建的oracle用户
uid=(oracle) gid=(dba) groups=(dba)

创建oracle数据库的安装目录

[root@localhost]# mkdir -p /data/oracle  #oracle数据库安装目录
[root@localhost]# mkdir -p /data/oraInventory  #oracle数据库配置文件目录
[root@localhost]# mkdir -p /data/database  #oracle数据库软件包解压目录

修改操作系统标识

[root@localhost data]# cat /etc/redhat-release
redhat-
# 修改主机名
[root@localhost data]# hostnamectl set-hostname redhat-

关闭防火墙和selinux

systemctl status firewalld.service    #查看防火墙状态(运行中)
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #禁止使用防火墙(重启也是禁止的) # 关闭selinux
sed -i.bak '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

修改内核参数

# 在/etc/sysctl.conf中加入vm.swappiness =
net.ipv4.tcp_tw_recycle =
net.ipv4.tcp_tw_reuse =
net.ipv4.tcp_syncookies =
net.ipv4.tcp_max_tw_buckets =
net.ipv4.tcp_keepalive_time =
net.ipv4.tcp_fin_timeout =
net.ipv4.tcp_max_orphans =
net.ipv4.tcp_max_syn_backlog =
net.ipv4.tcp_timestamps =
net.ipv4.ip_local_port_range =
net.core.somaxconn =
net.core.netdev_max_backlog =
net.core.rmem_default =
net.core.rmem_max =
net.core.wmem_default =
net.core.wmem_max =
kernel.shmall =
kernel.shmmax =
kernel.shmmni =
kernel.sem=
fs.file-max =
fs.aio-max-nr = 1048576#使配置修改内核的参数生效
sysctl -p

对oracle用户设置限制,提高软件运行性能

vi /etc/security/limits.conforacle soft nproc
oracle hard nproc
oracle soft nofile
oracle hard nofile End of file

配置用户的环境变量

vi /data/oracle/.bash_profile# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHexport ORACLE_BASE=/data/oracle #oracle数据库安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2./db_1 #oracle数据库路径
export ORACLE_SID=orcl #oracle启动数据库实例名
export ORACLE_UNQNAME=orcl
export ORACLE_TERM=xterm #xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系统环境变量
export LANG=C #防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致

使用户的环境变量生效

source /data/oracle/.bash_profile

三、安装oracle

将oracle安装包上传到/usr/local/src下

unzip linux.x64_11gR2_database_1of2.zip -d /data/database/
unzip linux.x64_11gR2_database_2of2.zip -d /data/database/

运行/data/database/database下的图形安装脚本,即可开始安装

[root@redhat- database]# ll
total
drwxr-xr-x oracle oinstall Aug doc
drwxr-xr-x oracle oinstall Aug install
drwxrwxr-x oracle oinstall Aug response
drwxr-xr-x oracle oinstall Aug rpm
-rwxr-xr-x oracle oinstall Aug runInstaller
drwxrwxr-x oracle oinstall Aug sshsetup
drwxr-xr-x oracle oinstall Aug stage
-rw-r--r-- oracle oinstall Aug welcome.html
[root@redhat- database]# ./runInstaller

四、oracle安装报错解决

大多数同学在第三步的时候,被各种报错整的焦头烂额。看了很多网上的教程,都是千篇一律,根本解决不了问题。是在木有办法,看了小布老师的oracle视频(他是参照oracle的官方文档进行教学的),完美解决了。

报错一:

报错信息:
Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed原因分析:
这个是由于图形化设置不当造成的,需要正确的执行xhost +以及设置DISPLAY参数步骤:
1.安装VNCSERVER(root用户)
yum install tigervnc-server -y
vncserver2.设置DISPLAY参数以及xhost +
这一步很重要。网上的教程几乎都是 export DISPLAY=db1.us.oracle.com:1,export DISPLAY=127.0.0.1:1,完全不行!真是耽误时间啊!!
export DISPLAY=xxxxx:1,这个"xxxxx"应该填的是Xmanager安装所在的服务器的网关。
----------------------------
假设你在虚拟机上安装oracle,虚拟机ip是192.168.1.100。而在自己的笔记本电脑上安装xmanager,ip是192.168.18.100(网关192.168.18.1)
那你就应该在虚拟机上这样设置:运行命令export DISPLAY=192.168.18.1:1。
----------------------------
再运行xhost +:
[oracle@localhost bin]$ xhost +
access control disabled, clients can connect from any host
提示access control disabled就说明可以了。提示:也许你按照这个步骤还是不行。这时候千万别灰心,一步一步排查,肯定可以的
下一篇: SQL高级教程
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,495
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,133
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,297