阿里云ECS,CentOS7下安装部署Oracle11gR2环境

为什么80%的码农都做不了架构师?>>>   hot3.png

环境

1、阿里云ECS centos7

2、oracle11gR2安装包: linux.x64_11gR2_database_1of2.zip、linux.x64_11gR2_database_2of2.zip

[root@iZ23zw1ss97Z ~]# ll /data/oracle
total 2295600
-rw-r--r-- 1 root root 1239269270 Jan  8 15:36 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1111416131 Jan  8 15:36 linux.x64_11gR2_database_2of2.zip
[root@iZ23zw1ss97Z ~]# 

分配虚拟内存

如果是阿里云ECS只有1g内存,那么就需要创建swap分区,弥补物理内存的不足,也就是虚拟内存的概念,把硬盘的一部分划分作为虚拟内存,但这个空间不是越大越好,硬盘的速度远低于内存,设置不当反而拖慢系统的速度。

阿里云的主机默认没有swap分区,可以使用free命令查看:

[root@iZ23zw1ss97Z ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7567        1473        1071         216        5021        5611
Swap:             0           0           0
[root@iZ23zw1ss97Z ~]# 

下面记录在阿里云CentOS 7上创建swap分区的步骤:

  1. 使用dd命令创建一个swap分区
[root@iZ23zw1ss97Z ~]# dd if=/dev/zero of=/home/swap bs=1024 count=1024000
1024000+0 records in
1024000+0 records out
1048576000 bytes (1.0 GB) copied, 3.30162 s, 318 MB/s
[root@iZ23zw1ss97Z ~]#

count的值是:size(多少M)* 1024,我这里设置的1G虚拟内存,也就是count=1024000.

    2.格式化swap分区

[root@iZ23zw1ss97Z ~]# mkswap /home/swap
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=f404a256-960b-492b-8648-94ef6f75cd92
[root@iZ23zw1ss97Z ~]#

    3.把格式化后的文件分区设置为swap分区

[root@iZ23zw1ss97Z ~]# swapon /home/swap
swapon: /home/swap: insecure permissions 0644, 0600 suggested.
[root@iZ23zw1ss97Z ~]# 

(关闭SWAP分区命令为:[root@iZ23zw1ss97Z ~]#  swapoff /home/swap)

此时,swap分区已经创建好了,使用free命令查看,可见多了一个挂载分区。

    4.swap分区自动挂载

[root@iZ23zw1ss97Z ~]# vi /etc/fstab

在文件末尾加上

/home/swap      swap    swap    default         0 0

    5.查看是否成功

[root@iZ23zw1ss97Z ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7567        1474         236         216        5856        5610
Swap:           999           0         999
[root@iZ23zw1ss97Z ~]# 

查看有无ifconfig命令

[root@iZ23zw1ss97Z ~]# ls /sbin|grep ifconfig
ifconfig
[root@iZ23zw1ss97Z ~]# 

如果没有,执行yum安装一下

yum install net-tools.x86_64

安装Oracle所需的依赖包

[root@iZ23zw1ss97Z ~]# yum -y install  gcc gcc-c++ make binutils compat-libstdc++-33 glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel unixODBC unixODBC-devel sysstat ksh

创建用户和组

[root@iZ23zw1ss97Z ~]# groupadd -g 200 oinstall    #添加oinstall组,组的id为200
[root@iZ23zw1ss97Z ~]# groupadd -g 201 dba         #添加dba组,组的id为201
[root@iZ23zw1ss97Z ~]# useradd -u 440 -g oinstall -G dba oracle  #添加用户oracle,并specified它的id为440
[root@iZ23zw1ss97Z ~]# passwd oracle #设置oracle用户的密码
Changing password for user oracle.
New password: 
BAD PASSWORD: The password contains the user name in some form
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@iZ23zw1ss97Z ~]# id oracle     #查看用户id和所属组
uid=440(oracle) gid=200(oinstall) groups=200(oinstall),201(dba)
[root@iZ23zw1ss97Z ~]# 

对oracle的操作,要使用oracle账号。

关闭SELINUX

阿里云缺省关闭

[root@iZ23zw1ss97Z ~]# cat /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 - No SELinux policy is loaded.
SELINUX=disabled #注释掉
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted #注释掉

[root@iZ23zw1ss97Z ~]# 

目录授权

[root@iZ23zw1ss97Z ~]# chown -R oracle:oinstall /data/oracle/
[root@iZ23zw1ss97Z ~]# cd /data/oracle/
[root@iZ23zw1ss97Z oracle]$ ll
total 2295604
-rw-r--r-- 1 oracle oinstall 1239269270 Jan  8 15:36 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 oracle oinstall 1111416131 Jan  8 15:36 linux.x64_11gR2_database_2of2.zip
[root@iZ23zw1ss97Z oracle]$  

切换到oracle用户下

解压服务器的/data/oracle/目录下
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

解压缩到/data/oracle/目录下,执行命令:

[root@iZ23zw1ss97Z ~]$ su - oracle
[oracle@iZ23zw1ss97Z ~]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/oracle
...
[oracle@iZ23zw1ss97Z ~]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/oracle
...
[oracle@iZ23zw1ss97Z ~]$ cd /data/oracle/
[oracle@iZ23zw1ss97Z oracle]$ ll
total 2295604
drwxr-xr-x 8 oracle oinstall       4096 Aug 21  2009 database
-rw-r--r-- 1 oracle oinstall 1239269270 Jan  8 15:36 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 oracle oinstall 1111416131 Jan  8 15:36 linux.x64_11gR2_database_2of2.zip
[oracle@iZ23zw1ss97Z oracle]$ 

配置安装参数

“vi /data/oracle/database/response/db_install.rsp”命令配置安装参数
修改后的db_install.rsp文件内容如下:

[oracle@iZ23zw1ss97Z response]$ cat db_install.rsp 
####################################################################
## 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
#选择安装类型:1.只装数据库软件 2.安装数据库软件并建库 3.升级数据库
#-------------------------------------------------------------------------------
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)
# 指定操作系统主机名,通过/etc/hosts命令获得
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=iZ23zw1ss97Z

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory. 
# 指定oracle inventory目录的所有者,通常会是oinstall或者dba 
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# 指定产品清单oracle inventory目录的路径
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/data/oraInventory

#-------------------------------------------------------------------------------
# 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
# 指定数据库语言,可以选择多个,用逗号隔开。选择en, zh_CN(英文和简体中文)
#------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
# 设置ORALCE_HOME的路径
#------------------------------------------------------------------------------
ORACLE_HOME=/data/oracle/product/11.2.0/db_1

#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base. 
# 设置ORALCE_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安装数据库软件的版本(EE-企业版,SE-标准版,SEONE-标准版1),不同的版本功能不同 
# 详细的版本区别参考附录D
#------------------------------------------------------------------------------
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的组件,如果选择false,则会使用默认的组件 
# 如果选择true否则需要自己在下面一条参数将要安装的组件一一列出。 
# 安装相应版权后会安装所有的组件,后期如果缺乏某个组件,再次安装会非常的麻烦。
#------------------------------------------------------------------------------
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.isCustomInstall=true 的话必须手工选择需要安装组件的话
#------------------------------------------------------------------------------
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.	      #
#                                                                             #
# 指定拥有OSDBA、OSOPER权限的用户组,通常会是dba组
###############################################################################

#------------------------------------------------------------------------------
# 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=oinstall

#------------------------------------------------------------------------------
# Specify the cluster node names selected during the installation.
# 如果是RAC的安装,在这里指定所有的节点
#------------------------------------------------------------------------------
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=GENERAL_PURPOSE

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

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

#------------------------------------------------------------------------------
# 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
#
# 选择字符集。不正确的字符集会给数据显示和存储带来麻烦无数。 
# 通常中文选择的有ZHS16GBK简体中文库,建议选择unicode的AL32UTF8国际字符集
#------------------------------------------------------------------------------
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.
# 11g的新特性自动内存管理,也就是SGA_TARGET和PAG_AGGREGATE_TARGET都#不用设置了,
# Oracle会自动调配两部分大小。
#------------------------------------------------------------------------------
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自动管理内存的大小,最小是512MB
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=1024

#------------------------------------------------------------------------------
# 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
# 数据库本地管理工具DB_CONTROL,远程集中管理工具GRID_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.control=DB_CONTROL

#-------------------------------------------------------------------------------
# Specify the Management Service to use if Grid Control is selected to manage 
# the database. #GRID_CONTROL需要设定grid control的远程路径URL  
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

#-------------------------------------------------------------------------------
# This variable indicates whether to receive email notification for critical 
# alerts when using DB control. #是否启用Email通知, 启用后会将告警等信息发送到指定邮箱
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

#-------------------------------------------------------------------------------
# Specify the email address to which the notifications are to be sent.
# 设置通知EMAIL地址
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.dbcontrol.emailAddress=

#-------------------------------------------------------------------------------
# Specify the SMTP server used for email notifications.
# 设置EMAIL邮件服务器
#-------------------------------------------------------------------------------
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.						      #	
#                                                                             #
# 安全及恢复设置(默认值即可)out-of-box(out-of-box experience)缩写为OOBE 
# 产品给用产品给用户良好第一印象和使用感受
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if automated backup is not required. Else 
# this can be set to true. #设置自动备份,和OUI里的自动备份一样。
#------------------------------------------------------------------------------
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. #自动备份会启动一个job,指定启动JOB的系统用户ID
#------------------------------------------------------------------------------
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. #自动备份会开启一个job,需要指定OSUser的密码
#-------------------------------------------------------------------------------
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
# - 自动备份,要求指定使用的文件系统存放数据库文件还是ASM
#------------------------------------------------------------------------------
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 
#
# 使用文件系统存放数据库文件才需要指定数据文件、控制文件、Redo log的存放目录
#-------------------------------------------------------------------------------
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
#
# 使用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 
#
# 使用ASM存放数据库文件才需要指定ASM实例密码
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
#  Example   : MYORACLESUPPORT_USERNAME=metalink
#
# 指定metalink账户用户名
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example    : MYORACLESUPPORT_PASSWORD=password
#
# 指定metalink账户密码
#------------------------------------------------------------------------------
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
#
# 用户是否可以设置metalink密码
#------------------------------------------------------------------------------
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
#
# False表示不需要设置安全更新,注意,在11.2的静默安装中疑似有一个BUG
# Response File中必须指定为true,否则会提示错误,不管是否正确填写了邮件地址
#------------------------------------------------------------------------------
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=
[oracle@iZ23zw1ss97Z response]$ 

安装Oracle

oracle账号登陆,在/data/oracle/database路径下执行

./runInstaller -silent -responseFile /data/oracle/database/response/db_install.rsp

出现[WARNING] [INS-32055] The Central Inventory is located in the Oracle base. 错误提示
如提示所言 Inventory 目录安装在了$ORACLE_BASE 目录下了,所以调整Inventory 目录不在$ORACLE_BASE 目录下,即可解决问题。

oraInventory 存放Oracle软件安装的目录信息,Oralce的安装和升级都需要用到这个目录,删除或丢失oraInventory目录的内容就会导致安装/升级失败。

出现[FATAL] [INS-32012] Unable to create directory.错误提示

“chown -R oracle:oinstall /data/oraInventory”命令,修改/data/oraInventory的所有者.

出现[FATAL] [INS-13013] Target environment do not meet some mandatory requirements.错误
使用下面的命令重试

./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /data/oracle/database/response/db_install.rsp
[oracle@iZ23zw1ss97Z database]$ ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /data/oracle/database/response/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 13443 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 999 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-01-08_09-37-07PM. Please wait ...
 You can find the log of this install session at:
 /data/oraInventory/logs/installActions2018-01-08_09-37-07PM.log

The following configuration scripts need to be executed as the "root" user. 
 #!/bin/sh 
 #Root scripts to run

/data/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
	 1. Open a terminal window 
	 2. Log in as "root" 
	 3. Run the scripts 
	 4. Return to this window and hit "Enter" key to continue 

Successfully Setup Software.

[oracle@iZ23zw1ss97Z database]$ 

等待几分钟后出现“Successfully Setup Software.”提示。

如果想看看安装过程,可以查看安装日志:

tail -99f /data/oraInventory/logs/installActions2018-01-08_09-37-07PM.log

安装好后会出现“/data/oracle/admin/orcl/pfile”文件夹,其中“orcl”是你oracle的SID,需要在环境变量中设置,否则启动listener会失败。

按照提示以root身份登录系统

执行下面一条命令

/data/oracle/product/11.2.0/db_1/root.sh

以oracle身份登录系统,设置环境变量

[oracle@iZ23zw1ss97Z database]$ cd ~
[oracle@iZ23zw1ss97Z ~]$ vi .bash_profile
[oracle@iZ23zw1ss97Z ~]$ source .bash_profile 
[oracle@iZ23zw1ss97Z ~]$ cat .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific 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/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
export TNS_ADMIN=$ORACLE_HOME/network/admin



[oracle@iZ23zw1ss97Z ~]$ 

为了使sqlplus能够访问远程oracle数据库,不但要配置“TNS_ADMIN”环境变量,还需要要环境变量指向的地址(我这里是/data/oracle/product/11.2.0/db_1/network/admin/)中放入tnsnames.ora文件

下面是我tnsnames.ora的内容,其中orcl是数据库名字。

[oracle@iZ23zw1ss97Z oracle]$ cd /data/oracle/product/11.2.0/db_1/network/admin/
[oracle@iZ23zw1ss97Z admin]$ ll
total 8
drwxr-xr-x 2 oracle oinstall 4096 Jan  8 17:50 samples
-rw-r--r-- 1 oracle oinstall  187 May  7  2007 shrept.lst
[oracle@iZ23zw1ss97Z admin]$ vi tnsnames.ora
[oracle@iZ23zw1ss97Z admin]$ pwd
/data/oracle/product/11.2.0/db_1/network/admin
[oracle@iZ23zw1ss97Z admin]$ cat tnsnames.ora 
aliecsoracle11g =  
  (DESCRIPTION =  
    (ADDRESS_LIST =  
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))  
    )  
    (CONNECT_DATA =  
      (SERVICE_NAME = orcl)  
    )  
  ) 
