鞋垫

导航

 

Oracle 11.2.0.4linux 6.5上的安装

目录

一、准备工作... 1

二、安装库软件... 5

三、配置监听... 19

四、建库... 24

五、验证安装... 41

六、后续工作... 43

 

 

 

一、准备工作

1. 安装操作系统Oracle Linux 6.5,建议只分/boot、/swap、/ 三个分区。

 

2. 检查ip配置

[root@localhost ~]# ifconfig | grep Bcast

          inet addr:192.168.1.8  Bcast:192.168.100.255  Mask:255.255.255.0

 

3. 配置主机名

[root@localhost ~]# hostname db01.lg.net

[root@localhost ~]# vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=db01.lg.net

 

4. 配置hosts信息

[root@ localhost ~]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.8 db01 db01.lg.net

这里涉及的域名已提前做了域名解析。

 

5. 安装必要的包

①配置yum

[root@ ~]# mount -o loop OracleLinux-R6-U1-Server-x86_64-dvd.iso /mnt

或把操作系统光盘内容拷到/root/ol6_1

 

[root@ ~]# vi /etc/yum.repos.d/yum.repo

[ol6-debuginfo]

name=Enterprise Linux

baseurl=file:///mnt/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[root@ ~]# yum clean all

Loaded plugins: rhnplugin, security

Cleaning up Everything

 

②检查哪些包没安装

for i in binutils compat-gcc-34 compat-libstdc++-296 control-center \

  gcc gcc-c++ glibc glibc-common glibc-devel libaio libgcc elfutils-libelf-devel \

  libstdc++ libstdc++-devel libXp make openmotif22 setarch compat-libcap1\

  compat-libstdc++-33 libaio-devel sysstat unixODBC unixODBC-devel ksh

do

  rpm -q $i &>/dev/null || F="$F $i"

done ;echo $F;unset F

 

[root@ ~]# for i in binutils compat-gcc-34 compat-libstdc++-296 control-center \

>   gcc gcc-c++ glibc glibc-common glibc-devel libaio libgcc \

>   libstdc++ libstdc++-devel libXp make openmotif22 setarch \

>   compat-libstdc++-33 libaio-devel sysstat unixODBC unixODBC-devel

> do

>   rpm -q $i &>/dev/null || F="$F $i"

> done ;echo $F;unset F

compat-gcc-34 compat-libstdc++-296 libXp openmotif22 setarch compat-libstdc++-33 libaio-devel unixODBC unixODBC-devel

 

③使用yum 安装这些包

[root@ ~]# yum install -y compat-gcc-34 compat-libstdc++-296 libXp openmotif22 setarch compat-libstdc++-33 libaio-devel unixODBC unixODBC-devel

 

6. 修改内核参数

vi /etc/sysctl.conf 到末尾

用#注释掉kernel.shmmax和kernel.shmall开头的两行

添加如下:

kernel.shmmax = 4398046511104

kernel.shmall = 1073741824

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

fs.aio-max-nr = 1048576

fs.file-max = 6815744

vm.swappiness=10

 

以上参数为使用oracle 验证包自动配置的参数结果,vm.swappiness=10为减少使用SWAP,该值默认是60

 

重新加载生效:

[root@db01 ~]# sysctl -p

 

7. 修改的oracle用户限制

vi /etc/security/limits.conf 末尾添加:

oracle   soft   nofile   2047

oracle   hard   nofile   65536

oracle   soft   nproc    2047

oracle   hard   nproc    16384

oracle   soft   stack    10240

oracle   hard   stack    32768

 

8. 修改的/etc/pam.d/login

vi /etc/pam.d/login 末尾添加:

session    required     pam_limits.so

 

9. 关闭的防火墙和selinux

[root@ ~]#

service iptables stop

chkconfig iptables off

service ip6tables stop

chkconfig ip6tables off

setenforce 0

getenforce

vi /etc/selinux/config 确保以下内容

SELINUX=disabled

