准备工作
10.2.01 database安装
操作系统 --> RHEL 6(稳定,干净的操作系统)
软件安装包 10.2.01 database安装包
root用户操作:
换源:
[root@Oracle /u01]# vim /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
1.关闭防火墙和selinux
service iptables stop
chkconfig iptables off
service ip6tables stop
chkconfig ip6tables off
2.设置主机名并修改/etc/hosts,设置主机名和IP的对应关系,因为oracle在安装的过程中需要解析主机名,如果主机名等于IP才能正常安装。否在会报错ORA-00600报错
3.安装oracle依赖的软件包
yum install -y binutils-* compat-libstdc++-33-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libgcc-* libstdc++-* make-* sysstat-* unixODBC-* unixODBC-devel-*
4、创建oracle用户uid为1000、dba组gid为1000,oracle用户主属组为dba
groupadd -g 1000 dba
useradd -u 1000 -g dba oracle
5、创建/u01,设置属主、属组为oracle:dba,权限为755
mkdir -p /u01/app/oracle/product/10.2/db_1
/u01/app/oracle/product/10.2/db_1 --> 官方建议的oracle database 软件安装路径
database 软件会被安装到 db_1 目录中
安装oracle database 软件 管理 database 软件 --> oracle 用户操作
chown -R oracle.dba /u01/
chmod -R 755 /u01/
6.、依次修改下面文件
- /etc/sysctl.conf
[root@Oracle /u01]# cat /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
#添加此部分根据oracle官方要求修改内核参数(可参考官方文档41页)
kernel.shmall = 2097152 #为什么这个参数和上面文件的参数相同,因为这个参数是针对红帽3-4系统的,写这个参数的意思是
,只要值比这个值大就行,谁大谁生效。
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
sysctl -p 使上面的修改生效,其实就是打印参数,如果我们写进去的值大,按大的值生效。
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
----------------------------------------------
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
----------------------------------------------
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
上面的报错,是因为以上3个参数依赖于bridge模块,该模块如果没有加载则会现上面的输出错误
解决办法:
# modprobe bridge
# sysctl -p
- /etc/security/limits.conf 用户登录生效(参考官方文档43页)
oracle soft nproc 2047 给oracle用户的nproc的项目上设置了软的限制 值是2047,nproc是最大进程数
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
为了提高Linux系统上软件的性能,您必须增加oracle用户的以下shell限制:
#Each line describes a limit for a user in the form:
#
# -
#
#Where:
# can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
# can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#- can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - rtprio - max realtime priority
soft和hard区别:
soft只会提示,但是还能开。
hard才是最大值。
注意:此限制只对oracle用户作用。
以上1-6步骤,需要root用户来做,接下来操作可以用oracle用户操作。
oracle用户操作:
- 新开一个窗口
[root@Oracle ~]# su - oracle 登陆到oracle用户
[oracle@Oracle ~]$ ll
total 0
oracle 用户需要声明环境变量用于安装database 软件
- 建议在oracle用户下的家目录修改环境变量,这样只对oracle生效,不建议在/etc/profile下写
~/.bash_profile
# /u01/app/oracle/product/10.2/db_1 #database的安装路径
export ORACLE_BASE=/u01/app/oracle #OUI会调用这些变量
解析:ORACLE_BASE这个变量在甲骨文公司软件安装路径,但是软件很多,所以定义了这个目录,意思是甲骨文的软件都在此目录下安装
export ORACLE_HOME=$ORACLE_BASE/product/10.2/db_1
解析:oracle软件的安装路径
export PATH=$PATH:$ORACLE_HOME/bin
解析:/u01/app/oracle/product/10.2/db_1是安装路径,在db_1下面有个bin目录,存放这个软件所有命令,因为保证找到命令,
所以增加此变量。比如,操作sqlplus命令,他会在bin目录下面找此命令
配置完source刷新下
\3. 上传文件并解压
正常情况,我们上传文件一般存放在/tmp下或/usr/local/src,如果上传到/tmp下,root和oracle用户都有写权限,但是/usr/local/src目录只能root用户上传。自己选择。
还有一点注意:因为oracle用户是由root用户切换过来的,所以,当我们上传文件,其实属主和属组还是root用户,所以,如果需要oracle用户,我们需要shell重新登陆。此时我们为oracle用户设置密码,重新登陆
[root@Oracle /u01]# passwd oracle
密码为:oracle
上传软件10201_database_linux_x86_64.cpio.gz 到 /tmp
解压1:gunzip 10201_database_linux_x86_64.cpio.gz
解压2:cpio -dicmv < 10201_database_linux_x86_64.cpio
解压完的结果就是有了database目录
\4. 准备安装
使用oracle用户 进入database目录运行安装器
yum install glibc.i686 libXp.i686 libXt.i686 libXtst.i686 glibc-devel glibc-devel.i686 libgcc libgcc.i686
./runInstaller -ignoresysprereqs
报错整理:
[oracle@Oracle database]$ ./runInstaller -help
./runInstaller: /tmp/database/install/.oui: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解决办法:root权限下
yum install -y ld-linux.so.2
参考连接:https://www.cnblogs.com/songyuejie/p/6372534.html
解决办法:
1.安装xmanager软件
rpm -ivh xorg-x11-apps-7.7-6.el6.x86_64.rpm
rpm -ivh xterm-253-1.el6.x86_64.rpm
在Linux下安装Oracle数据库时,需要用到图形化界面。可以使用xclock命令测试,是否能正常显示图形化安装界面。
xclock不能显示时钟
1. vncserver
如果报错 command not found,则
a.yum install tigervnc-server
b.然后再设置密码
c.执行 vncserver
2.根据vncserver执行的结果执行以下操作
a.export DISPLAY=10.0.0.1:0.0 #这边注意要设置windows主机地址
b.echo $DISPLAY
c.xhost +
d.xclock
3.如果执行xclock报错,command not found,则
yum install xorg-x11-apps
3
解决方法: yum -y install libXp.so.6
解决方法:
yum -y install https://mirrors.aliyun.com/centos/6/os/i386/Packages/libICE-1.0.6-1.el6.i686.rpm
yum -y install https://mirrors.aliyun.com/centos/6/os/i386/Packages/libuuid-2.17.2-12.28.el6_9.2.i686.rpm
yum -y install libXt.so.6
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
据网上资料说这是由于yum安装了旧版本的GPG keys造成的。
解决办法就是运行以下命令:
rpm --import /etc/pki/rpm-gpg/RPM*
解决办法: yum -y install libXtst.so.6
总结:注意事项
关键的第一步:设置DISPLAY环境变量为登陆机器的IP地址(注意这里你本机windows的IP地址,即你的xmanager的安装主机,我本机的IP是10.10.11.16);
# export DISPLAY=10.10.11.16:0.0
# echo $DISPLAY
10.10.11.16:0.0
关键的二步:在oracle用户再一次设置DISPLAY环境变量为登陆机器的IP地址;
如果不操作这一步骤,su到oracle用户后这个环境变量可能会丢失——郁闷之所在。
$ export DISPLAY=10.10.11.16:0.0
$ echo $DISPLAY
10.10.11.16:0.0
第三步:Xmananger需要设置,如上图