[oracle@iZ23zw1ss97Z admin]$ 

建库

用oracle账号调用下面的命令

#静默建库,需要配置dbca.rsp
cp -R /data/oracle/database/response/dbca.rsp /data/oracle/dbca.rsp
#配置dbca.rsp
vi /data/oracle/dbca.rsp
#执行配置好的dbca.rsp文件
dbca -silent -responseFile /data/oracle/dbca.rsp

 /data/oracle/dbca.rsp的内容

[root@iZ23zw1ss97Z db_1]# cat /data/oracle/dbca.rsp 
##############################################################################
##                                                                          ##
##                            DBCA response file                            ##
##                            ------------------                            ##
## Copyright   1998, 2007, Oracle Corporation. All Rights Reserved.         ##
##                                                                          ##
## Specify values for the variables listed below to customize Oracle        ##
## Database Configuration installation.                                     ##
##                                                                          ##
## Each variable is associated with a comment. The comment identifies the   ##
## variable type.                                                           ##
##                                                                          ##
## Please specify the values in the following format :                      ##
##          Type       :  Example                                           ##
##          String     :  ""                                         ##
##          Boolean    :  True or False                                     ##
##          Number     :                                     ##
##          StringList :  {"",""}                           ##
##                                                                          ##
## Examples :                                                               ##
##     1. dbca -progress_only -responseFile                  ##
##        Display a progress bar depicting progress of database creation    ##
##        process.                                                          ##
##                                                                          ##
##     2. dbca -silent -responseFile                         ##
##        Creates database silently. No user interface is displayed.        ##
##                                                                          ##
##     3. dbca -silent -createDatabase -cloneTemplate                       ##
##			 -responseFile                       ##
##        Creates database silently with clone template. The template in    ##
##	  responsefile is a clone template. 			            ##
##                                                                          ##
##     4. dbca -silent -deleteDatabase -responseFile         ##
##        Deletes database silently.                                        ##
##############################################################################

