Oracle.DataBase.Server.11g.R2.For.CentOS.7.1.INSTALL

来源:互联网 发布:怎样分享淘宝宝贝 编辑:程序博客网 时间:2024/06/05 17:57

 

 

 

 部署环境要求 1

                                                                                            

 

硬件要求:

1、处理器:Intel XeonE系列

2、内存:8GB及以上

3、磁盘:60GB及以上

 

软件要求:

1、VMwareEXSi 6.0 虚拟服务器版

2、VMwareWorkStation 11.0 虚拟客户机版

3、CentOS7.1 64Bit 1503

4、OracleDataBase 11g R2 64Bit

5、Xshell5.0

 

 

 

 部署软体准备 2

                                                                                            

 

Oracle 11gR2 64Bit 安装文件:

1、linux.x64_11gR2_database_1of2.zip

2、linux.x64_11gR2_database_2of2.zip

 

CentOS 7.132Bit依赖包:

1、compat-libstdc++-33-3.2.3.i386.rpm

2、glibc-2.3.4-2.41.i686.rpm

3、libaio-0.3.105.i386.rpm

4、libaio-devel-0.3.105.i386.rpm

5、libgcc-3.4.6-3.i386.rpm

6、libstdc++-3.4.6.i386.rpm

7、pdksh-5.2.14-1.i386.rpm

8、pdksh-5.2.14-30.i64.rpm

9、unixODBC-2.2.11.i386.rpm

10、unixODBC-devel-2.2.11.i386.rpm

 

CentOS 7.164Bit依赖包:

1、kernel-headers-3.10.0-123.el7.x86_64

2、gcc-c++-4.8.2-16.el7.x86_64

3、numactl-devel-2.0.9-2.el7.x86_64

4、glibc-headers-2.17-55.el7.x86_64

5、glibc-common-2.17-55.el7.x86_64

6、binutils-2.23.52.0.1-16.el7.x86_64

7、unixODBC-devel-2.3.1-10.el7.x86_64

8、libaio-0.3.109-12.el7.x86_64

9、make-3.82-21.el7.x86_64

10、elfutils-libelf-0.158-3.el7.x86_64

11、elfutils-libelf-devel-0.158-3.el7.x86_64

12、sysstat-10.1.5-4.el7.x86_64

13、glibc-static-2.17-55.el7.x86_64

14、glibc-devel-2.17-55.el7.x86_64

15、glibc-2.17-55.el7.x86_64

16、elfutils-libelf-devel-static-0.158-3.el7.x86_64

17、libaio-0.3.109-12.el7.i686

18、gcc-4.8.2-16.el7.x86_64

19、libgcc-4.8.2-16.el7.i686

20、libstdc++-static-4.8.2-16.el7.x86_64

21、libaio-devel-0.3.109-12.el7.x86_64

22、libstdc++-4.8.2-16.el7.x86_64

23、libaio-devel-0.3.109-12.el7.i686

24、unixODBC-2.3.1-10.el7.x86_64

25、libstdc++-devel-4.8.2-16.el7.x86_64

26、compat-libstdc++-33-3.2.3-71.el7.x86_64

27、libgcc-4.8.2-16.el7.x86_64

28、libgomp-4.8.2-16.el7.x86_64

  

 


  部署环境准备 3

                                                                                            

 

验证依赖包:

[root@localhost~]# rpm -qa compat-libstdc++-33glibc libaio libaio-devel libgcc libstdc++ pdksh unixODBC unixODBC-devel    # 验证10个依赖包

 

x86依赖包列表:

1、compat-libstdc++-33-3.2.3.i386.rpm

2、glibc-2.3.4-2.41.i686.rpm

3、libaio-0.3.105.i386.rpm

4、libaio-devel-0.3.105.i386.rpm

5、libgcc-3.4.6-3.i386.rpm

6、libstdc++-3.4.6.i386.rpm

7、pdksh-5.2.14-1.i386.rpm

8、pdksh-5.2.14-30.i64.rpm

9、unixODBC-2.2.11.i386.rpm

10、unixODBC-devel-2.2.11.i386.rpm

 

x86依赖包安装:

[root@localhost~]# yum install-y binutils compat-gcc* compat-glibc* compat-libcap1 compat-libstd*compat-libstdc++-33 compat-libstdc++-33.i686 compat-libstdc++-33*.i686elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-commonglibc-devel glibc-devel.i686 glibc-devel*.i686 glibc-headers glibc.i686glibc*.i686 ksh libaio libaio-devel libaio-devel.i686 libaio-devel*.i686libaio.i686 libaio*.i686 libgcc libgcc.i686 libgcc*.i686 libstdc++libstdc++-devel libstdc++-devel*.i686 libstdc++.i686 libstdc++*.i686 libXp makenumactl sysstat unixODBC unixODBC-devel unixODBC-devel*.i686 unixODBC*.i686

 

验证依赖包:

[root@localhost~]# rpm -qa binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-develelfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-develglibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcclibgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstatunixODBC unixODBC-devel    # 验证命令28个依赖包

 

x64依赖包列表:

1、kernel-headers-3.10.0-123.el7.x86_64

2、gcc-c++-4.8.2-16.el7.x86_64

3、numactl-devel-2.0.9-2.el7.x86_64

4、glibc-headers-2.17-55.el7.x86_64

5、glibc-common-2.17-55.el7.x86_64

6、binutils-2.23.52.0.1-16.el7.x86_64

7、unixODBC-devel-2.3.1-10.el7.x86_64

8、libaio-0.3.109-12.el7.x86_64

9、make-3.82-21.el7.x86_64

10、elfutils-libelf-0.158-3.el7.x86_64

11、elfutils-libelf-devel-0.158-3.el7.x86_64

12、sysstat-10.1.5-4.el7.x86_64

13、glibc-static-2.17-55.el7.x86_64

14、glibc-devel-2.17-55.el7.x86_64

15、glibc-2.17-55.el7.x86_64

16、elfutils-libelf-devel-static-0.158-3.el7.x86_64

17、libaio-0.3.109-12.el7.i686

18、gcc-4.8.2-16.el7.x86_64

19、libgcc-4.8.2-16.el7.i686

20、libstdc++-static-4.8.2-16.el7.x86_64

21、libaio-devel-0.3.109-12.el7.x86_64

22、libstdc++-4.8.2-16.el7.x86_64

23、libaio-devel-0.3.109-12.el7.i686

24、unixODBC-2.3.1-10.el7.x86_64

25、libstdc++-devel-4.8.2-16.el7.x86_64

26、compat-libstdc++-33-3.2.3-71.el7.x86_64

27、libgcc-4.8.2-16.el7.x86_64

28、libgomp-4.8.2-16.el7.x86_64

 

依赖包安装:

x64依赖包安装:

[root@localhost~]# yum install-y binutils-2.* compat-libstdc++-33* elfutils-libelf-0.*elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.*glibc-devel-2.* glibc-headers-2.* ksh-2* libaio-0.* libaio-devel-0.* libgcc-4.*libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.*unixODBC-devel-2.* pdksh*

  

 

 部署环境配置 4

                                                                                            

 

关闭防火墙:

[root@localhost ~]# systemctlstatus firewalld.service

# 查看防火墙状态,运行中

firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendorpreset: enabled)

Active: active (running) since Thu2016-04-07 18:54:29 PDT; 2h 20min ago

Main PID: 802 (firewalld)

CGroup: /system.slice/firewalld.service

 └─802/usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld -dynamic firewall daemon...

Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld -dynamic firewall daemon.

 

[root@localhost ~]# systemctlstop firewalld.service

# 关闭防火墙

 

[root@localhost ~]# systemctlstatus firewalld.service

# 查看防火墙状态,发现已关闭

firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendorpreset: enabled)

Active: inactive (dead) since Thu 2016-04-0721:15:34 PDT; 9s ago

Main PID: 802 (code=exited, status=0/SUCCESS)

Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld -dynamic firewall daemon...

Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld -dynamic firewall daemon.

Apr 07 21:15:33 localhost systemd[1]: Stopping firewalld - dynamicfirewall daemon...

Apr 07 21:15:34 localhost systemd[1]: Stopped firewalld - dynamic firewalldaemon.

 

[root@localhost ~]# systemctldisable firewalld.service

# 禁止防火墙

Removed symlink /etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service.

Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

 

关闭selinux强制访问控制安全系统:

方法一:[root@localhost~]# setenforce 0   # 临时关闭,无需重启服务器

