您好,欢迎访问一九零五行业门户网

Linux下安装配置Oracle

1环境准备 1.1.linux系统安装 版本 rhas4:redhat enterprise linux advance server 4.0 1.2.检查环境 hard disk space [ro
1环境准备1.1.linux系统安装
  版本
rhas4:redhat enterprise linux advance server 4.0
1.2.检查环境  hard disk space
[root@localhost  /]#df –h
 (目标安装目录) >2 g +1g(软件包源目录)
 /tmp >400m
  mem>1g,swap>1g
[root@localhost  /]#cat /proc/meminfo|grep total
  依赖软件版本
名称   最低版本  查询命令
kernel   2.6.9            #uname –a或 uname -r
glibc    2.3.2.95.27       #rpm -q glibc
gcc     3.2             #rpm -q gcc
make    3.79            #rpm -q make
binutils  2.14            #rpm -q binutils
libaio    0.3            #rpm -q libaio
openmotif  2.2.2-16      #rpm -q openmotif
setarch   1.3-1          #rpm -q setarch
1.3.检查并配置内核参数  检查当前参数
/sbin/sysctl -a | grep 参数名
  配置内核参数
1)    执行 [root@localhost  /]#vi /etc/sysctl.conf 添加如下内容
kernel.shmall = 2097152   # os范围内共享内存的最大页面数量, 单位4k, 默认2097152
kernel.shmmax = 536870912   # os范围内每个共享内存段的最大尺寸. 单位byte,默认32m
kernel.shmmni = 4096        #os范围内共享内存段的最大数目,默认值4096
kernel.sem = 250 32000 100 128  #信号量参数
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_defaut=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
   2) 生效[root@localhost  /]# /sbin/sysctl -p
1.4.创建oracle组及用户  创建用户组oinstall,dba
创建安装数据库时所需要使用的用户组oinstall,dba
       [root@localhost  /]#groupadd oinstall
       [root@localhost  /]#groupadd dba
  创建用户oracle
创建用户oracle并将oinstamll,dba组定义成oracle用户的主次组
              [root@localhost  /]# useradd -g oinstall -g dba oracle (设定oracle用户为oinstall、dba用户组的成员)
              [root@localhost  /]#passwd oracle (设定oracle用户的密码)
  设置shell限制(可选)
(oracle建议对每个linux帐户可以使用的进程数和打开的文件数设置限制)
1)执行[root@localhost  /]#vi /etc/security/limits.conf添加以下四行
oracle soft nofile 65536
                            oracle hard nofile 65536
                            oracle soft nproc 16384
                            oracle hard nproc 16384
2)修改安全限制,执行[root@localhost  /]# vi /etc/pam.d/login加入如下1行
session required /lib/security/pam_limits.so
1.5.配置相关目录  创建oracle系统的安装目录和数据库文件存放的目录
[root@localhost  /]# mkdir -p /oracle/product/ 10.2.0 (创建数据目录)
[root@localhost  /]# mkdir -p /oracle/oradata(创建数据文件目录)
[root@localhost  /]# mkdir -p /oracle/flash_recovery_area(创建闪回目录)
[root@localhost  /]# mkdir -p /oracle/arc_pstat(创建归档日志目录)
[root@localhost  /]# mkdir -p /home/oracle/install_temp(创建oracle安装文件临时存放目录
[root@localhost  /]# chown -r oracle.oinstall  /home/oracle/install_temp
[root@localhost  /]# chown -r oracle.oinstall /oracle
[root@localhost  /]# chmod -r 775 /oracle (设定目录的读写权限)
1.6.配置环境变量  确定oracle_sid
确定oracle_sid=oracletest       #后续安装后创建数据库时的服务名也保持一致,
  以oracle用户登录,修改oracle用户下的 .bash_profile 文件,完成后重启或或执行soure .bash_profile(. .bash_profile)或重登录生效
[oracle@localhost ~]$ vi  /home/oracle/.bash_profile增加以下内容
umask 022
oracle_base=/oracle; export oracle_base
oracle_home=$oracle_base/product/10.2.0; export oracle_home
#图形界面安装时要使用的变量
oracle_term=xterm; export oracle_term
oracle_owner=oracle; export oracle_owner
path=/usr/sbin:$path; export path
path=$oracle_home/bin:$path; export path
ld_library_path=$oracle_home/lib:/lib:/usr/lib; export ld_library_path
tmp=/tmp; export tmp
tmpdir=$tmp; export tmpdir
oracle_sid= oracletest
export oracle_sid
退出后查看path source /home/oracle/.bash_profile
[oracle@localhost ~]$ set|grep path
2安装oracle1.1.oracle安装文件准备  版本
oracle10g01_10.2.0.1.0_database_linux32
  文件准备