#-----------------------------------------------------------------------------
# GENERAL section is required for all types of database creations.
#-----------------------------------------------------------------------------
[GENERAL]

#-----------------------------------------------------------------------------
# Name          : RESPONSEFILE_VERSION
# Datatype      : String
# Description   : Version of the database to create
# Valid values  : "11.1.0"
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
RESPONSEFILE_VERSION = "11.2.0"

#-----------------------------------------------------------------------------
# Name          : OPERATION_TYPE
# Datatype      : String
# Description   : Type of operation
# Valid values  : "createDatabase" \ "createTemplateFromDB" \ "createCloneTemplate" \ "deleteDatabase" \ "configureDatabase" \ "addInstance" (RAC-only) \ "deleteInstance" (RAC-only)
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
OPERATION_TYPE = "createDatabase"

#-----------------------*** End of GENERAL section ***------------------------

#-----------------------------------------------------------------------------
# CREATEDATABASE section is used when OPERATION_TYPE is defined as "createDatabase". 
#-----------------------------------------------------------------------------
[CREATEDATABASE]

#-----------------------------------------------------------------------------
# Name          : GDBNAME
# Datatype      : String
# Description   : Global database name of the database
# Valid values  : . - when database domain isn't NULL
#                              - when database domain is NULL
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
GDBNAME = "orcl"

#-----------------------------------------------------------------------------
# Name          : POLICYMANAGED
# Datatype      : Boolean
# Description   : Set to true if Database is policy managed and 
#		  set to false if  Database is admin managed
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#POLICYMANAGED = "false"

#-----------------------------------------------------------------------------
# Name          : CREATESERVERPOOL
# Datatype      : Boolean
# Description   : Set to true if new server pool need to be created for database 
#		  if this option is specified then the newly created database 
#		  will use this newly created serverpool. 
#		  Multiple serverpoolname can not be specified for database
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#CREATESERVERPOOL = "false"

#-----------------------------------------------------------------------------
# Name          : FORCE
# Datatype      : Boolean
# Description   : Set to true if new server pool need to be created by force 
#		  if this option is specified then the newly created serverpool
#		  will be assigned server even if no free servers are available.
#		  This may affect already running database.
#		  This flag can be specified for Admin managed as well as policy managed db.
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#FORCE = "false"

#-----------------------------------------------------------------------------
# Name          : SERVERPOOLNAME
# Datatype      : String
# Description   : Only one serverpool name need to be specified 
#		   if Create Server Pool option is specified. 
#		   Comma-separated list of Serverpool names if db need to use
#		   multiple Server pool
# Valid values  : ServerPool name
# Default value : None
# Mandatory     : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
#SERVERPOOLNAME = 