# setenforce 1 设置SELinux 成为enforcing模式

# setenforce 0 设置SELinux 成为permissive模式

 

方法二:[root@localhost~]# vi /etc/selinux/config

# 编辑配置文件,需重启服务器生效

# 按键盘I键或者按Insert键,进入编辑状态

# 编辑完成按照ESC键,输入:wq 保存并退出

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

# SELINUX= can take one of these three values:

#     enforcing - SELinux securitypolicy is enforced.

#     permissive - SELinux printswarnings instead of enforcing.

#     disabled - No SELinux policyis loaded.

# SELINUX=enforcing  # 注释此处

  SELINUX=disabled  # 添加此行

# SELINUXTYPE= can take one of three two values:

#     targeted - Targeted processesare protected,

#     minimum - Modification oftargeted policy. Only selected processes are protected.

#     mls - Multi Level Securityprotection.

SELINUXTYPE=targeted

 

[root@localhost ~]# cat /etc/selinux/config #查看修改内容

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

# SELINUX= can take one of these three values:

#     enforcing - SELinux securitypolicy is enforced.

#     permissive - SELinux printswarnings instead of enforcing.

#     disabled - No SELinux policyis loaded.

# SELINUX=enforcing

SELINUX=disabled

# SELINUXTYPE= can take one of three two values:

#     targeted - Targeted processesare protected,

#     minimum - Modification oftargeted policy. Only selected processes are protected.

#     mls - Multi Level Securityprotection.

SELINUXTYPE=targeted

 

修改SHELL限制:

[root@localhost ~]# vi /etc/security/limits.conf

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

注释:/etc/security/limits.conf详细解析

1)limits.conf格式如下:

<domain><type><item><value>或:username|@groupnametype resource limit

2)username|@groupname:设置需要被限制用户名、组,组名前面加@与用户名区别

3)username可以用通配符*来做所有用户的限制

4)type:soft、hard和“-”三种参数

# soft    当前系统生效的设置值

# hard    系统所能设定的最大值

# “-”   同时设置soft和hard的值

# soft    设置值不能比hard设置高

5)resource:core、date、fsize、memlock、nofile、rss、stack、cpu、noproc、as、和maxlogins十一种参数

# core    限制内核文件大小

# date    最大数据大小

# fsize   最大文件大小

# memlock 最大锁定内存地址空间

# nofile  打开最大文的数量

# rss     最大持久设置大小

# stack   最大栈大小

# cpu     以分钟为单位的最多 CPU时间

# noproc  进程的最大数目

# as       地址空间限制

# maxlogins 此用户允许登录的最大数目

 

# /etc/security/limits.conf

#

#This file sets the resource limits for the userslogged in via PAM.

#It does not affect resource limits of the systemservices.

#

#Also note that configuration files in/etc/security/limits.d directory,

#which are read in alphabetical order, override thesettings in this

#file in case the domain is the same or more specific.

#That means for example that setting a limit forwildcard domain here

#can be overriden with a wildcard setting in a configfile in the

#subdirectory, but a user specific setting here can beoverriden only

#with a user specific setting in the subdirectory.

#

#Each line describes a limit for a user in the form:

#

#<domain>   <type>  <item>  <value>

#

#Where:

#<domain> can be:

#        - auser name

#        - agroup name, with @group syntax

#        - thewildcard *, for default entry

#        - thewildcard %, can be also used with %group syntax,

#                for maxlogin limit

#

#<type> can have the two values:

#        -"soft" for enforcing the soft limits

#        -"hard" for enforcing hard limits

#

#<item> can be one of the following:

#        - core- limits the core file size (KB)

#        - data- max data size (KB)

#        - fsize- maximum filesize (KB)

#        -memlock - max locked-in-memory address space (KB)

#        -nofile - max number of open file descriptors

#        - rss -max resident set size (KB)

#        - stack- max stack size (KB)

#        - cpu -max CPU time (MIN)

#        - nproc- max number of processes

#        - as - addressspace limit (KB)

#        -maxlogins - max number of logins for this user

#        -maxsyslogins - max number of logins on the system

#        -priority - the priority to run user process with

#        - locks- max number of file locks the user can hold

#        -sigpending - max number of pending signals