1)拷贝oracle10g01_10.2.0.1.0_database_linux32.zip
到目录/home/oracle/install_temp/下
2)解压:
unzip oracle10g01_10.2.0.1.0_database_linux32.zip
1.2.安装  1.1开始
[oracle@localhost ~]$cd /home/oracle/install_temp/
[oracle@localhost ~]$cd  database
[oracle@localhost ~]$ ./runinstaller   #开始执行安装,等待一会出现
1.1后续安装与window上基本一致(略)
后续安装与windows上基本一致,,最后完成后出现如下图,切换用户到root下执行下两个配置脚本即可:
执行[root@localhost  /]#/oracle/orainventory/orainroot.sh
执行[root@localhost /]#/oracle/product/10.2.0/root.sh如下所示,输入/oracle/product/ 10.2.0/bin/
3配置oracle1.1.创建数据库oracletest  执行[oracle@localhost ~]$dbca或图形菜单进行,注意下面一致即可(sys/oracletest)
1.2.配置监听,tns[oracle@localhost ~]$netca或图形菜单
最终  listener.ora
sid_list_listener =
  (sid_list =
    (sid_desc =
      (global_dbname = oracletest)
      (oracle_home = /oracle/product/10.2.0/)
      (sid_name = oracletest)
    )
  )
listener =
  (description_list =
    (description =
      (address = (protocol = tcp)(host = localhost)(port = 1521))
    )
  )
tnsnames.ora
oracletest =
  (description =
    (address_list =
      (address = (protocol = tcp)(host = localhost)(port = 1521))
    )
    (connect_data =
      (service_name = oracletest)
    )
  )
1.3.em[oracle@localhost ~]$ emctl start| stop| status dbconsole
:1158/em
1.4.isqlplus[oracle@localhost ~]$ isqlplusctl startstart| stop| status
:5560/isqlplus
1.5.配置自动启动配置机器启动时自动启动数据库,监听与em管理平台
停止时自动停止数据库,监听与em管理平台
  修改oracle系统配置文件/etc/oratab,把auto域由默认的n设置为y,使oracle 自带的dbstart和dbshut才能够发挥作用
[root@localhost  /]#vi /etc/oratab
  创建启动脚本
1)[oracle@localhost ~] vi $oracle_home/bin/dbstart  找到第78行oracle_home_listner=…
改为oracle_home_listner=$oracle_home,
[oracle@localhost ~]cd $oracle_home/bin/
手动运行 [oracle@localhost ~] ./ dbstart
[oracle@localhost ~] ./ dbshut
测试正常与否
(日志:$oracle_home/startup.log与$oracle_home/shutdown.log)
2) [root@localhost  /]#vi /etc/init.d/oracle10g
#!/bin/sh
       # description: oracle auto start-stop script.
       # chkconfig: - 20 80
       # 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=/oracle/product/10.2.0/
       ora_owner=oracle
       if [ ! -f $ora_home/bin/dbstart ]
       then
       echo oracle startup: cannot start
       exit
       fi
       case $1 in
       'start')
       # start the oracle databases:
       # the following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ora_owner -c $ora_home/bin/dbstart
       #su - $ora_owner -c $ora_home/bin/lsnrctl start
       su - $ora_owner -c $ora_home/bin/emctl start dbconsole
       ;;
       'stop')
       # stop the oracle databases:
       # the following command assumes that the oracle login
       # will not prompt the user for any values
       su - $ora_owner -c $ora_home/bin/emctl stop dbconsole
       su - $ora_owner -c $ora_home/bin/lsnrctl stop
       su - $ora_owner -c $ora_home/bin/dbshut
       ;;
       'restart')
       $0 stop
       $0 start
       ;;
       esac
3) [root@localhost ~]# chmod 750 /etc/init.d/oracle10g
[root@localhost ~]# ln -s /etc/init.d/oracle10g  /etc/rc0.d/k10oracle10g
[root@localhost ~]#ln -s /etc/init.d/oracle10g  /etc/rc3.d/s99oracle10g
  [root@localhost ~]# chkconfig --list oracle10g
[root@localhost ~]# chkconfig --level 345 oracle10g on 
  [root@localhost ~]# chkconfig --list oracle10g
其它类似信息

推荐信息