ORACLE数据库在Linux下配置与安装
1. 解压安装文件
chmod –R 777 database
2. 修改 /etc/hosts
地址 主机名 localhost
192.168.1.210 db210 localhost
3. 设置内核参数/etc/sysctl.conf
# This is Oracle 10g ConfigurationParameters by thinkpig007
# 可以使用的共享内存的总量
kernel.shmall= 2097152
# 最大共享内存段大小2G=2147483648
kernel.shmmax= 6442450944
# 整个系统共享内存段的最大数目
kernel.shmmni= 4096
# 每个信号对象集,系统范围内,每个信号对象支持,系统范围内最大信号对象集数
kernel.sem= 5010 641280 5010 128
# 系统中所允许的文件句柄最大数目
fs.file-max= 65536
# 应用程序可使用的IPv4端口范围
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
执行生效/sbin/sysctl -p
4. 编辑/etc/security/limits.conf 添加
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
5. 编辑/etc/pam.d/login 添加
session required pam_limits.so
6. 修改/etc/selinux/config文件
SELINUX=disabled
7.插入Redhat Linux系统盘,进入Server文件夹
# rpm -Uvh setarch-2*
# rpm -Uvh make-3*
# rpm -Uvh glibc-2*
# rpm -Uvh libaio-0*
# rpm -Uvh compat-libstdc++-33-3*
# rpm -Uvh compat-gcc-34-3*
# rpm -Uvh compat-gcc-34-c++-3*
# rpm -Uvh gcc-4* # rpm -UvhlibXp-1*
# rpm -Uvh openmotif-2*
# rpm -Uvh compat-db-4*
8. 创建组和用户
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -g oinstall -G dbaoracle
# passwd oracle
设置新密码
9. 创建安装文件夹
# mkdir -p /opt/oracle/10.2.1
# chown -R oracle.oinstall /opt
10. 以root用户登录,执行以下命令: xhost +IP
# xhost +192.168.1.210
11. 修改版/etc/redhat-release # Red HatEnterprise Linux Server release 5.3 (Tikanga)
Red Hat Enterprise Linux Serverrelease 4 (Tikanga)
12. 编辑/home/oracle/.bash_profile
# This is Oracle 10gConfiguration Parameters by thinkpig007
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/10.2.1/
export ORACLE_SID=ORCL
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
exportPATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
exportCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
13. 退出系统使用linux系统root登录
14. 进入根目录下我们之前解压好的database文件夹下,执行以下命令:
./opt/database/runInstaller
15. 数据库安装完后,界面会提示你用root用户登录,运行两个脚本。你就去那两个文件夹里把它们运行了
16. 最后,改回系统版本,编辑/etc/redhat-release。
17. 退出命令行,重新用oracle进入,用sqlplus/nolog登录
18. 启动oracle数据
(1) 进入oracle数据库
#su -oracle
密码是:oracle1
(2)开启监听
$lsnrctlstart
(3)登录数据库
$sqlplus/nolog
连接数据库
>connect/as sysdba
启动数据库
>startup
如下:
[oracle@DB11 ~]$ lsnrctl start
LSNRCTL for Linux: Version10.2.0.1.0 - Production on 23-JUN-2014 11:06:50
Copyright (c) 1991, 2005,Oracle. All rights reserved.
Starting/opt/oracle/10.2.1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version10.2.0.1.0 - Production
System parameter file is/opt/oracle/10.2.1/network/admin/listener.ora
Log messages written to/opt/oracle/10.2.1/network/log/listener.log
Listening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB11)(PORT=1521)))
Listening on:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DB11)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version10.2.0.1.0 - Production
Start Date 23-JUN-2014 11:06:50
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/10.2.1/network/admin/listener.ora
Listener Log File /opt/oracle/10.2.1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB11)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc"has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) forthis service...
The command completedsuccessfully
[oracle@DB11 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 -Production on Mon Jun 23 11:07:01 2014
Copyright (c) 1982, 2005,Oracle. All rights reserved.
SQL> con /as sysdba
SP2-0734: unknown commandbeginning "con /as sy..." - rest of line ignored.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area2.0200E+10 bytes
Fixed Size 2056712 bytes
Variable Size 2415922680 bytes
Database Buffers 1.7767E+10 bytes
Redo Buffers 14716928 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and DataMining options