Oracle 11.1 在RedHat Linux 5.1 x86-64上的安装及配置

***Oracle 11.1 在RedHat Linux 5.1 x86-64上的安装:

3.检查硬件设备:
3.1内存:
*至少4G内存,grep MemTotal /proc/meminfo 命令可以看内存配置;
*交换区的大小
Available RAM            Swap Space Required
Between 4 GB and 8 GB    2 times the size of RAM
Between 8 GB and 32 GB   1.5 times the size of RAM
More than 32 GB          32 GB
grep SwapTotal /proc/meminfo
*查看内存大小:
free
*检查共享内存总量:
df -h /dev/shm/
3.2系统架构:
*检查系统能否安装软件:
uname -m
3.3 磁盘大小
*至少1G的/tmp 目录大小
df -h /tmp
*磁盘空间要求
Installation Type    Requirement for Software Files (GB)
Enterprise Edition   4.35
Standard Edition     3.73
Installation Type    Requirement for Data Files (GB)
Enterprise Edition   1.68
Standard Edition     1.48

4. 检查软件需求:
4.1 OS需求
■ Red Hat Enterprise Linux 4
■ Red Hat Enterprise Linux 5
检查OS命令:cat /proc/version
4.2内核要求:
Red Hat Enterprise Linux 4:  2.6.9 or later
Red Hat Enterprise Linux 5:  2.6.18 or later
查看内核命令:uname -r
4.3包要求:
■ Asianux 2, Oracle Enterprise Linux4, and Red Hat Enterprise Linux 4 的要求:
binutils-2.15.92.0.2
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.97
elfutils-libelf-devel-0.97
gcc-3.4.5
gcc-c++-3.4.5
glibc-2.3.4-2.19
glibc-2.3.4-2.19 (32 bit)
glibc-common-2.3.4
glibc-devel-2.3.4
glibc-devel-2.3.4 (32-bit)
libaio-0.3.105
libaio-0.3.105 (32 bit)
libaio-devel-0.3.105
libgcc-3.4.5
libgcc-3.4.5 (32-bit)
libstdc++-3.4.5
libstdc++-3.4.5 (32 bit)
libstdc++-devel-3.4.5
make-3.80
numactl-0.6.4.x86_64
sysstat-5.0.5
■ Asianux 3, Oracle Enterprise Linux5, and Red Hat Enterprise Linux 5 的要求:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
gcc-4.1.1
gcc-c++-4.1.1
glibc-2.5-12
glibc-2.5-12 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5-12 (32 bit)
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libgcc-4.1.1
libgcc-4.1.1 (32 bit)
libstdc++-4.1.1
libstdc++-4.1.1 (32 bit)
libstdc++-devel-4.1.1
make-3.81
numactl-devel-0.9.8.x86_64
sysstat-7.0.0
*查看包安装情况的命令:
rpm -q 包名
*安装缺失的包:
rpm -ivh 包名
4.4编译环境:
Intel C++ Compiler 9.1 -- gcc 4.1
4.5其他软件环境:
■ 在 Asianux 2, Oracle Enterprise Linux 4, and Red Hat Enterprise Linux 4 上装:
unixODBC-2.2.11 (32 bit) or later
unixODBC-devel-2.2.11 (64 bit) or later
■ 在 Asianux 3, Oracle Enterprise Linux 5, and Red Hat Enterprise Linux 5 上装:
unixODBC-2.2.11 (32 bit) or later
unixODBC-devel-2.2.11 (64 bit) or later
unixODBC-2.2.11 (64 bit) or later

5.创建oracle的用户和组:
*需要创建的用户组有:
■ The Oracle Inventory group (typically, oinstall)
■ The OSDBA group (dba)
■ The Oracle software owner (typically, oracle)
*判断这些用户是否存在:
    判断oinstall用户是否存在:more /etc/oraInst.loc
        如果该用户存在,会显示:
        inventory_loc=/u01/app/oraInventory
        inst_group=oinstall
    判断dba:grep dba /etc/group
    判断oracle用户:id oracle
        如果存在,则应显示:
        uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)
*如果可以,输入以下命令创建用户组:
    /usr/sbin/groupadd oinstall
    /usr/sbin/groupadd dba
    如果用户oracle不属于所期望的组,则输入命令:
        /usr/sbin/usermod -g oinstall -G dba oracle
    如果用户oracle不存在:则输入命令:
        /usr/sbin/useradd -g oinstall -G dba oracle
    输入命令以修改用户oracle密码:
        passwd oracle

