创建oracle用户
[root@localhost heming]# groupadd oinstall
//创建用户组oinstall
[root@localhost heming]# groupadd dba
//创建用户组dba
[root@localhost heming]# useradd -g oinstall -g dba -m oracle
//创建oracle用户,并加入到oinstall和dba用户组
[root@localhost heming]# passwd oracle
//设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆
Changing password for user oracle.
New password:
密码
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
确认密码
passwd: all authentication tokens updated successfully.
[root@localhost heming]# id oracle
查看新建的oracle用户
uid=1001(oracle) gid=1002(dba) groups=1002(dba)
6.创建oracle数据库安装目录(也可以于/usr目录下直接新建文件夹)
[root@localhost heming]# mkdir -p /usr/oracle
oracle数据库安装目录
[root@localhost heming]# mkdir -p /usr/oraInventory
oracle数据库配置文件目录
[root@localhost heming]# mkdir -p /usr/database
oracle数据库软件包解压目录
[root@localhost heming]# cd /usr
[root@localhost usr]# ls
创建完毕检查一下
database oracle oraInventory
7.设置用户权限
[root@localhost usr]# chown -R oracle:oinstall /usr/oracle
设置目录所有者为oinstall用户组的oracle用户
[root@localhost usr]# chown -R oracle:oinstall /usr/oraInventory
[root@localhost usr]# chown -R oracle:oinstall /usr/database
8.修改OS系统标识(修改文件 /etc/RedHat-release )
chown -R oracle:oinstall /usr/oradata
//查看系统标识
<pre style="text-align:justify;text-justify:inter-ideograph;
background:#FAFAFC;border:none;mso-border-alt:solid windowtext .5pt;padding:
0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt">[root@localhost heming]# cat /proc/version </pre>
<pre style="text-align:justify;text-justify:inter-ideograph;background:#FAFAFC">Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015</pre>
<pre style="text-align:justify;text-justify:
inter-ideograph;background:#FAFAFC">[root@localhost heming]# cat /etc/redhat-release </pre>
<pre style="text-align:justify;text-justify:inter-ideograph;background:#FAFAFC">CentOS Linux release 7.2.1511 (Core) </pre>
<pre style="text-align:
justify;text-justify:inter-ideograph;background:#FAFAFC">//****修改OS系统标识</pre>
<pre style="text-align:justify;text-justify:inter-ideograph;
background:#FAFAFC;border:none;mso-border-alt:solid windowtext .5pt;padding:
0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt">[root@localhost heming]# vi /etc/redhat-release</pre>
<pre style="text-align:justify;text-justify:inter-ideograph;background:#FAFAFC">进入到编辑模式,点击键盘上的“insert”按钮,再将第一行替换为redhat-7,按Esc按钮,输入:wq,注意这里有一个冒号,再回车,保存并退出. </pre>
<pre style="text-align:justify;text-justify:inter-ideograph;
background:#FAFAFC;border:none;mso-border-alt:solid windowtext .5pt;padding:
0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt">[root@localhost heming]# cat /etc/redhat-release </pre>
9.关闭防火墙
关闭防火墙:systemctl stop firewalld.service
禁止使用防火墙:systemctl disable firewalld.service
<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"><v:formulas></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path></v:stroke></v:shapetype><v:shape id="图片_x0020_16" o:spid="_x0000_i1028" type="#_x0000_t75" alt="说明: " style="width:284.25pt;height:71.25pt;visibility:visible;
mso-wrap-style:square"><v:imagedata src="file:///C:\Users\Administrator\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" o:title=""></v:imagedata></v:shape>
10.关闭selinux
进入编辑状态:
[root@localhost heming]#vi /etc/selinux/config
将SELINUX的值改为disabled,保存并退出。
<v:shape id="图片_x0020_93" o:spid="_x0000_i1027" type="#_x0000_t75" style="width:415.5pt;height:133.5pt;visibility:visible;
mso-wrap-style:square"><v:imagedata src="file:///C:\Users\Administrator\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" o:title=""></v:imagedata></v:shape>
11.修改内核参数
进入编辑状态:
[root@localhost heming]# vi /etc/sysctl.conf
在最后添加如下代码:
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
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 = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576
按ESC,再输入:wq保存并退出。
使配置参数立即生效:sysctl -p
<v:shape id="图片_x0020_94" o:spid="_x0000_i1026" type="#_x0000_t75" style="width:414.75pt;height:284.25pt;visibility:visible;
mso-wrap-style:square"><v:imagedata src="file:///C:\Users\Administrator\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title=""></v:imagedata></v:shape>
12.对oracle用户设置限制,提高软件运行性能
进入编辑状态:
[root@localhost heming]#vi /etc/security/limits.conf
找到最后一行# End of file,在它上面空行处添加如下代码:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
按ESC,再输入:wq保存并退出。
<v:shape id="图片_x0020_95" o:spid="_x0000_i1025" type="#_x0000_t75" style="width:415.5pt;height:277.5pt;visibility:visible;mso-wrap-style:square"><v:imagedata src="file:///C:\Users\Administrator\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png" o:title=""></v:imagedata></v:shape>
13.配置用户的环境变量
进入编辑状态:
[root@localhost heming]#vi /home/oracle/.bash_profile
在最后添加如下代码:
export ORACLE_BASE=/usr/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export PATH=PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export LANG=C
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_UNQNAME=$ORACLE_SID
其中:
ORACLE_BASE 为oracle数据库安装目录
ORACLE_SID为oracle启动数据库实例名
:wq保存并退出。
使上述配置立即生效:
[root@localhost heming]#source /home/oracle/.bash_profile