linux下安装oracle11g

来源:互联网 发布:货车找活都用什么软件 编辑:程序博客网 时间:2024/06/05 10:19

这篇博客参考http://www.cnblogs.com/gaojun/archive/2012/11/22/2783257.html,大家可以参考它和我这篇来细细体会,我这篇算是它的Bug修复。

新建oracle用户,必须是名字叫oracle,规定,

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle(主组oinstall,其它组:dba)
passwd oracle //设置密码

修改/etc/sysctl.conf,添加

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586

执行下面命令使上面配置立即生效

/sbin/sysctl -p

修改/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

/etc/pam.d/login加上

session required pam_limits.so

/etc/profile 加

if[ USER=oracle];thenif[SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

export ORACLE_BASE=/u01
export ORACLE_HOME=ORACLEBASE/oracleexportORACLESID=oracleSidexportPATH=ORACLE_HOME/bin:PATH:HOME/bin

执行:source ./profile 可以立即生效

配置安装目录:(这个目录一定要归属于oracle这个用户,在安装时可能会使用其他的目录,都要将目录chown到oracle这个用户上)

mkdir -p /u01/oraInventory
chown -R oracle:oinstall /u01/
chmod -R 775 /u01/

登录oracle用户(下面命令需要sudo权限,sudoers添加oracle用户,并且orale本身的path变量要能够使用unzip命令)

sudo unzip linux_11gR1_database.zip

运行:

$ ./runInstaller

oracle界面显示出来了,一步步安装

安装的目录不要重复并且目录都是oracle这个用户所有的

如果安装过程中出现了错误:Error in invoking target ‘install’ of makefile。。。。。。。

选择跳过(continue)即可,并且安装yum install glibc 就可以

yum 安装出现http://mirrors.163.com/centos/6.5/os/i386/Packages/mlocate-0.22.2-4.el6.i686.rpm: [Errno 14] PYCURL ERROR 6 - “Couldn’t resolve host ‘mirrors.163.com‘“Trying other mirror.这类信息的话:

修改/etc/resolv.conf,加上;

nameserver 8.8.8.8

完成!

接下来重启系统后,进行数据库的启动(登录到oracle用户)

lsnrctl start启动,如果报错:Message 1070 not found; No message file for product=network, facility=TNSTNS-12546: Message 12546 not found; No message file for product=network, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
TNS-00516: Message 516 not found; No message file for product=network, facility=TNS类似的信息,就重新进行source /etc/profile的环境变量重置,是oracle_home找不到导致的找不到listener文件

接着登录oracle

sqlplus /nolog

conn sys/admin as sysdba

starttup

可能会报错:
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora’

不要着急,将 $ ORACLE_BASE/admin/ $ ORACLE_SID/pfile目录下的init.ora.0312013174228形式的文件(名字形式一样,不是名字完全一样)copy到报错目录下,并重新命名为报错的文件名即可。
这个文件名是:initorcl(orcl是你的oracle实例也就是sid名,并且要与oracle_sid这个环境变量配置的sid名一致)

原创粉丝点击