#-----------------------------------------------------------------------------
# Name          : CARDINALITY
# Datatype      : Number
# Description   : Specify Cardinality for create server pool operation
# Valid values  : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory     : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
#CARDINALITY = 

#-----------------------------------------------------------------------------
# Name          : SID
# Datatype      : String
# Description   : System identifier (SID) of the database
# Valid values  : Check Oracle11g Administrator's Guide
# Default value :  specified in GDBNAME
# Mandatory     : No
#-----------------------------------------------------------------------------
SID = "orcl"

#-----------------------------------------------------------------------------
# Name          : NODELIST
# Datatype      : String
# Description   : Comma-separated list of cluster nodes
# Valid values  : Cluster node names
# Default value : None
# Mandatory     : No (Yes for RAC database-centric database )
#-----------------------------------------------------------------------------
#NODELIST=

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template file name
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
TEMPLATENAME = "General_Purpose.dbc"

#-----------------------------------------------------------------------------
# Name          : OBFUSCATEDPASSWORDS
# Datatype      : Boolean
# Description   : Set to true if passwords are encrypted
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#OBFUSCATEDPASSWORDS = FALSE


#-----------------------------------------------------------------------------
# Name          : SYSPASSWORD
# Datatype      : String
# Description   : Password for SYS user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSPASSWORD = "pwdOrcl123"

#-----------------------------------------------------------------------------
# Name          : SYSTEMPASSWORD
# Datatype      : String
# Description   : Password for SYSTEM user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
SYSTEMPASSWORD = "pwdOrcl123"

#-----------------------------------------------------------------------------
# Name          : EMCONFIGURATION
# Datatype      : String
# Description   : Enterprise Manager Configuration Type
# Valid values  : CENTRAL|LOCAL|ALL|NOBACKUP|NOEMAIL|NONE
# Default value : NONE
# Mandatory     : No
#-----------------------------------------------------------------------------
#EMCONFIGURATION = "NONE"

#-----------------------------------------------------------------------------
# Name          : DISABLESECURITYCONFIGURATION
# Datatype      : String
# Description   : Database Security Settings
# Valid values  : ALL|NONE|AUDIT|PASSWORD_PROFILE
# Default value : NONE
# Mandatory     : No
#-----------------------------------------------------------------------------
#DISABLESECURITYCONFIGURATION = "NONE"


#-----------------------------------------------------------------------------
# Name          : SYSMANPASSWORD
# Datatype      : String
# Description   : Password for SYSMAN user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if LOCAL specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#SYSMANPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : DBSNMPPASSWORD
# Datatype      : String
# Description   : Password for DBSNMP user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if EMCONFIGURATION is specified
#-----------------------------------------------------------------------------
#DBSNMPPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : CENTRALAGENT
# Datatype      : String
# Description   : Grid Control Central Agent Oracle Home
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#CENTRALAGENT = 

#-----------------------------------------------------------------------------
# Name          : HOSTUSERNAME
# Datatype      : String
# Description   : Host user name for EM backup job
# Default value : None
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#HOSTUSERNAME = 

#-----------------------------------------------------------------------------
# Name          : HOSTUSERPASSWORD
# Datatype      : String
# Description   : Host user password for EM backup job
# Default value : None
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#HOSTUSERPASSWORD= 

#-----------------------------------------------------------------------------
# Name          : BACKUPSCHEDULE
# Datatype      : String
# Description   : Daily backup schedule in the form of hh:mm
# Default value : 2:00
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#BACKUPSCHEDULE=

#-----------------------------------------------------------------------------
# Name          : SMTPSERVER
# Datatype      : String
# Description   : Outgoing mail (SMTP) server for email notifications
# Default value : None
# Mandatory     : Yes, if ALL or NOBACKUP are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#SMTPSERVER =

#-----------------------------------------------------------------------------
# Name          : EMAILADDRESS
# Datatype      : String
# Description   : Email address for email notifications
# Default value : None
# Mandatory     : Yes, if ALL or NOBACKUP are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#EMAILADDRESS =

#-----------------------------------------------------------------------------
# Name          : DVOWNERNAME
# Datatype      : String
# Description   : DataVault Owner
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
#DVOWNERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVOWNERPASSWORD
# Datatype      : String
# Description   : Password for DataVault Owner
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
#DVOWNERPASSWORD = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERNAME
# Datatype      : String
# Description   : DataVault Account Manager
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#DVACCOUNTMANAGERNAME = ""

#-----------------------------------------------------------------------------
# Name          : DVACCOUNTMANAGERPASSWORD
# Datatype      : String
# Description   : Password for  DataVault Account Manager
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#DVACCOUNTMANAGERPASSWORD = ""



#-----------------------------------------------------------------------------
# Name          : DATAFILEJARLOCATION 
# Datatype      : String
# Description   : Location of the data file jar 
# Valid values  : Directory containing compressed datafile jar
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#DATAFILEJARLOCATION =

#-----------------------------------------------------------------------------
# Name          : DATAFILEDESTINATION 
# Datatype      : String
# Description   : Location of the data file's
# Valid values  : Directory for all the database files
# Default value : $ORACLE_BASE/oradata
# Mandatory     : No
#-----------------------------------------------------------------------------
#DATAFILEDESTINATION =

#-----------------------------------------------------------------------------
# Name          : RECOVERYAREADESTINATION
# Datatype      : String
# Description   : Location of the data file's
# Valid values  : Recovery Area location
# Default value : $ORACLE_BASE/flash_recovery_area
# Mandatory     : No
#-----------------------------------------------------------------------------
#RECOVERYAREADESTINATION=

#-----------------------------------------------------------------------------
# Name          : STORAGETYPE
# Datatype      : String
# Description   : Specifies the storage on which the database is to be created
# Valid values  : FS (CFS for RAC), ASM
# Default value : FS
# Mandatory     : No
#-----------------------------------------------------------------------------
#STORAGETYPE=FS

#-----------------------------------------------------------------------------
# Name          : DISKGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory     : No
#-----------------------------------------------------------------------------
#DISKGROUPNAME=DATA