[root@ ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#       enforcing - SELinux security policy is enforced.

#       permissive - SELinux prints warnings instead of enforcing.

#       disabled - SELinux is fully disabled.

SELINUX=disabled

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted network daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted

 

10. 更改ulimit 设置

vi /etc/profile 末尾添加:

if [ /$USER = "oracle" ]; then

    if [ /$SHELL = "/bin/ksh" ]; then

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

    umask 022

fi

 

11. 建立组和用户

[root@ ~]#

groupadd -g 501 oinstall

groupadd -g 502 dba

 

useradd -u 501 -g oinstall -G dba  oracle

passwd oracle

 

12. 建立安装目录

[root@ ~]#

mkdir /u01/oracle/db -p

chmod 775 /u01 –R

chown oracle:oinstall /u01 -R

 

13. 设置oracle用户的环境变量

su - oracle

vi .bash_profile 末尾添加:

export ORACLE_BASE=/u01/oracle

export ORACLE_HOME=/u01/oracle/db

export ORACLE_SID=crmdb

export PATH=$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

#export NLS_LANG=AMERICAN_AMERICA.UTF8

export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"

export ORACLE_UNQNAME=crmdb

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'

alias dgmgrl='rlwrap dgmgrl'

 

14. 安装用到的其他包

使用Xmanager的xftp上传rlwrap-0.36-1.8.x86_64.rpm和ttfonts-zh_CN-2.14-6.noarch.rpm –nodeps到/root目录下

[root@db01 ~]#

rpm -ivh rlwrap-0.36-1.8.x86_64.rpm

rpm -ivh ttfonts-zh_CN-2.14-6.noarch.rpm –nodeps

rlwrap用于sqlplus下命令翻页,ttfonts-zh_CN为中文字体

 

15. 增大shm(用11g自动内存管理的话,需要配置这个)

[root@db01 ~]# mount -o remount,size=16G /dev/shm

[root@db01 ~]# vi /etc/rc.d/rc.local

添加一行mount -o remount,size=32G /dev/shm

16g为服务器物理内存的大小

 

 

 

二、安装库软件

以下步骤均在自己电脑上执行

1. 使用Xmanager的xftp上传Oracle安装包到/home/oracle目录下

 

2. 授于安装包可执行权限:[oracle@db01 ~]$ chmod u+x database/ -R

 

,登录linux的图形界面,使用root新建终端,执行xhost +

新建终端,在oracle用户下,找到oracle安装包下的runInstaller,执行 ./runInstaller

3. 准备安装

打开自己电脑Xmanager的Passive,即打开

 

在shell工具的终端中执行以下

[oracle@db01 ~]$ export DISPLAY=10.1.1.15:0.0

10.1.1.15为自己电脑的ip

 

4.开始安装

[oracle@biee ~]$ cd database/

[oracle@biee database]$ ls

install      response  runInstaller  stage readme.html  rpm       sshsetup      welcome.html

[oracle@biee database]$ ./runInstaller

自己电脑中会弹出安装窗口,开始安装

 

 

 

 

 

 

 

 

 

 

 

 

 

新开终端窗口中执行以上两个脚本

[root@db01 u01]# /u01/oraInventory/orainstRoot.sh

更改权限/u01/oraInventory.

添加组的读取和写入权限。

删除全局的读取, 写入和执行权限。

 

更改组名/u01/oraInventory 到 oinstall.

脚本的执行已完成。

[root@db01 u01]# /u01/oracle/db/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/oracle/db

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

 

 

 

 

 

三、配置监听

在刚才安装oralce库软件的终端中执行netca建默认监听

 

 

 

 

 

 

 

 

 

 

 

四、建库

在刚才创建监听的终端中执行dbca建库

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

五、验证安装

1. 查看库状态

[oracle@db01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期五 9月 26 21:27:30 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> select status from v$instance;

STATUS

------------------------------------

OPEN

 

2. 查看em是否可登录

 

 

 

 

 

 

六、后续工作

以下操作均使用sys用户执行

1. 关闭11g的一些新特性

alter system set audit_trail=none scope=spfile;    --关审计

alter system set deferred_segment_creation=false;   --禁用段延迟建立

alter profile default limit failed_login_attempts unlimited;  --禁用密码五次失败后禁用账号

alter profile default limit password_life_time unlimited;  --解除密码180天有效期限制

alter system set sec_case_sensitive_logon=false;  --禁用密码区分大小写

 

2. 增大或修改一些参数值

alter system set open_cursors=3000;

alter system set processes=5000 scope=spfile;

alter system set sessions=7552 scope=spfile;  --7552为processes=5000的系统设定值,processes为3000时sessions为4544

alter system set archive_lag_target=1800;  --30分钟一归档(可不设)

 

3. 如果要让v$sessions中的client_info记录客户端ip,可以在数据库sys中创建一个追踪客户端ip地址的触发器

create or replace trigger tr_logon_info

after logon on database

begin

dbms_application_info.set_client_info(sys_context('userenv','ip_address')||'--'||sys_context('userenv','os_user'));

end;

/

 

4.添加表空间

建立crm数据表空间:

create tablespace crmtbs datafile '/u01/oracle/oradata/crmdb/crmtbs01.dbf' size 5g autoextend on next 50m maxsize unlimited;

 

为crm数据表空间添加数据文件:

alter tablespace crmtbs add datafile '/u01/oracle/oradata/crmdb/crmtbs02.dbf' size 5g autoextend on next 50m maxsize unlimited;

 

建立compiere数据表空间:

create tablespace compieretbs datafile '/u01/oracle/oradata/crmdb/compieretbs01.dbf' size 5g autoextend on next 50m maxsize unlimited;

 

建立crm索引表空间:

create tablespace crmidxtbs datafile '/u01/oracle/oradata/crmdb/crmidxtbs01.dbf' size 1g autoextend on next 50m maxsize unlimited;

 

为crm索引表空间添加数据文件:

alter tablespace crmidxtbs add datafile '/u01/oracle/oradata/crmdb/crmidxtbs02.dbf' size 1g autoextend on next 50m maxsize unlimited;

 

建立compiere索引表空间:

create tablespace compiereidxtbs datafile '/u01/oracle/oradata/crmdb/compiereidxtbs01.dbf' size 1g autoextend on next 50m maxsize unlimited;

 

建立cti数据表空间:

create tablespace ctitbs datafile '/u01/oracle/oradata/crmdb/ctitbs01.dbf' size 1g autoextend on next 50m maxsize unlimited;

 

建立应用系统临时表空间:

create temporary tablespace crmtbs_temp01 tempfile '/u01/oracle/oradata/crmdb/crmtbs_temp01.dbf' size 1g autoextend on next 50m maxsize unlimited;

create temporary tablespace crmtbs_temp02 tempfile '/u01/oracle/oradata/crmdb/crmtbs_temp02.dbf' size 1g autoextend on next 50m maxsize unlimited;

create temporary tablespace crmtbs_temp03 tempfile '/u01/oracle/oradata/crmdb/crmtbs_temp03.dbf' size 1g autoextend on next 50m maxsize unlimited;

 

把三个临时表空间加入临时表空间组:

alter tablespace crmtbs_temp01 tablespace group crmtbs_temp;

alter tablespace crmtbs_temp02 tablespace group crmtbs_temp;

alter tablespace crmtbs_temp03 tablespace group crmtbs_temp;

 

 

5. 添加系统用户并授权

建立系统用户:

create user compiere identified by 密码 default tablespace compieretbs temporary tablespace crmtbs_temp;

create user crm identified by 密码 default tablespace crmtbs temporary tablespace crmtbs_temp;

create user cti identified by 密码 default tablespace ctitbs temporary tablespace crmtbs_temp;

 

检查新建用户默认的表空间和临时表空间:

select username,default_tablespace,temporary_tablespace from dba_users where username in ('CRM', 'COMPIERE', 'CTI');

 

 

授予新建用户权限:

grant dba to cti;

grant select any dictionary to cti;

--如果不需要对权限控制的非常细,授予这两个权限给新建用户即可。

 

--以下是对crm和compiere的权限进行严格控制

grant connect to crm;

grant create any table to crm;

grant create database link to crm;

grant create procedure to crm;

grant create sequence to crm;

grant create synonym to crm;

grant create trigger to crm;

grant create view to crm;

grant debug any procedure to crm;

grant debug connect session to crm;

grant delete any table to crm;

grant execute any procedure to crm;

grant insert any table to crm;

grant select any dictionary to crm;

grant select any sequence to crm;

grant select any table to crm;

grant unlimited tablespace to crm;

grant update any table to crm;

grant create any type to crm;

 

grant connect to compiere;

grant create any table to compiere;

grant create procedure to compiere;

grant create sequence to compiere;

grant create synonym to compiere;

grant create trigger to compiere;

grant create view to compiere;

grant debug any procedure to compiere;

grant debug connect session to compiere;

grant delete any table to compiere;

grant execute any procedure to compiere;

grant insert any table to compiere;

grant select any sequence to compiere;

grant select any table to compiere;

grant unlimited tablespace to compiere;

grant update any table to compiere;

grant create any type to compiere;

grant create database link to compiere;

 

 

 

=======================================================================

最后注意以上由于没有配静态监听,启动数据库时,先启动监听,后启动库,如下:

1.启动监听

[oracle@biee ~]$ lsnrctl start

 

2.启动库: 

[oracle@db01 ~]$ sqlplus / as sysdba

SQL> startup

 

 

关库命令(关库可不用关监听):

SQL> shut immediate

 

posted on 2014-11-12 11:11  鞋垫  阅读(284)  评论(0)    收藏  举报