oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
limits.conf 文件实际是前面提到的 pam_limits.so 的配置文件,而且只针对于单个会话, 需要在/etc/pam.d/login文件中加入下行:
session required /lib/security/pam_limits.so session required pam_limits.so
创建 Oracle 组和帐号
接下来我们要创建 Linux 的组和用户账号,用来安装和维护 Oracle 数据库。
# groupaddoinstall # groupadddba
# useradd -m -g oinstall -G dba oracle # id oracle
# passwd oracle (set password for oracle user) 现在可以用 Oracle 帐号登录继续后续的操作。
创建安装目录
现在我们来创建 Oracle 数据库的安装目录。 通常这些目录被在独立的文件系统上创建。
# mkdir -p /home/oracle/app/
# chown -R oracle:oinstall /home/oracle/app/ # chmod -R 775 /home/oracle/app/
之后把这些路径加入配置oracle用户的环境文件中。 # vim /home/oracle/.bash_profile 添加的内容如下
export ORACLE_SID=orcl
export ORACLE_BASE=/home/oracle/app export ORACLE_HOME=$ORACLE_BASE/dbhome export NLS_LANG=AMERICAN_AMERICA.UTF8 export
PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:$ORACLE_HOME/bin:
安装 Oracle
现在可以开始安装应用了,解开 Oracle 的源代码,并执
行 ./runInstaller。如果你按上述要求正确配置了系统参数,安装过程应该不会有太多问题。如果遇到错误的话,你可以查看安装的日志文件以获得详细的错误信息。在安装的过程中,系统会询问你 SYSMAN 的密码,请把它记下来,后续我们会用它来登录到 Web Console。
在安装接近尾声的时候,会要求你以 root 权限运行一到两个脚本,你只需要打开一个终端,运行 su – ,然后根据系统提示的路径去运行脚本。
启动或停止 Oracle
有时候你可能需要启动或者停止 Oracle 的运行,你可以运行下面的命令
emctl start dbconsole lsnrctl start dbstart
要停止 Oracle 数据库,则运行: emctl stop dbconsole lsnrctl stop dbstop
自动启动 Oracle 服务
每次输入命令行来启动或停止 Oracle 数据库总是不方便,最简单的办法还是在操作系统启动的时候自动启动 Oracle服务。具体办法如下:
1. 首先编辑 /etc/oratab 文件,将:
orcl:/home/oracle/app/dbhome:N
修改为:
orcl:/home/oracle/app/dbhome:Y
2. 创建启动脚本: vi /etc/init.d/dbora 其内容如下:
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script. #
# Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; #
# Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME.
ORA_HOME=/home/oracle/app/dbhome ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ] then
echo \exit fi