在CentOS上安装和配置Oracle 10数据库的详细教程

准备工作

  • 1.1 下载Oracle 10的安装包,可从Oracle官网下载;
  • 1.2 准备一台CentOS服务器,安装CentOS 7.x系统;
  • 1.3 将Oracle 10的安装包上传到CentOS服务器上。

安装Oracle 10

  • 2.1 安装必要的依赖库:
    yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
  • 2.2 创建Oracle用户:
    useradd -d /home/oracle -m oracle
  • 2.3 修改Oracle用户的环境变量:
    echo "export ORACLE_BASE=/opt/oracle" >> /home/oracle/.bashrc
    echo "export ORACLE_HOME=/opt/oracle/product/10.2.0/db_1" >> /home/oracle/.bashrc
    echo "export ORACLE_SID=orcl" >> /home/oracle/.bashrc
    echo "export PATH=$PATH:$ORACLE_HOME/bin" >> /home/oracle/.bashrc
    echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib" >> /home/oracle/.bashrc
    source /home/oracle/.bashrc
  • 2.4 修改系统参数:
    echo "kernel.shmmax=4294967296" >> /etc/sysctl.conf
    echo "kernel.shmall=2097152" >> /etc/sysctl.conf
    echo "kernel.shmmni=4096" >> /etc/sysctl.conf
    echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf
    echo "fs.file-max=65536" >> /etc/sysctl.conf
    echo "net.ipv4.ip_local_port_range=1024 65000" >> /etc/sysctl.conf
    sysctl -p
  • 2.5 创建Oracle安装目录:
    mkdir /opt/oracle
    chown -R oracle:oracle /opt/oracle
  • 2.6 安装Oracle 10:
    su - oracle
    unzip 10201_database_linux_x86_64.zip
    cd database
    ./runInstaller

配置Oracle 10

  • 3.1 创建数据库:
    su - oracle
    dbca
  • 3.2 修改listener.ora文件:
    vi $ORACLE_HOME/network/admin/listener.ora
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = orcl)
          (ORACLE_HOME = /opt/oracle/product/10.2.0/db_1)
        )
      )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )
    
    ADR_BASE_LISTENER = /opt/oracle
  • 3.3 启动listener:
    lsnrctl start
  • 3.4 修改tnsnames.ora文件:
    vi $ORACLE_HOME/network/admin/tnsnames.ora
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )
  • 3.5 设置Oracle开机自启动:
    vi /etc/oratab
    orcl:/opt/oracle/product/10.2.0/db_1:Y


本文链接:http://task.lmcjl.com/news/1513.html

展开阅读全文