6.配置核心参数:
*修改 /etc/sysctl.conf
fs.file-max = 65536
kernel.shmall = 2097152
kernel.shmmax = 2147483648
    shmmax Minimum of the following
        values:
        ■ Half the size of the physical memory
        ■ 4GB - 1 byte
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
    如果当前参数比这些参数还高,就没必要修改
*运行命令以更新修改:/sbin/sysctl -p
*运行以下命令检查参数:
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/sbin/sysctl -a | grep wmem_max

*为oracle用户设置shell极限参数:
    编辑/etc/security/limits.conf,添加如下行:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
*添加如下行到/etc/pam.d/login,如果它不存在:
session    required     /lib/security/pam_limits.so  //对64位系统这条不需要
session required pam_limits.so
*在/etc/profile文件中添加:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

7.创建需要的目录:
# mkdir -p /u01/app/
# chown -R oracle:oinstall /u01/app/
# chmod -R 775 /u01/app/

8.配置oracle环境:
*在/etc/profile文件中添加:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export DISPLAY=你的IP:0.0(如果是在本地安装,不要加IP,直接DISPLAY=:0.0就可以了)
*如果tmp文件夹空间太小:
    检查/tmp 空间命令:df -k /tmp
$ sudo mkdir /mount_point/tmp
$ sudo chmod a+wr /mount_point/tmp
#exit
    在/etc/profile 中添加:
$ TMP=/mount_point/tmp
$ TMPDIR=/mount_point/tmp
$ export TMP TMPDIR


*xhost +
10.安装Oracle:
*解压:
unzip linux_11gR1_database_1013.zip
*切换到oracle用户,进入“linux_11gR1_database_1013/database/”目录,执行
./runInstaller

以下制10.结尾,供Oracle新手安装参考,如果稍微了解oracle,可以选择高级安装,因为高级安装可以选择字符集,选择存储路径(/u01,/u02)等
————————————————————————————————————————————————————————————————————————————————————————————————————
Screen                              Recommended Action
————————————————————————————————————————————————————————————————————————————————————————————————————
Select a Product to Install This screen enables you to install any one for the following products:
                                    ■ Oracle Database 11g
                                    ■ Oracle Client
                                    ■ Oracle Clusterware
                                    Click Next.
————————————————————————————————————————————————————————————————————————————————————————————————————
Select Installation Method  The Basic Installation option is selected by default.
                                                        Specify the directory path of the Oracle home. Ensure that the
                                                        oinstall group is selected. If you want to create a starter database,
                                                        then specify a name and password for it. Then, click Next.
                                                        选择oinstall组,填写sys等的密码:XXX
————————————————————————————————————————————————————————————————————————————————————————————————————
Specify Inventory Directory
and Credentials
                                                        This screen is displayed only during the first installation of Oracle
                                                        products on a system.
                                                        Specify the full path of the Oracle Inventory directory. Ensure that
                                                        the operating system group selected is oinstall. Then, click
                                                        Next.
————————————————————————————————————————————————————————————————————————————————————————————————————
Product-Specific Prerequisite
Checks
                                                        Verify that all of the prerequisite checks succeed, and then click
                                                        Next.
                                                        Oracle Universal Installer checks the system to verify that it is configured
                                                        correctly to run Oracle software. If you have completed all
                                                        of the preinstallation steps in this guide, all of the checks should
                                                        pass.
                                                        If a check fails, then review the cause of the failure listed for that
                                                        check on the screen. If possible, rectify the problem and rerun the
                                                        check. Alternatively, if you are satisfied that your system meets the
                                                        requirements, then you can select the check
————————————————————————————————————————————————————————————————————————————————————————————————————
Oracle Configuration Manager
                                                        Enter the Customer Identification Number, Metalink User Name,
                                                        Country code, and Click Next. The new screen prompts you to
                                                        accept the license agreement. Click Accept license Agreement to
                                                        accept the agreement.
                                                        If you decline this agreement, then Oracle Configuration Manager
                                                        is installed but not configured.
                                                        跳过
————————————————————————————————————————————————————————————————————————————————————————————————————
Summary                                         Review the information displayed on this screen, and then click
                                                        Install.
————————————————————————————————————————————————————————————————————————————————————————————————————
Install                                         This screen displays status information while the product is
                                                        installed.
————————————————————————————————————————————————————————————————————————————————————————————————————
Configuration Assistants         This screen displays status information for the configuration assistants
                                                        that configure the software and create a database. When the
                                                        message is displayed at the end of this process, click OK to continue.