#        -msgqueue - max memory used by POSIX message queues (bytes)

#        - nice- max nice priority allowed to raise to values: [-20, 19]

#        -rtprio - max realtime priority

#

#<domain>     <type>  <item>         <value>

#

#*              soft    core            0

#*              hard    rss             10000

#@student       hard    nproc           20

#@faculty       soft    nproc           20

#@faculty       hard    nproc           50

#ftp            hard    nproc           0

#@student       -       maxlogins       4

#

oracle soft nproc2047    # 添加此行

oracle hard nproc16384   # 添加此行

oracle soft nofile1024   # 添加此行

oracle hard nofile65536  # 添加此行

#

# End of file

 

[root@localhost ~]# cat /etc/security/limits.conf  #查看修改内容

# /etc/security/limits.conf

#

#This file sets the resource limits for the userslogged in via PAM.

#It does not affect resource limits of the systemservices.

#

#Also note that configuration files in/etc/security/limits.d directory,

#which are read in alphabetical order, override thesettings in this

#file in case the domain is the same or more specific.

#That means for example that setting a limit forwildcard domain here

#can be overriden with a wildcard setting in a configfile in the

#subdirectory, but a user specific setting here can beoverriden only

#with a user specific setting in the subdirectory.

#

#Each line describes a limit for a user in the form:

#

#<domain>       <type>  <item>  <value>

#

#Where:

#<domain> can be:

#        - auser name

#        - agroup name, with @group syntax

#        - thewildcard *, for default entry

#        - thewildcard %, can be also used with %group syntax,

#                for maxlogin limit

#

#<type> can have the two values:

#        -"soft" for enforcing the soft limits

#        -"hard" for enforcing hard limits

#

#<item> can be one of the following:

#        - core- limits the core file size (KB)

#        - data- max data size (KB)

#        - fsize- maximum filesize (KB)

#        -memlock - max locked-in-memory address space (KB)

#        -nofile - max number of open file descriptors

#        - rss -max resident set size (KB)

#        - stack- max stack size (KB)

#        - cpu -max CPU time (MIN)

#        - nproc- max number of processes

#        - as -address space limit (KB)

#        -maxlogins - max number of logins for this user

#        -maxsyslogins - max number of logins on the system

#        -priority - the priority to run user process with

#        - locks- max number of file locks the user can hold

#        -sigpending - max number of pending signals

#        -msgqueue - max memory used by POSIX message queues (bytes)

#        - nice- max nice priority allowed to raise to values: [-20, 19]

#        -rtprio - max realtime priority

#

#<domain>     <type>  <item>         <value>

#

#*              soft    core            0

#*              hard    rss             10000

#@student       hard    nproc           20

#@faculty       soft    nproc           20

#@faculty       hard    nproc           50

#ftp            hard    nproc           0

#@student       -       maxlogins       4

# 以下为修改内容

oracle soft nproc2047

oracle hard nproc16384

oracle soft nofile1024

oracle hard nofile65536

#

# End of file

 

修改系统登录配置文件:

[root@localhost~]# vim/etc/pam.d/login或者 # vi /etc/pam.d/login

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

#%PAM-1.0

