搭环境 CentOS+Oracle

来源:互联网 发布:100base-tx传输端口 编辑:程序博客网 时间:2024/05/05 04:26

搭环境  CentOS+Oracle  

 

CentOS  不用多说   跟一般的操作系统一样      一路NEXT就可以

 

Oracle 才是重点

 

No.1  检查安装包

 

rpm -q binutils compat-db compat-libstdc++ control-center gcc gcc-c++ glibc glibc-common libgnome libstdc++ libstdc++-devel make ksh sysstat gnome-screensaver setarch libXp

 

返回

 

package binutils-2.17.50.0.6-6.el5 is not installed
package compat-db-4.2.52-5.1 is not installed
package compat-libstdc++-33-3.2.3-61 is not installed
control-center-2.16.0-16.el5
package gcc-4.1.2-42.el5 is not installed
package gcc-c++-4.1.2-42.el5 is not installed
package glibc-2.5-24 is not installed
package glibc-common-2.5-24 is not installed
libgnome-2.16.0-6.el5
package libstdc++-4.1.2-42.el5 is not installed
package libstdc++-devel-4.1.2-42.el5 is not installed
make-3.81-3.el5
package ksh-20060214-1.7 is not installed
package sysstat-7.0.2-1.el5 is not installed
gnome-screensaver-2.16.1-8.el5
setarch-2.0-1.1
package libXp-1.0.0-8.1.el5 is not installed

安装所有  not installed

 

No.2    将镜像放到虚拟机

 

#mkdir /mnt/cd

#mount /dev/cdrom   /mnt/cd

 

No.3    修改内核


修改/etc/sysctl.conf文件,增加如下内容:
# vi /etc/sysctl.conf

... ...
kernel.shmall = 2097152

kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
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
# chkconfig /etc/sysctl.conf
 
修改/etc/security/limits.conf(设置最大打开文件数),增加如下内容:
# vi /etc/security/limits.conf

... ...
oracle soft nproc 2047
oracle hard nproc 16384

oracle soft nofile 1024
oracle hard nofile 65536
  
修改/etc/pam.d/login文件,增加如下内容:
# vi /etc/pam.d/login

... ...  
session required /lib/security/pam_limits.so
session required pam_limits.so
     
修改vi /etc/profile文件,增加如下内容:
# vi /etc/profile

... ...
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
       ulimit -p 16384
       ulimit -n 65536

      else
       limit -u 16384 -n 65536
      fi
fi 
   
No.4   用户设置、配置 


添加oinstall 和dba用户组 
# groupadd -g 501 oinstall
# groupadd -g 502 dba
添加oracle用户
# useradd -g oinstall -G dba -u 501 -d /oracle oracle
修改/oracle权限

# chown -R oracle:oinstall /oracle
使用oracle用户登录,修改.profile文件
# su – oracle
$ pwd
/oracle
$ vi ./.profile
# !/usr/bin/bash
    umask 022
ORACLE_BASE=/oracle/app
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
创建相应的目录
$ pwd
/oracle
$ mkdir app
$ mkdir data

 

No.5   中文安装Oracle

 

新建/usr/share/fonts/zh_CN/TrueType/目录,把msyh.ttf(微软雅黑)拷贝过去,重命名为 zysong.ttf。操作系统桌面切换回中文。

重新双击runInstaller,终于,熟悉的中文界面出来了。随后运行dbca,企业管理器,都支持中文

 

No.6   EM中文化

 

我们只要用合适的中文字符集文件替换缺省文件即可,我选择使用font.properties.zh_CN.Redhat来替换缺省字体定义文件:

 

[oracle@danaly lib]$ cp font.properties.zh_CN.Redhat font.properties

 

替换之后需要清理一下Cache,重启EM即可.

 

Cache路径通常位于:

$ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs

 

清除所有gif文件即可.然后重新启动EM:
/opt/oracle/product/10.2.0/danaly.hurrray.com.cn_danaly/sysman/log

 

 

No.7   启动Oracle命令

 

1.su oracle 

2.sqlplus /nolog 

3.connect / as sysdba(test/test是oracle用户和密码) 

4.startup 

5. lsnrctl start   

6.emctl start dbconsole

 

No.8   sqlplus下常用命令

  增加数据库用户:(test11/test)
  create user test11 identified by test default tablespace users Temporary TABLESPACE Temp;

 

  用户授权:
  grant connect,resource,dba to test11;
  grant sysdba to test11;
  commit;

 

  更改数据库用户的密码:(将sys与system的密码改为test。)
  alter user sys indentified by test;
      alter user system indentified by test;