#-----------------------------------------------------------------------------
# Name          : ASMSNMP_PASSWORD
# Datatype      : String
# Description   : Password for ASM Monitoring
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#ASMSNMP_PASSWORD=""

#-----------------------------------------------------------------------------
# Name          : RECOVERYGROUPNAME
# Datatype      : String
# Description   : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory     : No
#-----------------------------------------------------------------------------
#RECOVERYGROUPNAME=RECOVERY


#-----------------------------------------------------------------------------
# Name          : CHARACTERSET
# Datatype      : String
# Description   : Character set of the database
# Valid values  : Check Oracle11g National Language Support Guide
# Default value : "US7ASCII"
# Mandatory     : NO
#-----------------------------------------------------------------------------
CHARACTERSET = "ZHS16GBK"

#-----------------------------------------------------------------------------
# Name          : NATIONALCHARACTERSET
# Datatype      : String
# Description   : National Character set of the database
# Valid values  : "UTF8" or "AL16UTF16". For details, check Oracle11g National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory     : No
#-----------------------------------------------------------------------------
NATIONALCHARACTERSET= "UTF8"

#-----------------------------------------------------------------------------
# Name          : REGISTERWITHDIRSERVICE
# Datatype      : Boolean
# Description   : Specifies whether to register with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#REGISTERWITHDIRSERVICE= TRUE

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEUSERNAME
# Datatype      : String
# Description   : Specifies the name of the directory service user
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
#DIRSERVICEUSERNAME= "name"

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEPASSWORD
# Datatype      : String
# Description   : The password of the directory service user.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
#DIRSERVICEPASSWORD= "password"

#-----------------------------------------------------------------------------
# Name          : WALLETPASSWORD
# Datatype      : String
# Description   : The password for wallet to created or modified.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
#WALLETPASSWORD= "password"

#-----------------------------------------------------------------------------
# Name          : LISTENERS
# Datatype      : String
# Description   : Specifies list of listeners to register the database with.
#		  By default the database is configured for all the listeners specified in the 
#		  $ORACLE_HOME/network/admin/listener.ora 	
# Valid values  : The list should be space separated names like "listener1 listener2".
# Mandatory     : NO
#-----------------------------------------------------------------------------
#LISTENERS = "listener1 listener2"

#-----------------------------------------------------------------------------
# Name          : VARIABLESFILE 
# Datatype      : String
# Description   : Location of the file containing variable value pair
# Valid values  : A valid file-system file. The variable value pair format in this file 
#		  is =. Each pair should be in a new line.
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
#VARIABLESFILE =

#-----------------------------------------------------------------------------
# Name          : VARIABLES
# Datatype      : String
# Description   : comma separated list of name=value pairs. Overrides variables defined in variablefile and templates
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
#VARIABLES =

#-----------------------------------------------------------------------------
# Name          : INITPARAMS
# Datatype      : String
# Description   : comma separated list of name=value pairs. Overrides initialization parameters defined in templates
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
#INITPARAMS =

#-----------------------------------------------------------------------------
# Name          : MEMORYPERCENTAGE
# Datatype      : String
# Description   : percentage of physical memory for Oracle
# Default value : None
# Mandatory     : NO
#-----------------------------------------------------------------------------
#MEMORYPERCENTAGE = "40"

#-----------------------------------------------------------------------------
# Name          : DATABASETYPE
# Datatype      : String
# Description   : used for memory distribution when MEMORYPERCENTAGE specified
# Valid values  : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory     : NO
#-----------------------------------------------------------------------------
DATABASETYPE = "OLTP"

#-----------------------------------------------------------------------------
# Name          : AUTOMATICMEMORYMANAGEMENT
# Datatype      : Boolean
# Description   : flag to indicate Automatic Memory Management is used
# Valid values  : TRUE/FALSE
# Default value : TRUE
# Mandatory     : NO
#-----------------------------------------------------------------------------
AUTOMATICMEMORYMANAGEMENT = "TRUE"

#-----------------------------------------------------------------------------
# Name          : TOTALMEMORY
# Datatype      : String
# Description   : total memory in MB to allocate to Oracle
# Valid values  : 
# Default value : 
# Mandatory     : NO
#-----------------------------------------------------------------------------
TOTALMEMORY = "1024"


#-----------------------*** End of CREATEDATABASE section ***------------------------

#-----------------------------------------------------------------------------
# createTemplateFromDB section is used when OPERATION_TYPE is defined as "createTemplateFromDB". 
#-----------------------------------------------------------------------------
[createTemplateFromDB]
#-----------------------------------------------------------------------------
# Name          : SOURCEDB 
# Datatype      : String
# Description   : The source database from which to create the template
# Valid values  : The format is ::
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SOURCEDB = "myhost:1521:orcl"

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME 
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SYSDBAUSERNAME = "system"

#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD 
# Datatype      : String
# Description   : The password of the DBA user.
#		  You can also specify the password at the command prompt instead of here.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name for the new template.
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
TEMPLATENAME = "My Copy TEMPLATE"

#-----------------------*** End of createTemplateFromDB section ***------------------------

#-----------------------------------------------------------------------------
# createCloneTemplate section is used when OPERATION_TYPE is defined as "createCloneTemplate". 
#-----------------------------------------------------------------------------
[createCloneTemplate]
#-----------------------------------------------------------------------------
# Name          : SOURCEDB
# Datatype      : String
# Description   : The source database is the SID from which to create the template. 
#		  This database must be local and on the same ORACLE_HOME.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SOURCEDB = "orcl"

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES, if no OS authentication
#-----------------------------------------------------------------------------
#SYSDBAUSERNAME = "sys"

#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD
# Datatype      : String
# Description   : The password of the DBA user.
#		  You can also specify the password at the command prompt instead of here.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name for the new template.
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
TEMPLATENAME = "My Clone TEMPLATE"

#-----------------------------------------------------------------------------
# Name          : DATAFILEJARLOCATION
# Datatype      : String
# Description   : Location of the data file jar 
# Valid values  : Directory where the new compressed datafile jar will be placed
# Default value : $ORACLE_HOME/assistants/dbca/templates
# Mandatory     : NO
#-----------------------------------------------------------------------------
#DATAFILEJARLOCATION = 

#-----------------------*** End of createCloneTemplate section ***------------------------

