CentOS7 安装Oracle 11g R2

一、安装环境

CentOS Linux 7
Oracle 11g R2

二、安装前准备

2.1. 修改主机名称

#查看主机名称
[root@cdtdw ~]# hostnamectl status
[root@cdtdw ~]# hostnamectl set-hostname cdtdw

 

 

 因为我的主机名就是:cdtdw,就不用再更改了

2.2. 修改hosts文件
修改hosts文件是为了保持ip 与 主机名对应

[root@cdtdw ~]# vim /etc/hosts
#新增ip与主机名对应
127.0.0.1 cdtdw
10.0.0.26 cdtdw #本机ip地址
#重启机器
[root@cdtdw ~]# reboot

2.3. 关闭Selinux(太深奥,先关闭了)

[root@cdtdw ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config  
[root@cdtdw ~]# setenforce 0

 

 

 2.4. 防火墙开放 1521 端口

#centos7防火墙与centos6防火墙有比较大差异
#关闭centos7防火墙
[root@cdtdw ~]# systemctl stop firewalld.service
#关闭开机启动
[root@cdtdw ~]# systemctl disable firewalld.service

#安装iptables防火墙
[root@cdtdw ~]# yum install iptables-services
[root@cdtdw ~]# vim /etc/sysconfig/iptables
#新增1521接口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
#设置开机启动
[root@cdtdw ~]# systemctl enable iptables
#重启iptabls服务
[root@cdtdw ~]# systemctl restart iptables.service

 

下面是修改:/etc/sysconfig/iptables,修改内容如下图:

 

 

 2.5 安装所需的软件包
查看Oracle安装文档中列出的Package Requirements可以查看在不同平台上需要的软件包。

binutils-2.23.52.0.1-12.el7.x86_64 
compat-libcap1-1.10-3.el7.x86_64 
gcc-4.8.2-3.el7.x86_64 
gcc-c++-4.8.2-3.el7.x86_64 
glibc-2.17-36.el7.i686 
glibc-2.17-36.el7.x86_64 
glibc-devel-2.17-36.el7.i686 
glibc-devel-2.17-36.el7.x86_64 
ksh
libaio-0.3.109-9.el7.i686 
libaio-0.3.109-9.el7.x86_64 
libaio-devel-0.3.109-9.el7.i686 
libaio-devel-0.3.109-9.el7.x86_64 
libgcc-4.8.2-3.el7.i686 
libgcc-4.8.2-3.el7.x86_64 
libstdc++-4.8.2-3.el7.i686 
libstdc++-4.8.2-3.el7.x86_64 
libstdc++-devel-4.8.2-3.el7.i686 
libstdc++-devel-4.8.2-3.el7.x86_64 
libXi-1.7.2-1.el7.i686 
libXi-1.7.2-1.el7.x86_64 
libXtst-1.2.2-1.el7.i686 
libXtst-1.2.2-1.el7.x86_64 
make-3.82-19.el7.x86_64 
sysstat-10.1.5-1.el7.x86_64

Oracle ODBC Drivers
On Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4:

unixODBC-2.3.1-6.el7.x86_64 or later
unixODBC-2.3.1-6.el7.i686 or later
unixODBC-devel-2.3.1-6.el7.x86_64 or later
unixODBC-devel-2.3.1-6.el7.i686 or later

安装软件包 

yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC unixODBC

2.6. 创建用户组与用户

[root@cdtdw ~]# groupadd oinstall #创建群组

[root@cdtdw ~]# groupadd dba #创建群组
[root@cdtdw ~]# useradd -g oinstall -G dba,oper oracle #创建用户 

[root@cdtdw
~]# passwd oracle #设置密码

 2.7. 修改kernel内核

[root@cdtdw ~]# vim /etc/sysctl.conf 
#配置文件内加入 修改以下参数。如果没有可以自己添加,如果默认值比参考值大,则不需要修改。
kernel.shmmni = 4096 #这个内核参数用于设置系统范围内共享内存段的最大数量。该参数的默认值是 4096 。通常不需要更改。
kernel.shmmax = 53687091200  #该参数定义了共享内存段的最大尺寸(以字节为单位)。缺省为32M,对于oracle来说,该缺省值太低了,通常将其设置为50G。
kernel.shmall = 2097152 #该参数表示系统一次可以使用的共享内存总量(以页为单位)。缺省值就是2097152,通常不需要修改。
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 65536 #设置最大打开文件数
net.ipv4.ip_local_port_range = 9000 65500  #可使用的IPv4端口范围
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

 

 

 保存后退出并立即生效:

[root@cdtdw ~]# sysctl -p

 2.8. 修改系统资源限制

[root@cdtdw ~]# vim /etc/security/limits.conf
#配置文件下方加入
cdtdw soft nproc 2047
cdtdw hard nproc 16384
cdtdw soft nofile 1024
cdtdw hard nofile 65536
cdtdw soft stack  10240

#修改用户验证选项 关联设置
[root@cdtdw ~]# vim /etc/pam.d/login
#加入以下语句: 
session required  /lib64/security/pam_limits.so
session required   pam_limits.so
#(注意:根据最后一条session规则的注释,应该加在最后一条规则之前)

 

 

 

 

 

 2.9. 创建安装目录与目录权限

#创建安装目录,并赋予用户与用户组
#oracle目录 安装目录
#oradata 数据存储目录
#inventory 清单目录
#fast_recovery_area 恢复目录
[root@cdtdw~]# mkdir -p /data/oracle/product/11.2.0

[root@cdtdw ~]# mkdir /data/oracle/oradata

[root@cdtdw ~]# mkdir /data/oracle/inventory

[root@cdtdw ~]# mkdir /data/oracle/fast_recovery_area

[root@cdtdw ~]# chown -R oracle:oinstall /data/oracle   #创建用户

[root@cdtdw ~]# chmod -R 775 /data/oracle   #给用户授权目录

2.10. 创建Oracle环境变量,这个只有R1才要,因为现在我安装的是R2,可以不用处理

#11G R1需要,R2可省略
[root@oracle ~]# vim /etc/profile
#在末尾增加以下内容
if [ $USER = "oracle" ]; then      
    if [ $SHELL = "/bin/sh" ]; then          
        ulimit -p 16384           
        ulimit -n 65536      
    else           
         ulimit -u 16384 -n 65536      
    fi
fi

三、安装Oracle Database

3.1. 上传安装文件到home目录,并解压,我是上传到 /software 文件夹下,解压后如下图:

针对新建的目录需做授权:

[root@cdtdw ~]# mkdir /software

[root@cdtdw ~]# chown -R oracle:oinstall /software   #创建用户

[root@cdtdw ~]# chmod -R 775 /software   #给用户授权目录

然后上传文件到这个文件夹,再进行解压,使用unzip命令

 

 

 3.2. 准备oracle安装应答模板文件db_install.rsp文件

[oracle@oracle database]$ cp response/* /data/oracle/

[oracle@oracle oracle]$ chmod 755 ./*.rsp
#编辑
[oracle@oracle oracle]$ vim db_install.rsp 
#修改文件中一下内容
//安装类型,只装数据库软件
oracle.install.option=INSTALL_DB_SWONLY             
//主机名称(命令hostname查询)
ORACLE_HOSTNAME=cdtdw                             
// 安装组
UNIX_GROUP_NAME=oinstall                       
//INVENTORY目录(**不填就是默认值,本例此处需修改,因个人创建安装目录而定)
INVENTORY_LOCATION=/data/oracle/inventory         
// 选择语言 
SELECTED_LANGUAGES=en,zh_CN                       
// oracle_home *路径根据目录情况注意修改 本例安装路径/data/oracle
ORACLE_HOME=/data/oracle/product/11.2.0      
// oracle_base *注意修改
ORACLE_BASE=/data/oracle                          
// oracle版本 
oracle.install.db.InstallEdition=EE                  
//自定义安装,否,使用默认组件
oracle.install.db.isCustomInstall=false              
//dba用户组
oracle.install.db.DBA_GROUP=dba                      
//oper用户组
oracle.install.db.OPER_GROUP=dba                     
// **注意此参数 设定一定要为true
DECLINE_SECURITY_UPDATES=true  

 

 以下为这个文件的所有内容,请留意红色字体内容

####################################################################
## Copyright(c) Oracle Corporation 1998,2008. All rights reserved.##
##                                                                ##
## Specify values for the variables listed below to customize     ##
## your installation.                                             ##
##                                                                ##
## Each variable is associated with a comment. The comment        ##
## can help to populate the variables with the appropriate        ##
## values.                              ##
##                                                                ##
## IMPORTANT NOTE: This file contains plain text passwords and    ##
## should be secured to have read permission only by oracle user  ##
## or db administrator who owns this installation.                ##
##                                                                ##
####################################################################

#------------------------------------------------------------------------------
# Do not change the following system generated value. 
#------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

#------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# 1. INSTALL_DB_SWONLY
# 2. INSTALL_DB_AND_CONFIG
# 3. UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames 
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=cdtdw  #主机名

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.  
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/data/oracle/inventory

#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.             
#
# en   : English                  ja   : Japanese                  
# fr   : French                   ko   : Korean                    
# ar   : Arabic                   es   : Latin American Spanish    
# bn   : Bengali                  lv   : Latvian                   
# pt_BR: Brazilian Portuguese     lt   : Lithuanian                
# bg   : Bulgarian                ms   : Malay                     
# fr_CA: Canadian French          es_MX: Mexican Spanish           
# ca   : Catalan                  no   : Norwegian                 
# hr   : Croatian                 pl   : Polish                    
# cs   : Czech                    pt   : Portuguese                
# da   : Danish                   ro   : Romanian                  
# nl   : Dutch                    ru   : Russian                   
# ar_EG: Egyptian                 zh_CN: Simplified Chinese        
# en_GB: English (Great Britain)  sk   : Slovak                    
# et   : Estonian                 sl   : Slovenian                 
# fi   : Finnish                  es_ES: Spanish                   
# de   : German                   sv   : Swedish                   
# el   : Greek                    th   : Thai                      
# iw   : Hebrew                   zh_TW: Traditional Chinese       
# hu   : Hungarian                tr   : Turkish                   
# is   : Icelandic                uk   : Ukrainian                 
# in   : Indonesian               vi   : Vietnamese                
# it   : Italian                                                   
#
# Example : SELECTED_LANGUAGES=en,fr,ja
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/data/oracle/product/11.2.0

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base. 
#------------------------------------------------------------------------------
ORACLE_BASE=/data/oracle

#------------------------------------------------------------------------------
# Specify the installation edition of the component.                        
#                                                             
# The value should contain only one of these choices.        
# EE     : Enterprise Edition                                
# SE     : Standard Edition                                  
# SEONE  : Standard Edition One
# PE     : Personal Edition (WINDOWS ONLY)
#------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE

#------------------------------------------------------------------------------
# This variable is used to enable or disable custom install.
#
# true  : Components mentioned as part of 'customComponents' property
#         are considered for install.
# false : Value for 'customComponents' is not considered.
#------------------------------------------------------------------------------
oracle.install.db.isCustomInstall=false

#------------------------------------------------------------------------------
# This variable is considered only if 'IsCustomInstall' is set to true. 
#
# Description: List of Enterprise Edition Options you would like to install.
#
#              The following choices are available. You may specify any
#              combination of these choices.  The components you choose should
#              be specified in the form "internal-component-name:version"
#              Below is a list of components you may specify to install.
#        
#              oracle.rdbms.partitioning:11.2.0.1.0 - Oracle Partitioning
#              oracle.rdbms.dm:11.2.0.1.0 - Oracle Data Mining
#              oracle.rdbms.dv:11.2.0.1.0 - Oracle Database Vault 
#              oracle.rdbms.lbac:11.2.0.1.0 - Oracle Label Security
#              oracle.rdbms.rat:11.2.0.1.0 - Oracle Real Application Testing 
#              oracle.oraolap:11.2.0.1.0 - Oracle OLAP
#------------------------------------------------------------------------------
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0

###############################################################################
#                                                                             #
# PRIVILEGED OPERATING SYSTEM GROUPS                                            #
# ------------------------------------------                                  #
# Provide values for the OS groups to which OSDBA and OSOPER privileges       #
# needs to be granted. If the install is being performed as a member of the   #        
# group "dba", then that will be used unless specified otherwise below.          #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba

#------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=dba

#------------------------------------------------------------------------------
# Specify the cluster node names selected during the installation.
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE/TRANSACTION_PROCESSING          
# - DATA_WAREHOUSE                                
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=

#------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name. 
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=

#------------------------------------------------------------------------------
# Specify the Starter Database SID.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=

#------------------------------------------------------------------------------
# Specify the Starter Database character set.
#                                              
# It can be one of the following:
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management 
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=true

#------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available 
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=

#------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto the starter
# database or not.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false

#------------------------------------------------------------------------------
# This variable includes enabling audit settings, configuring password profiles
# and revoking some grants to public. These settings are provided by default. 
# These settings may also be disabled.    
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableSecuritySettings=true

###############################################################################
#                                                                             #
# Passwords can be supplied for the following four schemas in the          #
# starter database:                                    #
#   SYS                                                                       #
#   SYSTEM                                                                    #
#   SYSMAN (used by Enterprise Manager)                                       #
#   DBSNMP (used by Enterprise Manager)                                       #
#                                                                             #
# Same password can be used for all accounts (not recommended)               #
# or different passwords for each account can be provided (recommended)       #
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=

#-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS=

#-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM=

#-------------------------------------------------------------------------------
# Specify the SYSMAN password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSMAN=

#-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=

#-------------------------------------------------------------------------------
# Specify the management option to be selected for the starter database. 
# It can be one of the following:
# 1. GRID_CONTROL
# 2. DB_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.control=DB_CONTROL

#-------------------------------------------------------------------------------
# Specify the Management Service to use if Grid Control is selected to manage 
# the database.      
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

#-------------------------------------------------------------------------------
# This variable indicates whether to receive email notification for critical 
# alerts when using DB control.   
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

#-------------------------------------------------------------------------------
# Specify the email address to which the notifications are to be sent.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.emailAddress=

#-------------------------------------------------------------------------------
# Specify the SMTP server used for email notifications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=


###############################################################################
#                                                                             #
# SPECIFY BACKUP AND RECOVERY OPTIONS                                           #
# ------------------------------------                                      #
# Out-of-box backup and recovery options for the database can be mentioned    #
# using the entries below.                              #    
#                                                                             #
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if automated backup is not required. Else 
# this can be set to true.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.enable=false

#------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if 
# automated backups are enabled, a job will be scheduled to run daily at
# 2:00 AM to backup the database. This job will run as the operating system 
# user that is specified in this variable.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.osuid=

#-------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if 
# automated backups are enabled, a job will be scheduled to run daily at
# 2:00 AM to backup the database. This job will run as the operating system user
# specified by the above entry. The following entry stores the password for the
# above operating system user.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.ospwd=

#-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
# - FILE_SYSTEM_STORAGE
# - ASM_STORAGE
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType=

#-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.         
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM 
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

#-------------------------------------------------------------------------------
# Specify the backup and recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM 
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

#-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup=

#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.                  
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_SYSTEM 
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
#  Example   : MYORACLESUPPORT_USERNAME=metalink
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example    : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example    : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=

#------------------------------------------------------------------------------
# Specify whether user wants to give any proxy details for connection. 
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example    : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example    : PROXY_HOST=proxy.domain.com 
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and atleast 2 chars.
#
# Example    : PROXY_PORT=25 
#------------------------------------------------------------------------------
PROXY_PORT=

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD 
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_USER=username 
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD  
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_PWD=password 
#------------------------------------------------------------------------------
PROXY_PWD=

 3.3. 设置Oracle用户环境变量

[oracle@cdtdw ~]$ vim .bash_profile 
#添加以下内容
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=cdtdw
export ORACLE_OWNER=oracle
export NLS_LANG=american_america.AL32UTF8
export LANG=en_US.UTF-8

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

export PATH

#立即生效
[oracle@cdtdw ~]$ source .bash_profile 

 

 3.4. 在oracle 用户下安装

#进入解压目录
[oracle@cdtdw ~]$ cd /software/database
[oracle@cdtdw database]$  ./runInstaller -silent -ignorePrereq -responseFile /data/oracle/db_install.rsp

/home/database是安装包解压后的路径,此处根据安装包解压所在位置做修改,因人而异。
  runInstaller 是主要安装脚本
  -silent 静默模式
  -force 强制安装
  -ignorePrereq忽略warning直接安装。
  -responseFile读取安装应答文件。

执行结果如下图:

 根据提示内容,切换root用户执行以下语句。

/data/oracle/inventory/orainstRoot.sh
/data/oracle/product/11.2.0/root.sh

 如下面执行界面所示,需先切换到root用户,再到相应的文件夹执行文件,如下图所示:

 

 

 

 四、以静默方式配置监听

[oracle@oracle ~]$ netca /silent /responseFile /data/oracle/netca.rsp

执行如下图所示,注意要切换为oracle用户来执行,在用户的家目录下:

 

 成功运行后,在/data/oracle/product/11.2.0/network/admin/中会生成listener.ora和sqlnet.ora文件,如下图可查看到:

 

 

五、以静默方式建立新库,同时也建立一个对应的实例

[oracle@oracle ~]$ vim /data/oracle/dbca.rsp

GDBNAME= "cdtdw"

SID =" cdtdw"

SYSPASSWORD= "com.oracle2020"

SYSTEMPASSWORD= "com.oracle2020"

SYSMANPASSWORD= "com.oracle2020"

DBSNMPPASSWORD= "com.oracle2020"

DATAFILEDESTINATION=/data/oracle/oradata

RECOVERYAREADESTINATION=/data/oracle/fast_recovery_area

CHARACTERSET= "AL32UTF8"

TOTALMEMORY= "51200"

其中TOTALMEMORY ="51200" 为51200MB,物理内存50G,因为我服务器内存有100G。

配置好这个文件后,进行静默配置,需使用oracle用户,在其家目录下执行以下语句,执行效果如下图,可以下图中上半部分有问题的命令内容:

[oracle@oracle ~]$  dbca -silent -responseFile /home/oracle/response/dbca.rsp

 

 查看监听状态:

 

 登陆查看实例状态:

 

 

六、创建表空间与用户

6.1.创建表空间

create tablespace cdtdw logging datafile'/data/oracle/oradata/cdtdw/cdtdw.dbf' size 1024m autoextend on next 100m maxsize 10240m extent management local;

6.2.创建用户

create user cdtdw identified by cdtdw default tablespace cdtdw;

6.3.给用户赋权限

#为了省事,先把DBA权限赋值。
grant dba to cdtdw;

 

 

 最上面有一条语句是用于删除表空间的,可以一起学习下。

--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;

 

七、链接测试

 

 

八、设置开机启动

8.1.修改/data/oracle/product/11.2.0/bin/dbstart

 

posted @ 2020-10-23 15:00  aaron616  阅读(269)  评论(0编辑  收藏  举报