auth[user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so

auth       substack     system-auth

auth       include      postlogin

account    required    pam_nologin.so

account    include     system-auth

password   include     system-auth

#pam_selinux.so close should be the first session rule

session    required    pam_selinux.so close

session    required    pam_loginuid.so

session    optional    pam_console.so

#pam_selinux.so open should only be followed by sessions to be executed in theuser context

session    required    pam_selinux.so open

session    required    pam_namespace.so

session    optional    pam_keyinit.so force revoke

session    include     system-auth

session    include     postlogin

-session   optional    pam_ck_connector.so

#

session  required  /lib/security/pam_limits.so #添加此行

session   required  pam_limits.so  #添加此行

#

"/etc/pam.d/login"21L, 836C

 

修改系统内核配置文件:

[root@localhost ~]# vi /etc/sysctl.conf

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

# System default settings live in /usr/lib/sysctl.d/00-system.conf.

# To override those settings, enter new settings here, or in an/etc/sysctl.d/<name>.conf file

#

# For more information, see sysctl.conf(5) and sysctl.d(5).

# 添加以下配置信息

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 6815744  # 设置最大打开文件数

fs.aio-max-nr = 1048576

kernel.shmall = 2097152  # 共享内存的总量,8G内存设置:2097152*4k/1024/1024。

kernel.shmmax = 2147483648  # 最大共享内存大小

kernel.shmmni = 4096  # 整个系统共享内存最大数

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 900065500  #可使用网络IP地址端口范围

net.core.rmem_default = 262144

net.core.rmem_max= 4194304

net.core.wmem_default= 262144

net.core.wmem_max= 1048576

# 添加以上配置信息

"/etc/sysctl.conf" 19L, 610C

 

[root@localhost ~]# sysctl –p  # 使修改后的配置文件生效

net.ipv4.icmp_echo_ignore_broadcasts= 1

net.ipv4.conf.all.rp_filter= 1

fs.file-max = 6815744

fs.aio-max-nr =1048576

kernel.shmall =2097152

kernel.shmmax =2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000100 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

 

[root@localhost ~]# cat /etc/sysctl.conf   #查看修改内容

# Systemdefault settings live in /usr/lib/sysctl.d/00-system.conf.

# Tooverride those settings, enter new settings here, or in an/etc/sysctl.d/<name>.conf file

#

# For moreinformation, see sysctl.conf(5) and sysctl.d(5).

# 查看以下修改内容

net.ipv4.icmp_echo_ignore_broadcasts= 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 6815744

fs.aio-max-nr = 1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 900065500

net.core.rmem_default = 262144

net.core.rmem_max= 4194304

net.core.wmem_default= 262144

net.core.wmem_max= 1048576

 

创建数据库用户配置:

[root@localhost~]# groupaddoinstall  #创建用户组oinstall

[root@localhost~]# groupadd dba #创建用户组dba

[root@localhost~]# useradd -goinstall -g dba -m oracle  #创建数据库用户,并加入到oinstall组和dba组

[root@localhost~]# passwdoracle  #设置数据库用户系统登陆密码,不设置密码在系统图形登陆界面中无法登陆

Changingpassword for user oracle.

Newpassword:  # 输入新密码(密码默认是看不见)

BADPASSWORD: The password is shorter than 8 characters

Retype newpassword:  # 确认输入的密码(密码默认是看不见)

passwd: allauthentication tokens updated successfully.

[root@localhost~]# idoracle  # 查看新建的数据库用户

uid=1001(oracle)gid=1002(dba) groups=1002(dba)

 

创建数据库安装配置:

[root@localhost ~]# mkdir -p /data/oracle  # 数据库安装目录
[root@localhost ~]# mkdir -p /data/oraInventory  # 数据库配置文件目录
[root@localhost ~]# mkdir -p /data/database  # 数据库软件包解压目录
[root@localhost ~]# mkdir -p /data/software  # 软件包上传存放目录
[root@localhost ~]# cd /data  #进入目录
[root@localhost data]# ls# 创建完毕进行检查是否创建成功
database  oracle  oraInventory software
[root@localhost data]# chown -R oracle:oinstall /data/oracle
# 设置此目录所有者为Oinstall用户组的Oracle用户
[root@localhost data]# chown -R oracle:oinstall /data/oraInventory
# 设置此目录所有者为Oinstall用户组的Oracle用户
[root@localhost data]# chown -R oracle:oinstall /data/database
# 设置此目录所有者为Oinstall用户组的Oracle用户
[root@localhost ~]# chmod -R 775 /Data/Oracle  # 设置目录权限

 

修改系统版本标识:

注释:

1)OracleDatabase 11g Release 2默认不支持CentOS系统安装

2)OracleDatabase 11g Release 2 的 OS要求参考一下访问地址:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1106

[root@localhost data]# cat /proc/version  #查看当前系统内核版本

Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gccversion 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC2015

[root@localhost ~]# cat /etc/redhat-release #查看当前系统版本

CentOS Linux release 7.2.1511 (Core)

[root@localhost ~]# vi /etc/redhat-release

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

# CentOS Linux release 7.1.1503 (Core)   #注释此行

redhat-7   #添加此行

[root@localhost ~]# cat /etc/redhat-release #查看修改内容

redhat-7

 

修改系统环境变量:

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

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

# /etc/profile

# System wide environment and startup programs, forlogin setup

# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless youknow what you

