在Linux下安装Oracle
我的安装环境:
Redhat Enterprise linux 5.4版本
硬件要求:
内存要求:
Oracle Database官方指定最少512M(后面会警告)建议1GB
磁盘空间要求:
Swap交换分区为1.5GB
/tmp目录中的磁盘空间为400MB
Oracle软件需要1.5GB
Database 需要1.5GB
预配置的数据库需要1.2GB(可选)
快速恢复去需要2.4GB(可选)
操作系统:
具有1GB以上RAM和1.5GB交换空间或者更高配置的计算机上可以实现标准安装
安装过程:
1. Login as root
2. Oracle的安装需要在图形化界面安装
3. 打开Xwindows,允许所有主机显示本主机上的X windows
[root@node1 ~]# xhost + ======è oracle模拟远程用户在本机安装,这步必须执行。
access control disabled, clients can connect from any host
4. 检查系统要求
物理内存最少为1G
[root@node1 ~]# grep MemTotal /proc/meminfo
Swap分区建议为1.5G以上
[root@node1 ~]# grep SwapTotal /proc/meminfo
/tmp分区建议大于400M
[root@node1 ~]# df -lh /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vol0-root
37G 5.7G 29G 17% /
查看cpu是否符合安装Oracle
Note:
This command displays the processor type. Verify that the processor architecture matches the Oracle software release that you want to install. If you do not see the expected output, then you cannot install the software on this system.
[root@node1 ~]# grep "model name" /proc/cpuinfo
model name : Intel(R) Core(TM)2 Duo CPU T6570 @ 2.10GHz
5.检查所需软件包是否安装齐全
我们的内核版本应该为4.0或者更新的,但是不能太新了,否则下面实验时会报错,我们可以将自己的内核版本稍为改改(我这里将5.4给为4.4),骗骗系统,呵呵
[root@node1 ~]# vim /etc/issue
[root@node1 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 4.4 (Tikanga)
Kernel \r on an \m
RH033
我们需要确保系统已经安装过以下软件包:
Red Hat Enterprise Linux 4.0:
Gmake-3.80-5 gcc-3.4.3-22.1 gcc-ppc32-3.4.3-22.1 gcc-c++-3.4.3-22.1 gcc-c++-ppc32-3.4.3-22.1 glibc-2.3.4-2.9 glibc-2.3.4-29 (64-Bit) libgcc-3.4.3-9.EL4 libgcc-3.4.3-9.EL4.ppc64.rp libstdc++-3.4.3-9.EL4 libstdc++-devel-3.4.3-9.EL4 libaio-0.3.103-3 libaio-0.3.103-3 (64-Bit) libaio-devel-0.3.103-3 (64-Bit) compat-libstdc++-33-3.2.3-47.3 binutils-2.15.92.0.2-13 我的系统是32位的,这里我只安装32位的,大家根据自己系统的情况自己选择注意:
以上的包都是官方4.0系统安装Oracle需要安装的包,我们不能照着他的来,我们需要使用rpm -q package-name 一个一个查看以上的包是否已安装,呵呵,需要点耐心啊!做学问嘛,就是这样,同志们别急啊!经我测试,我的系统已经全部安装,大家,别偷懒啊,一个一个慢慢测试下,不然,后面会有×××烦找你的!
6.配置 Name Resolution
[root@ song ~]# cat /etc/nsswitch.conf | grep hosts ======输出如下为正确
#hosts: db files nisplus nis dns
hosts: files dns
[root@ song ~]# domainname =====输出必须如下,一字不差为正确
(none)
[root@ song ~]#vim /etc/sysconfig/network
[root@ song ~]#vim /etc/hosts
[root@ song ~]# hostname
song.example.com
格式类似即可,但/etc/hosts 中的名字和/etc/sysconfig/network中名字一定要是一样的
7.创建用户oracle,附加组dba,oper ,oinstall组
属主是oracle
# /usr/sbin/useradd -g oinstall -G dba,oper oracle # passwd oracle # /usr/sbin/groupadd dba # /usr/sbin/groupadd oinstall # /usr/sbin/groupadd oper # id oracle uid=505(oracle) gid=505(oracle) groups=505(oracle),509(dba),510(oper)
我们可以用一下命令来检测
8.编辑/etc/sysctl.conf文件,添加编辑如下
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[root@node1 oracle]# sysctl -p
9.设置shell limits for oracle user #vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 #Vim /etc/pam.d/login 添加 session required /lib/security/pam_limits.so #vim /etc/profile file 添加 if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
设置oracle用户的环境变量如下:
[oracle@song ~]# su – oracle
[oracle@song ~]$ vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/u01/app/oracle/product/10.2.0/db_1/bin
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_HOME
echo PATH
10.创建oracle挂载安装目录,并修改其权限: # mkdir -p /u01/app/oracle/oradata # chown -R oracle:oinstall /u01/app/oracle/oradata # chmod -R 775 /u01/app/oracle/oradata 11.下在oracle软件包,并解压缩 [root@song oracle]# ls 10201_database_linux32.zip [root@song oracle]# unzip 10201_database_linux32.zip [root@song oracle]# ls 10201_database_linux32.zip database [root@song oracle]# unzip 10201_database_linux32.zip 12.安装oracle实例 [root@song database]# su - oracle [oracle@song ~]$ ls 10201_database_linux32.zip database [oracle@song ~]$ cd database/ [oracle@song database]$ ls doc install response runInstaller stage welcome.html [oracle@song database]$ ./runInstaller 出现以下图,我们作如下选择[root@song db_1]# pwd
/u01/app/oracle/product/10.2.0/db_1
[root@song db_1]# ./root.sh
[root@song db_1]#cd /home/oracle/oralnventory/orainstRoot.sh
[root@song db_1]#./orainstRoot.sh
用以下命令开启配置数据库服务器图形化界面
[oracle@song ~]$ emctl start
[oracle@song ~]$ dbca
记着如图的地址,要用
在地址栏中填写刚才的地址,出现如下画面
正确的登录画面如下及表示创建成功
问题总结
1.在使用emctl 和dbca命令时出现没有命令:
解决方法:重新检查环境变量的设置
2.
可能是以下问题:
I. 无LISTERNER
a)[oracle@song ~]$netca =======è创建一个LISTENER
II. 监听器未启动
b) [oracle@song ~]$lsnrctl start
III.. 侦听器未启动
c) [oracle@song ~]$emctl start dbconsole
IV.数据库未打开
d)[oracle@song ~]$sqlsplus / as sysdba
sql>show sya;
sql>alter database mount;
sql>alter database open;
V.主机名解析问题
e) [oracle@song ~]$vim /etc/hosts
开启 127.0.0.1 localhost 这行
3.
[oracle@song config]$ pwd
/u01/app/oracle/product/10.2.0/db_1/sysman/config
[oracle@song config]$ vim emd.properties =======追加以下内容
agentTZRegion=Asia/Shanghai
其他的问题咱是还没有遇到,等遇到了再贴出来。