#-----------------------------------------------------------------------------
# DELETEDATABASE section is used when DELETE_TYPE is defined as "deleteDatabase". 
#-----------------------------------------------------------------------------
[DELETEDATABASE]
#-----------------------------------------------------------------------------
# Name          : SOURCEDB
# Datatype      : String
# Description   : The source database is the SID 
#		  This database must be local and on the same ORACLE_HOME.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SOURCEDB = "orcl"

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES, if no OS authentication
#-----------------------------------------------------------------------------
#SYSDBAUSERNAME = "sys"

#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD
# Datatype      : String
# Description   : The password of the DBA user.
#		  You can also specify the password at the command prompt instead of here.
# Default value : none
# Mandatory     : YES, if no OS authentication
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD = "password"
#-----------------------*** End of deleteDatabase section ***------------------------

#-----------------------------------------------------------------------------
# GENERATESCRIPTS section 
#-----------------------------------------------------------------------------
[generateScripts]
#-----------------------------------------------------------------------------
# Name          : TEMPLATENAME
# Datatype      : String
# Description   : Name of the template
# Valid values  : Template name as seen in DBCA
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
TEMPLATENAME = "New Database"

#-----------------------------------------------------------------------------
# Name          : GDBNAME
# Datatype      : String
# Description   : Global database name of the database
# Valid values  : . - when database domain isn't NULL
#                              - when database domain is NULL
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
GDBNAME = "orcl11.us.oracle.com"

#-----------------------------------------------------------------------------
# Name          : SCRIPTDESTINATION 
# Datatype      : String
# Description   : Location of the scripts
# Valid values  : Directory for all the scripts
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#SCRIPTDESTINATION =

#-----------------------*** End of deleteDatabase section ***------------------------

#-----------------------------------------------------------------------------
# CONFIGUREDATABASE section is used when OPERATION_TYPE is defined as "configureDatabase". 
#-----------------------------------------------------------------------------
[CONFIGUREDATABASE]

#-----------------------------------------------------------------------------
# Name          : SOURCEDB
# Datatype      : String
# Description   : The source database is the SID 
#		  This database must be local and on the same ORACLE_HOME.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
#SOURCEDB = "orcl"

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES, if no OS authentication
#-----------------------------------------------------------------------------
#SYSDBAUSERNAME = "sys"


#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD
# Datatype      : String
# Description   : The password of the DBA user.
#		  You can also specify the password at the command prompt instead of here.
# Default value : none
# Mandatory     : YES, if no OS authentication
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD =

#-----------------------------------------------------------------------------
# Name          : REGISTERWITHDIRSERVICE
# Datatype      : Boolean
# Description   : Specifies whether to register with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#REGISTERWITHDIRSERVICE= TRUE

#-----------------------------------------------------------------------------
# Name          : UNREGISTERWITHDIRSERVICE
# Datatype      : Boolean
# Description   : Specifies whether to unregister with Directory Service.
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#UNREGISTERWITHDIRSERVICE= TRUE

#-----------------------------------------------------------------------------
# Name          : REGENERATEDBPASSWORD
# Datatype      : Boolean
# Description   : Specifies whether regenerate database password in OID/Wallet
# Valid values  : TRUE \ FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#REGENERATEDBPASSWORD= TRUE

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEUSERNAME
# Datatype      : String
# Description   : Specifies the name of the directory service user
# Mandatory     : YES, if the any of the reg/unreg/regenPasswd options specified
#-----------------------------------------------------------------------------
#DIRSERVICEUSERNAME= "name"

#-----------------------------------------------------------------------------
# Name          : DIRSERVICEPASSWORD
# Datatype      : String
# Description   : The password of the directory service user.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the any of the reg/unreg/regenPasswd options specified
#-----------------------------------------------------------------------------
#DIRSERVICEPASSWORD= "password"

#-----------------------------------------------------------------------------
# Name          : WALLETPASSWORD
# Datatype      : String
# Description   : The password for wallet to created or modified.
#		  You can also specify the password at the command prompt instead of here.
# Mandatory     : YES, if the any of the reg/unreg/regenPasswd options specified
#-----------------------------------------------------------------------------
#WALLETPASSWORD= "password"

#-----------------------------------------------------------------------------
# Name          : DISABLESECURITYCONFIGURATION
# Datatype      : String
# Description   : Database Security Settings
# Valid values  : ALL|NONE|AUDIT|PASSWORD_PROFILE
# Default value : NONE
# Mandatory     : No
#-----------------------------------------------------------------------------
#DISABLESECURITYCONFIGURATION = "NONE"



#-----------------------------------------------------------------------------
# Name          : ENABLESECURITYCONFIGURATION
# Datatype      : String
# Description   : Database Security Settings
# Valid values  : true|false
# Default value : true
# Mandatory     : No
#-----------------------------------------------------------------------------
#ENABLESECURITYCONFIGURATION = "true"


#-----------------------------------------------------------------------------
# Name          : EMCONFIGURATION
# Datatype      : String
# Description   : Enterprise Manager Configuration Type
# Valid values  : CENTRAL|LOCAL|ALL|NOBACKUP|NOEMAIL|NONE
# Default value : NONE
# Mandatory     : No
#-----------------------------------------------------------------------------
#EMCONFIGURATION = "NONE"

#-----------------------------------------------------------------------------
# Name          : SYSMANPASSWORD
# Datatype      : String
# Description   : Password for SYSMAN user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if LOCAL specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#SYSMANPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : DBSNMPPASSWORD
# Datatype      : String
# Description   : Password for DBSNMP user
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes, if EMCONFIGURATION is specified
#-----------------------------------------------------------------------------
#DBSNMPPASSWORD = "password"

#-----------------------------------------------------------------------------
# Name          : CENTRALAGENT
# Datatype      : String
# Description   : Grid Control Central Agent Oracle Home
# Default value : None
# Mandatory     : Yes, if CENTRAL is specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#CENTRALAGENT = 

#-----------------------------------------------------------------------------
# Name          : HOSTUSERNAME
# Datatype      : String
# Description   : Host user name for EM backup job
# Default value : None
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#HOSTUSERNAME = 

#-----------------------------------------------------------------------------
# Name          : HOSTUSERPASSWORD
# Datatype      : String
# Description   : Host user password for EM backup job
# Default value : None
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#HOSTUSERPASSWORD= 

