一、oracle安装操作:
1、安装包到oracle官网下载:https://login.oracle.com/mysso/signon.jsp
2、数据库安装
安装前准备:
a.首先检查系统安装时候swap分配了150M以上没有(正常设置为内存的两倍):free命令
b.计算机重命名(需要远程登录数据库时,除配置此设置,listener.ora文件需要将“localhost”改为ip地址):
①运行vi /etc/sysconfig/network
HOSTNAME=yyerp(假设使用此计算机名);
②运行hostname yyerp;
③运行vi /etc/hosts
把localhost.localdomain全部改为yyerp(注意有数字的部分不用修改)
末尾添加一行10.2.0.83 yyerp(ip 计算机名)
执行:reboot(重启电脑)或service networkrestart。
安装步骤:
1. 创建用户和组
2. groupaddoinstall #创建用户组oinstall
3. groupadd dba #创建用户组dba
4. useradd -g oinstall -G dba -m oracle #创建用户oracle,并加入oinstall 和dba 组
passwdoracle #设置用户oracle 的登录密码,根据提示输入两次密码
5. 创建oracle 安装目录
mkdir -p/oracle/oraInventory #oracle 数据库配置目录
6. 设置目录所有者
7. chown -R oracle:oinstall /oracle #设置目录所有者为oinstall 用户组的oracle 用户(此步在解压后做)
chown -R oracle:oinstall /oracle/oraInventory
(chown -R oracle:oinstall /home/oracle/ 假如安装目录是home时如下权限添加-变量也需改)
8. 修改系统标识
vim /etc/redhat-release #编辑
把
CentOS Linux release 7.0.1406 (Core)
修改为
#CentOS Linux release 7.0.1406 (Core)
Red Hat Enterprise Linux 6
9. 修改系统内核
vim /etc/sysctl.conf #编辑,在最后添加以下代码
net.ipv4.icmp_echo_ignore_broadcasts = 1
fs.file-max = 6815744 #设置最大打开文件数
fs.aio-max-nr = 1048576
kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024,默认系统自带,shall=shmmax/page_size
kernel.shmmax = 2147483648 #最大共享内存的段大小 ,默认系统自带,两套SGA就得设为135291609088(内存的90%左右)
kernel.shmmni = 4096 #整个系统共享内存端的最大数
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4 端口范围
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
10.oracle 用户限制,提高软件运行性能
vim /etc/security/limits.conf #在末尾添加以下代码
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
11. 配置oracle 用户环境变量
vim /home/oracle/.bash_profile #在最后添加以下代码
export ORACLE_BASE= /oracle #oracle 数据库安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle数据库路径
export ORACLE_SID=orcl #oracle 启动数据库实例名
export ORACLE_UNQNAME=$ORACLE_SID
export PATH=$ORACLE_HOME/bin:/user/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH #添加系统环境变量
export ORACLE_TERM=xterm #xterm窗口模式安装(后加)
source /home/oracle/.bash_profile #使设置立刻生效
12. 安装oracle 数据库需要的软件包
yum -y install gcc gcc-c++ make binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-commonglibc-devel libaio libaio-devel libgcclibstdc++ libstdc++-devel unixODBC unixODBC-devel
13. 进入拷贝目录(拷贝用FX工具),解压oracle 下载的两个文件
14. unzip linux.x64_11gR2_database_1of2.zip -d /oracle
unzip linux.x64_11gR2_database_2of2.zip -d /oracle
15.关闭selinux(需重启生效)
[root@localhost /]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux securitypolicy is enforced.
# permissive - SELinux printswarnings instead of enforcing.
# disabled - No SELinux policy isloaded.
SELINUX=disabled #此处修改为disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes areprotected,
# minimum - Modification oftargeted policy. Only selected processes are protected.
# mls - Multi Level Securityprotection.
SELINUXTYPE=targeted
[root@localhost /]#
为啥要关闭selinux?因为selinux太高深,非专业人士搞不懂~~
16. 重启下系统 以oracle 的身份登录系统
为防止乱码,运行
export LANG=en_US
(用oracle账户运行)
17.桌面安装:
cd /oracle/database
./runInstaller
(如果为远程操作时,需要安装VNC,另见VNC安装操作说明)
18. 运行oracle 安装程序(先用root运行xhost +SI:localuser:oracle)
./runInstaller
如果出现以下错误:
解决办法如下(使用root账户运行下xhost +SI:localuser:oracle):
Steps to resolve this issue:
1) login into root user( su -l root)
2) execute this command : xhost +SI:localuser:oracle
3) login to the oracle user
4) execute ./runInstaller
注:重新运行./runIstaller都要做此步操作
19.取消默认选择,点击next
20.点击 yes
21、点击next
22.选择server Class 点击next
23.点击next
24.选择Advanced install 点击next
25.添加简体中文,点击next
26.点击next(本图路径按系统环境变量自动生成为准,实际出现路径以用户安装偏好显示)
27.之前已经设置好环境变量了,这里会自动填充路径(组应为oinstall,包括下一个),点击next
28.(/ oraInventory前添加/oracle)确认使用已创建的文件夹 ,点击next
29.点击yes
30.点击next
31.点击next(一般默认,可跟进实际改动,例如yyorcl)
32.配置字符集(AL32UTF8),点击next
33.点击next
34.点击next
35.选择备份, 点击next
36.选择统一设置密码,点击next
37.点击yes
38.点击next(第一个组应为dba,第二个组应为oinstall)
39.选择Ignore all ,next
40.点击Finish
41. 进入安装过程
42. 提示安装gcc(已安装),安装到68%的时候会有如下提示,直接点击continu
43.点击ok (安装过程10分钟)
44.
45. 打开命令行窗口
su
输入root帐号密码,运行
/oracle/oraInventory/orainstRoot.sh
/oracle/product/11.2.0/db_1/root.sh
#一直回车
46. 点击ok
安装完成 点击close
47. 把系统标识修改回来
vim /etc/redhat-release #编辑
把
#CentOS Linux release 7.0.1406 (Core)
Red Hat Enterprise Linux 6
修改为:
CentOS Linux release 7.0.1406 (Core)
#安装出现:
Could not execute auto check for display colors usingcommand
解决方法:
[oracle@localhost Packages]# xhost +
xhost: unable to open display"192.168.56.144:0.0"
[oracle@localhost Packages]# export DISPLAY=:0.0
[oracle@localhost Packages]# xhost +
access control disabled, clients can connect from any host
[oracle@localhost Packages]# xclock
3、安装后,防火墙配置1521端口为允许状态,并重启防火墙:
# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8899 -jACCEPT下面增加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -jACCEPT
# service iptables restart