# are doing. It's much better to create a custom.shshell script in

# /etc/profile.d/ to make custom changes to yourenvironment, as this

# will prevent the need for merging in future updates.

pathmunge () {

    case":${PATH}:" in

       *:"$1":*)

            ;;

        *)

            if ["$2" = "after" ] ; then

               PATH=$PATH:$1

            else

               PATH=$1:$PATH

            fi

    esac

}

#

if [ -x /usr/bin/id ]; then

    if [ -z"$EUID" ]; then

        # kshworkaround

        EUID=`id-u`

        UID=`id-ru`

    fi

   USER="`id -un`"

   LOGNAME=$USER

   MAIL="/var/spool/mail/$USER"

fi

#

# Path manipulation

if [ "$EUID" = "0" ]; then

    pathmunge/usr/sbin

    pathmunge/usr/local/sbin

else

    pathmunge/usr/local/sbin after

    pathmunge/usr/sbin after

fi

#

HOSTNAME=`/usr/bin/hostname 2>/dev/null`

HISTSIZE=1000

if [ "$HISTCONTROL" ="ignorespace" ] ; then

    exportHISTCONTROL=ignoreboth

else

    exportHISTCONTROL=ignoredups

fi

#

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZEHISTCONTROL

#

# By default, we want umask to get set. This sets itfor login shell

# Current threshold for system reserved uid/gids is200

# You could check uidgid reservation validity in

# /usr/share/doc/setup-*/uidgid file

if [ $UID -gt 199 ] && [ "`id -gn`"= "`id -un`" ]; then

    umask 002

else

    umask 022

fi

#

for i in /etc/profile.d/*.sh ; do

    if [ -r"$i" ]; then

        if ["${-#*i}" != "$-" ]; then

            ."$i"

        else

            ."$i" >/dev/null

        fi

    fi

done

#

unset i

unset -f pathmunge

# 添加以下配置

if [ $USER ="oracle" ]; then

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

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

fi

 

[root@localhost ~]#cat /etc/profile  #查看修改内容

# /etc/profile

# System wide environment and startup programs, for loginsetup

# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless youknow what you

# are doing. It's much better to create a custom.shshell script in

# /etc/profile.d/ to make custom changes to yourenvironment, as this

# will prevent the need for merging in future updates.

pathmunge () {

    case":${PATH}:" in

       *:"$1":*)

            ;;

        *)

            if ["$2" = "after" ] ; then

               PATH=$PATH:$1

            else

               PATH=$1:$PATH

            fi

    esac

}

#

if [ -x /usr/bin/id ]; then

    if [ -z"$EUID" ]; then

        # kshworkaround

        EUID=`id-u`

        UID=`id-ru`

    fi

   USER="`id -un`"

   LOGNAME=$USER

   MAIL="/var/spool/mail/$USER"

fi

#

# Path manipulation

if [ "$EUID" = "0" ]; then

    pathmunge/usr/sbin

    pathmunge/usr/local/sbin

else

    pathmunge/usr/local/sbin after

    pathmunge/usr/sbin after

fi

#

HOSTNAME=`/usr/bin/hostname 2>/dev/null`

HISTSIZE=1000

if [ "$HISTCONTROL" = "ignorespace"] ; then

    exportHISTCONTROL=ignoreboth

else

    exportHISTCONTROL=ignoredups

fi

#

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZEHISTCONTROL

#

# By default, we want umask to get set. This sets itfor login shell

# Current threshold for system reserved uid/gids is200

# You could check uidgid reservation validity in

# /usr/share/doc/setup-*/uidgid file

if [ $UID -gt 199 ] && [ "`id -gn`"= "`id -un`" ]; then

    umask 002

else

    umask 022

fi

#