#-----------------------------------------------------------------------------
# Name          : BACKUPSCHEDULE
# Datatype      : String
# Description   : Daily backup schedule in the form of hh:mm
# Default value : 2:00
# Mandatory     : Yes, if ALL or NOEMAIL are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#BACKUPSCHEDULE=

#-----------------------------------------------------------------------------
# Name          : SMTPSERVER
# Datatype      : String
# Description   : Outgoing mail (SMTP) server for email notifications
# Default value : None
# Mandatory     : Yes, if ALL or NOBACKUP are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#SMTPSERVER =

#-----------------------------------------------------------------------------
# Name          : EMAILADDRESS
# Datatype      : String
# Description   : Email address for email notifications
# Default value : None
# Mandatory     : Yes, if ALL or NOBACKUP are specified for EMCONFIGURATION
#-----------------------------------------------------------------------------
#EMAILADDRESS =

#-----------------------*** End of CONFIGUREDATABASE section ***------------------------


#-----------------------------------------------------------------------------
# ADDINSTANCE section is used when OPERATION_TYPE is defined as "addInstance". 
#-----------------------------------------------------------------------------
[ADDINSTANCE]

#-----------------------------------------------------------------------------
# Name          : DB_UNIQUE_NAME
# Datatype      : String
# Description   : DB Unique Name of the RAC database
# Valid values  : 
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"

#-----------------------------------------------------------------------------
# Name          : INSTANCENAME
# Datatype      : String
# Description   : RAC instance name to be added
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : +
# Mandatory     : No
#-----------------------------------------------------------------------------
#INSTANCENAME = "orcl1"

#-----------------------------------------------------------------------------
# Name          : NODELIST
# Datatype      : String
# Description   : Node on which to add new instance 
#                 (in 10gR2, instance addition is supported on 1 node at a time)
# Valid values  : Cluster node name
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
NODELIST=

#-----------------------------------------------------------------------------
# Name          : OBFUSCATEDPASSWORDS
# Datatype      : Boolean
# Description   : Set to true if passwords are encrypted
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#OBFUSCATEDPASSWORDS = FALSE

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME 
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SYSDBAUSERNAME = "sys"

#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD 
# Datatype      : String
# Description   : The password of the DBA user.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD = "password"

#-----------------------*** End of ADDINSTANCE section ***------------------------


#-----------------------------------------------------------------------------
# DELETEINSTANCE section is used when OPERATION_TYPE is defined as "deleteInstance". 
#-----------------------------------------------------------------------------
[DELETEINSTANCE]

#-----------------------------------------------------------------------------
# Name          : DB_UNIQUE_NAME
# Datatype      : String
# Description   : DB Unique Name of the RAC database
# Valid values  : 
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"

#-----------------------------------------------------------------------------
# Name          : INSTANCENAME
# Datatype      : String
# Description   : RAC instance name to be deleted
# Valid values  : Check Oracle11g Administrator's Guide
# Default value : None
# Mandatory     : Yes
#-----------------------------------------------------------------------------
INSTANCENAME = "orcl11g"

#-----------------------------------------------------------------------------
# Name          : NODELIST
# Datatype      : String
# Description   : Node on which instance to be deleted (SID) is located
# Valid values  : Cluster node name
# Default value : None
# Mandatory     : No
#-----------------------------------------------------------------------------
#NODELIST=

#-----------------------------------------------------------------------------
# Name          : OBFUSCATEDPASSWORDS
# Datatype      : Boolean
# Description   : Set to true if passwords are encrypted
# Valid values  : TRUE\FALSE
# Default value : FALSE
# Mandatory     : No
#-----------------------------------------------------------------------------
#OBFUSCATEDPASSWORDS = FALSE

#-----------------------------------------------------------------------------
# Name          : SYSDBAUSERNAME 
# Datatype      : String
# Description   : A user with DBA role.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
SYSDBAUSERNAME = "sys"

#-----------------------------------------------------------------------------
# Name          : SYSDBAPASSWORD 
# Datatype      : String
# Description   : The password of the DBA user.
# Default value : none
# Mandatory     : YES
#-----------------------------------------------------------------------------
#SYSDBAPASSWORD = "password"


#-----------------------*** End of DELETEINSTANCE section ***------------------------
[root@iZ23zw1ss97Z db_1]# 

出现安装进度,需要等待几分钟

[oracle@iZ23zw1ss97Z admin]$ cp /data/oracle/database/response/dbca.rsp /data/oracle/                                           
[oracle@iZ23zw1ss97Z admin]$ vi /data/oracle/dbca.rsp                                             
[oracle@iZ23zw1ss97Z admin]$ dbca -silent -responseFile /data/oracle/dbca.rsp                                               
Copying database files                                                                                                                       
1% complete                                                                                                                                  
3% complete                                                                                                                                  
11% complete                                                                                                                                 
18% complete                                                                                                                                 
26% complete                                                                                                                                 
37% complete                                                                                                                                 
Creating and starting Oracle instance                                                                                                        
40% complete                                                                                                                                 
45% complete                                                                                                                                 
50% complete                                                                                                                                 
55% complete                                                                                                                                 
56% complete                                                                                                                                 
60% complete                                                                                                                                 
62% complete                                                                                                                                 
Completing Database Creation                                                                                                                 
66% complete                                                                                                                                 
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/data/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@iZ23zw1ss97Z admin]$ 

验证Oracle安装是否成功

[oracle@iZ23zw1ss97Z oracle]$ sqlplus "/as sysdba"                                                                                                                                             
                                                                                                                                                                                               
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 8 22:03:29 2018                                                                                                                             

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/data/oracle/oradata/orcl/system01.dbf
/data/oracle/oradata/orcl/sysaux01.dbf
/data/oracle/oradata/orcl/undotbs01.dbf
/data/oracle/oradata/orcl/users01.dbf

SQL> 

新建listener.ora文件

在“/data/oracle/product/11.2.0/db_1/network/admin/”路径下新建listener.ora文件
内容如下