————————————————————————————————————————————————————————————————————————————————————————————————————
Execute Configuration
Scripts
                                                        When prompted, read the instructions and then run the scripts
                                                        mentioned on this screen. Click OK to continue.
                                                        默认参数, 回车
————————————————————————————————————————————————————————————————————————————————————————————————————
End of Installation                 The configuration assistants configure several Web-based applications,
                                                        including Oracle Enterprise Manager Database Control. This
                                                        screen displays the URLs configured for these applications. Make a
                                                        note of the URLs used. The port numbers used in these URLs are
                                                        also recorded in the following file:
                                                        oracle_home/install/portlist.ini
                                                        To exit from Oracle Universal Installer, click Exit and then click Yes.
                                                       
————————————————————————————————————————————————————————————————————————————————————————————————————
11.安装后需要配置
*修改/home/oracle/.bash_profile配置
ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_HOME
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export PATH
*防火墙,放行端口1521
#path: /etc/sysconfig/iptables
#help: iptables --help | more
#execute command below:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
/etc/rc.d/init.d/iptables save

12.监听配置文件:
/u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora
/u01/app/oracle/product/11.1.0/db_1/network/admin/tnsnames.ora

listener.ora 在文件夹 Oracle_home/network/admin 下
内容:
————————————————————————————————————————————————————————————————————————————————————————————————————
LISTENER
监听名字
————————————————————————————————————————————————————————————————————————————————————————————————————
监听协议和地址:
(DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=my-server) (PORT=1521)))
————————————————————————————————————————————————————————————————————————————————————————————————————
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl11)
      (ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
      (SID_NAME = orcl)
    )
   )
静态监听,必须放在LISTEN之前
————————————————————————————————————————————————————————————————————————————————————————————————————
示例:
# listener.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/listen
er.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
      (SID_NAME = orcl)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.30.8.125)(PORT = 1521))
       (CONNECT_DATA =
         (SERVICE_NAME = ORCL)
       )
    )
  )
————————————————————————————————————————————————————————————————————————————————————————————————————
示例:
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/tnsnam
es.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.30.8.125)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
————————————————————————————————————————————————————————————————————————————————————————————————————


***ORACLE 修改服务器端和客户端字符集:
**服务器端:
*检查字符集:
select * from v$nls_parameters
NLS_CHARACTERSET 表示数据库字符集;
NLS_NCHAR_CHARACTERSET是国家字符集
*修改字符集:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8//跳过字符集父集检查
ALTER DATABASE national CHARACTER SET INTERNAL AL32UTF8
这一行不起作用,执行后出错ORA-00933: SQL 命令未正确结束,不过执行上一行命令已经生效,其他文章里未提到本行。
SHUTDOWN IMMEDIATE;
STARTUP

修改dmp文件字符集
  上文说过,dmp文件的第2第3字节记录了字符集信息,因此直接修改dmp文件的第2第3字节的内容就可以‘骗’过oracle的检查。这样做理论上也仅是从子集到超集可以修改,但很多情况下在没有子集和超集关系的情况下也可以修改,我们常用的一些字符集,如 US7ASCII,WE8ISO8859P1,ZHS16CGB231280,ZHS16GBK基本都可以改。因为改的只是dmp文件,所以影响不大。
具体的修改方法比较多,最简单的就是直接用UltraEdit修改dmp文件的第2和第3个字节。比如想将dmp文件的字符集改为ZHS16GBK,可以用以下SQL查出该种字符集对应的16进制代码:
SQL> select to_char(nls_charset_id('ZHS16GBK'), 'xxxx') from dual;
0354
然后将dmp文件的2、3字节修改为0354即可。
如果dmp文件很大,用ue无法打开,就需要用程序的方法了。网上有人用java存储过程写了转换的程序(用java存储过程的好处是通用性教好,缺点是比较麻烦)。我在windows下测试通过。但要求oracle数据库一定要安装JVM选项。有兴趣的朋友可以研究一下程序代码

**客户端修改字符集:
设定环境变量。在My Computer->Properties->Advanced->Environment Variables->System Variables 新增环境变量设置,
如:Variable name=NLS_LANG,Variable Value= SIMPLIFIED CHINESE_CHINA.AL32UTF8。
这样NLS_LANG字符集为UTF8,这个NLS_LANG优先序高于注册表中的NLS。注意:环境变量设在系统变量中(System Vairables),而不是用户变量(User Vairables)。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值