for i in /etc/profile.d/*.sh ; do

    if [ -r"$i" ]; then

        if ["${-#*i}" != "$-" ]; then

            ."$i"

        else

            ."$i" >/dev/null

        fi

    fi

done

#

unset i

unset -f pathmunge

# 查看以下修改内容

if [ $USER ="oracle" ]; then

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

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

fi

 

修改用户环境变量:

[root@localhost ~]#vi /home/oracle/.bash_profile

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

#.bash_profile

# Get thealiases and functions

if [ -f~/.bashrc ]; then

        . ~/.bashrc

fi

# Userspecific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

# 添加以下配置信息

export ORACLE_BASE=/data/oracle  # 数据库安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1  # 数据库安装路径
export ORACLE_SID=orcl  # 启动数据库实例名
export ORACLE_TERM=xterm  # xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH  # 添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib  # 添加系统环境变量
export LANG=C  # 防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK  # 设置数据库客户端字符集,必须与数据库安装时设置的字符集保持一致,如:ZHS16GBK,否则出现数据导入导出中文乱码问题

 

[root@localhost ~]#cat /home/oracle/.bash_profile #查看修改内容

#.bash_profile

# Get thealiases and functions

if [ -f~/.bashrc ]; then

    . ~/.bashrc

fi

# Userspecific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

# 查看以下修改内容

export ORACLE_BASE=/data/oracle

exportORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export ORACLE_SID=orcl

export ORACLE_TERM=xterm

exportPATH=$ORACLE_HOME/bin:/usr/sbin:$PATH

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export LANG=C

exportNLS_LANG=AMERICAN_AMERICA.ZHS16GBK

 

修改系统HOSTS记录:

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

# 编辑配置文件

# 按键盘I键或者按Insert键,进入编辑状态

#编辑完成按照ESC键,输入:wq 保存并退出

127.0.0.1    localhost localhost.localdomain localhost4localhost4.localdomain4

::1          localhost localhost.localdomainlocalhost6 localhost6.localdomain6

10.10.10.25  oracle.domain.comoracle  #添加此行

 

[root@localhost ~]# cat /etc/hosts # 查看修改信息

127.0.0.1    localhost localhost.localdomain localhost4localhost4.localdomain4

::1          localhost localhost.localdomainlocalhost6 localhost6.localdomain6

10.10.10.25  oracle.domain.comoracle  #查看此处修改信息

  

 

 部署数据服务 5

                                                                                            

 

上传数据库安装文件:

[root@localhost ~]# cd /data/software  #进入软件包上传存放目录

[root@localhost software]# rz  #CentOS 7.1默认已安装Lrzsz服务

                         # 输入命令后直接按回车键,弹出上传文件选择框

 

解压数据库安装文件:

[root@localhost software]#unzip linux.x64_11gR2_database_1of2.zip-d /data/software/

[root@localhost software]# unzip linux.x64_11gR2_database_2of2.zip-d /data/software/

[root@localhost software]#ls  # 查看解压后文件夹

linux.x64_11gR2_database_1of2  linux.x64_11gR2_database_2of2

 

开始部署数据服务:

1、使用Oracle账户登录系统,默认系统一般为英文环境

2、进入/data/software/目录

3、合并linux.x64_11gR2_database_1of2 linux.x64_11gR2_database_2of2

4、右键打开“终端”

5、[root@localhost database]# ./runInstaller  #运行安装文件

  

1、邮箱、安全警告口令可以不填,直接忽略。

2、第一个选项创建数据库并安装相关配置软件(默认选择)

      第二选项只安装数据库软件

      第三选项更新升级安装数据库

3、选择Server Class版(服务器版) 

4、选择单实例数据库安装(singne Instance database installation)

5、Typical install(经典安装)、选择Adcanced install(高级安装)

6、添加简体中文支持(Simplified Chinese)

6、Enterprise Edition(企业版)、Standavd Edition(标准版)

      Standavd Edition One(单用户版),选择企业版安装。

7、确认数据库安装路径,按照系统环境变量定义路径安装即可

8、确认数据库日志文件目录,按照系统环境变量定义路径即可(orainventory)

     并选择orainventory Group Name (DBA) 

9、第一表示一般事务数据处理服务、第二表示数据仓库而优化(选择第二项)

10、填写数据库实例名称、服务名称(默认orcl) 

11、启用数据库内存自动管理(默认40%)、启动企业管理EM控制台、设置字符集

12、异常日志邮件通知服务器设置,默认不设置,忽略。

13、文件系统路径(即数据库库文件、表空间文件存放路径)

14、自动备份设置(默认选择不自动备份) 

15、数据库用户密码设置

16、两个选项全部选择DBA组 

17、预安装检查,错误可忽略(软件版本问题,但必须确认软件包已安装)

18、正式开始安装数据库服务器(Oracle DataBaseServer 11g R2)

19、根据提示用root身份执行两个sh脚本

[root@localhost~]# ./data/oracle/app/oraInventory/orainstRoot.sh

[root@localhost ~]# ./data/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

20、点击设置管理密码:sys、system、scott三个数据权限较大用户面,可以全部相同

21、输入设置密码

22、至此数据服务部署完成 

 

 启动数据服务 6

                                                                                            

 

第一步:登陆root用户之后切换到oracle用户上,输入

[root@localhost ~]#su oracle

 

第二步:登录到oracle用户下,输入

[oracle@localhost ~]#sqlplus /nolog

 

第三步:使用数据管理员权限,输入

SQL> connect /as sysdba

 

第四步:启动数据库服务,输入

SQL> startup

 

第五步:如果是启动服务,要开启监听,退出sqlplus模式,输入

[oracle@localhost ~]# lsnrctl start

 

startup参数:

1、不带参数,启动数据库实例并打开数据库

2、nomount,只启动数据库实例,但不打开数据库

3、mount,进行数据库更名的时候采用

Shutdown参数:

1、Normal,需要等待所有的用户断开连接

2、Immediate,等待用户完成当前的语句

3、Transactional,等待用户完成当前的事务

4、Abort,强制直接关闭数据库

5、normal需要所有连接用户断开后才执行关闭数据库任务,执行命令后不允许新的连接

6、immediate用户执行完正在执行的语句后就断开用户连接,并不允许新用户连接

7、transactional拥护执行完当前事物后断开连接,并不允许新的用户连接数据库

8、abort执行强行断开连接并直接关闭数据库 

 

 

 部署常见问题 7

                                                                                            

 

1、ORA-010081:cannot start already-running ORACLE - shut it down first

解决方法:

SQL> startup

ORA-01081:cannot start already-running ORACLE - shut it down first

SQL> shutdown immediate

Databaseclosed.

Databasedismounted.

ORACLEinstance shut down.

SQL> startup

ORACLEinstance started.

TotalSystem Global Area  634679296 bytes

Fixed Size     2216024 bytes

VariableSize    260050856 bytes

DatabaseBuffers  364904448 bytes

RedoBuffers     7507968 bytes

Databasemounted.

Databaseopened.

# 关闭数据库实例,重启数据库实例,正常重启。

 

2、CentOS7.1新版本安装Oracle 11g R2安装过程中弹出了两个错误如下:

1)调用 makefile' /oracle/app/oracle/product/11.2.0/dbhome_1/ctx/lib

/ins_ctx.mk'目标'install'出错这个最后没能解决,直接忽略继续了,从查的资料来看,主要是libstdc++或者是glibc两个相关库的问题,将对应的devel包装上了也不行, libstdc++33 与oracle 11g r2不兼容,换成mandriva的 libstdc++5-3.3.6-4mdv2009.0.x86_64可以用redhat上,应该也就能用在CentOS上吧,安装x64的版本还得要求i386的包也要装,为兼容使用。

2)ins_emagent.mk 链接错误,报错agent nmhs错误,这个问题网上的解决办法倒是相对统一,修改 $ORACLE_HOME/sysman/lib/ins_emagent.mk文件,找到$(MK_EMAGENT_NMECTL)那行改成:$(MK_EMAGENT_NMECTL)-lnnz11即可,试了下确实安装通过了。第一遍装的时候这个问题也直接忽略过了,但后面发现EM不能正常访问,搞了几遍删了重建也就是前几分钟可以登录,然后马上就打不开了,查看状态老是提示em agent is not running...只好重装过程中修改ins_emagent.mk来解决这个问题。

 

3、Linux下安装Oracle11g,安装界面乱码问题解决方法(此方法亲测必须使用root用户才有权限解决),解决安装时中文是"囗囗囗囗囗囗囗囗"

1)进入刚解压的database/stage/Components/oracle.jdk/1.5.0.17.0/1/DataFiles

/all.jar

2)在桌面新建一个文件夹命名为fallback,下载中文字体(zysong.ttf)放入里面去。

3)用归档管理器打开all.jar它进入/jdk/jre/lib/fonts/把在桌面建好的fallback文件夹拖放进来,完成后的目录结构应该是/jdk/jre/lib/fonts/fallback/zysong.ttf。