[oracle@iZ23zw1ss97Z admin]$ vi listener.ora
[oracle@iZ23zw1ss97Z admin]$ cat listener.ora 
# copyright (c) 1997 by the Oracle Corporation  
#   
# NAME  
#   listener.ora  
# FUNCTION  
#   Network Listener startup parameter file example  
# NOTES  
#   This file contains all the parameters for listener.ora,  
#   and could be used to configure the listener by uncommenting  
#   and changing values.  Multiple listeners can be configured  
#   in one listener.ora, so listener.ora parameters take the form  
#   of SID_LIST_, where  is the name of the listener  
#   this parameter refers to.  All parameters and values are  
#   case-insensitive.  
  
#   
#   This parameter specifies both the name of the listener, and  
#   it listening address(es). Other parameters for this listener  
#   us this name in place of .  When not specified,  
#   the name for  defaults to "LISTENER", with the default  
#   address value as shown below.  
#  
# LISTENER =  
#  (ADDRESS_LIST=  
#   (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))  
#   (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))     
LISTENER=
    (DESCRIPTION_LIST=
	(DESCRIPTION=  
      	(ADDRESS=
		(PROTOCOL=TCP)
		(HOST=121.40.136.***)
		(PORT=1521))
  	)  
    )  
  
# SID_LIST_  
#   List of services the listener knows about and can connect   
#   clients to.  There is no default.  See the Net8 Administrator's  
#   Guide for more information.  
#  
# SID_LIST_LISTENER=  
#   (SID_LIST=  
#   (SID_DESC=  
#           #BEQUEATH CONFIG  
#          (GLOBAL_DBNAME=salesdb.mycompany)  
#          (SID_NAME=sid1)            
#          (ORACLE_HOME=/private/app/oracle/product/8.0.3)  
#           #PRESPAWN CONFIG  
#         (PRESPAWN_MAX=20)  
#     (PRESPAWN_LIST=  
#           (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))  
#         )  
#        )  
#       )  
  
SID_LIST_LISTENER=  
  (SID_LIST=  
      (SID_DESC=  
         (GLOBAL_DBNAME=orcl)  
         (SID_NAME=orcl11g)  
         (ORACLE_HOME=/data/oracle/product/11.2.0/db_1)  
        (PRESPAWN_MAX=20)  
        (PRESPAWN_LIST=  
          (PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))  
        )  
       )  
      )  
      
# PASSWORDS_  
#   Specifies a password to authenticate stopping the listener.  
#   Both encrypted and plain-text values can be set.  Encrypted passwords  
#   can be set and stored using lsnrctl.    
#     LSNRCTL> change_password  
#       Will prompt for old and new passwords, and use encryption both  
#       to match the old password and to set the new one.  
#     LSNRCTL> set password  
#   Will prompt for the new password, for authentication with   
#       the listener. The password must be set before running the next  
#       command.  
#     LSNRCTL> save_config  
#       Will save the changed password to listener.ora. These last two  
#       steps are not necessary if SAVE_CONFIG_ON_STOP_ is ON.  
#       See below.  
#  
# Default: NONE  
#  
# PASSWORDS_LISTENER = 20A22647832FB454      # "foobar"  
  
# SAVE_CONFIG_ON_STOP_  
#   Tells the listener to save configuration changes to listener.ora when  
#   it shuts down.  Changed parameter values will be written to the file,  
#   while preserving formatting and comments.  
# Default: OFF  
# Values: ON/OFF  
#  
# SAVE_CONFIG_ON_STOP_LISTENER = ON  
  
# USE_PLUG_AND_PLAY_  
#   Tells the listener to contact an Onames server and register itself  
#   and its services with Onames.  
# Values: ON/OFF  
# Default: OFF  
#  
# USE_PLUG_AND_PLAY_LISTENER = ON  
  
# LOG_FILE_  
#   Sets the name of the listener's log file.  The .log extension  
#   is added automatically.  
# Default=  
#  
# LOG_FILE_LISTENER = lsnr  
  
# LOG_DIRECTORY_  
#   Sets the directory for the listener's log file.  
# Default: /network/log  
#  
# LOG_DIRECTORY_LISTENER = /private/app/oracle/product/8.0.3/network/log  
  
# TRACE_LEVEL_  
#   Specifies desired tracing level.  
# Default: OFF  
# Values: OFF/USER/ADMIN/SUPPORT/0-16  
#  
# TRACE_LEVEL_LISTENER = SUPPORT  
  
# TRACE_FILE_  
#   Sets the name of the listener's trace file. The .trc extension  
#   is added automatically.  
# Default:   
#  
# TRACE_FILE_LISTENER = lsnr  
  
# TRACE_DIRECTORY_  
#   Sets the directory for the listener's trace file.  
# Default: /network/trace  
#  
# TRACE_DIRECTORY_LISTENER=/private/app/oracle/product/8.0.3/network/trace  
# CONNECT_TIMEOUT_  
#   Sets the number of seconds that the listener waits to get a   
#   valid database query after it has been started.  
# Default: 10  
#  
# CONNECT_TIMEOUT_LISTENER=10 
[oracle@iZ23zw1ss97Z admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 08-JAN-2018 22:14:00

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /data/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/iZ23zw1ss97Z/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=121.40.136.207)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=121.40.136.207)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                08-JAN-2018 22:14:01
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/iZ23zw1ss97Z/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=121.40.136.***)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl11g", status UNKNOWN, has 3 handler(s) for this service...
The command completed successfully
[oracle@iZ23zw1ss97Z admin]$ 

监听启动不了,解决方法如下: 

[oracle@iZ23zw1ss97Z alert]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 08-JAN-2018 23:37:15

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /data/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/iZ23zw1ss97Z/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZ23zw1ss97Z)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=iZ23zw1ss97Z)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                08-JAN-2018 23:37:15
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/iZ23zw1ss97Z/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZ23zw1ss97Z)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 3 handler(s) for this service...
The command completed successfully
[oracle@iZ23zw1ss97Z alert]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 8 23:37:51 2018

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> alter system register;

System altered.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@iZ23zw1ss97Z alert]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 08-JAN-2018 23:38:27

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=iZ23zw1ss97Z)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                08-JAN-2018 23:37:15
Uptime                    0 days 0 hr. 1 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/iZ23zw1ss97Z/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=iZ23zw1ss97Z)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
Services Summary...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 3 handler(s) for this service...
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@iZ23zw1ss97Z alert]$ 

 

转载于:https://my.oschina.net/90888/blog/1604052

你可能感兴趣的:(阿里云ECS,CentOS7下安装部署Oracle11gR2环境)