Linux-CentOS 安装及配置 Oracle 服务器端

Cover


准备

  • 版本

    Oracle 11gR2

  • 下载

    通过官网链接 ,下载 Oracle, 下载地址如下:

    http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?spm=a2c4e.11153940.blogcont566703.10.36ae6c23iChOrf

    下载文件包括:linux.x64_11gR2_database_1of2.ziplinux.x64_11gR2_database_2of2.zip 两个文件。

  • 检查

    1. 查看操作系统版本:

      1
      # cat /etc/redhat-release
    2. 查看内核版本:

      1
      # uname -r
    3. 查看系统内存大小(oracle 11g官方建议物理内存在2G以上):

      1
      # cat /proc/meminfo | grep MemTotal
    4. 检查防火墙:

      查看防火墙状态

      1
      # systemctl status firewalld 

      关闭防火墙

      1
      # systemctl stop firewalld

      关闭自启动

      1
      2
      3
      # systemctl is-enabled firewalld
      # systemctl disable firewalld
      # systemctl is-enabled firewalld
    5. 关闭selinux:

      1
      2
      # sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
      # setenforce 0
    6. 安装相关依赖包:

      1
      # yum -y install binutils compat-libstdc++-33 compat-libcap1 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make elfutils-libelf-devel sysstat
    7. 设置/dev/shm空间:

      修改文件 /etc/fstab

      1
      # vi /etc/fstab

      在文件末尾追加内容

      1
      shmfs                     /dev/shm            tmpfs   size=7g         0 0

      执行一下命令

      1
      2
      # mount -a
      # df -Th

安装

  • 用户创建

    1
    2
    3
    4
    5
    6
    7
    # /usr/sbin/groupadd oinstall 
    # /usr/sbin/groupadd dba
    # /usr/sbin/groupadd asmadmin
    # /usr/sbin/groupadd asmdba
    # /usr/sbin/useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
    # id oracle
    # passwd oracle
  • 内核参数调整

    编辑文件 /etc/sysctl.conf

    1
    # vi /etc/sysctl.conf

    在文件末尾追加以下内容

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    kernel.shmall = 2097152
    kernel.shmmax = 4294967295
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 6553600
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default = 4194304
    net.core.rmem_max = 4194304
    net.core.wmem_default = 262144
    net.core.wmem_max = 262144

    重载配置信息

    1
    # sysctl -p
  • shell 限制新增

    编辑文件 /etc/security/limits.conf

    1
    # vi /etc/security/limits.conf

    追加内容如下

    1
    2
    3
    4
    5
    6
    oracle   soft    nproc    2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle soft stack 10240
    oracle hard stack 10240

    编辑文件 /etc/pam.d/login

    1
    # vi /etc/pam.d/login

    追加内容如下

    1
    2
    session   required    /lib/security/pam_limits.so
    session required pam_limits.so

    编辑文件 /etc/profile

    1
    # vi /etc/profile

    追加内容如下

    1
    2
    3
    4
    5
    6
    7
    8
    if [ $USER = "oracle" ]; then
    if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi
  • 创建安装目录及赋权

    创建安装目录 /home/app/oracle/

    1
    # mkdir -p /home/app/oracle/

    授权操作

    1
    2
    3
    4
    # chown -R oracle:oinstall /home/app/
    # chmod -R 755 /home/app/
    # chown -R oracle:oinstall /home/oracle
    # chmod -R 775 /home/oracle

    配置 /etc/hosts 文件

    1
    # vi /etc/hosts

    末尾添加以下内容

    1
    192.168.187.130     oracle
  • 配置 oracle 用户的环境变量

    切换到 oracle 用户

    1
    # su - oracle

    编辑环境变量文件 ~/.bash_profile

    1
    # vi ~/.bash_profile

    追加如下内容

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    export ORACLE_HOSTNAME=oracle
    export ORACLE_UNQNAME=orcl
    export ORACLE_BASE=/home/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/
    export ORACLE_SID=ORCL
    export PATH=/usr/sbin:$PATH
    export PATH=$ORACLE_HOME/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
    export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
    export TMP=/tmp
    export TMPDIR=$TMP
    umask 022
  • 解压 oracle 安装文件

    执行以下命令解压 oracle 安装文件

    1
    2
    # unzip linux.x64_11gR2_database_1of2.zip
    # unzip linux.x64_11gR2_database_2of2.zip
  • 修改响应文件

    创建存放 oracle 安装配置文件目录 scripts

    1
    # mkdir scripts

    复制配置文件至 scripts

    1
    # cp -R database/response/ scripts/

    修改配置文件 scripts/response/db_install.rsp

    1
    # vi scripts/response/db_install.rsp

    将以下参数进行修改、设置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    oracle.install.option=INSTALL_DB_SWONLY
    ORACLE_HOSTNAME=oracle
    UNIX_GROUP_NAME=oinstall
    INVENTORY_LOCATION=/home/app/oracle/oraInventory
    SELECTED_LANGUAGES=en,zh_CN
    ORACLE_HOME=/home/app/oracle/product/11.2.0
    ORACLE_BASE=/home/app/oracle
    oracle.install.db.InstallEdition=EE
    oracle.install.db.isCustomInstall=true
    oracle.install.db.DBA_GROUP=dba
    oracle.install.db.OPER_GROUP=oinstall
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
    oracle.install.db.config.starterdb.globalDBName=ORCL
    oracle.install.db.config.starterdb.SID=ORCL
    oracle.install.db.config.starterdb.characterSet=ZHS16GBK
    oracle.install.db.config.starterdb.memoryOption=true
    oracle.install.db.config.starterdb.installExampleSchemas=false
    oracle.install.db.config.starterdb.enableSecuritySettings=true
    oracle.install.db.config.starterdb.password.ALL=oracle
    oracle.install.db.config.starterdb.control=DB_CONTROL
    oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
    oracle.install.db.config.starterdb.automatedBackup.enable=false
    oracle.install.db.config.starterdb.dbcontrol.emailAddress=myoracle@msn.com
    DECLINE_SECURITY_UPDATES=true

    修改后 db_install.rsp 文件内容如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    ####################################################################
    ## 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=oracle

    #-------------------------------------------------------------------------------
    # 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=/home/app/oracle/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
    #------------------------------------------------------------------------------
    SELECTED_LANGUAGES=en,zh_CN

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

    #------------------------------------------------------------------------------
    # Specify the complete path of the Oracle Base.
    #------------------------------------------------------------------------------
    ORACLE_BASE=/home/app/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=true

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

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

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

    #------------------------------------------------------------------------------
    # Specify the Starter Database 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
    #------------------------------------------------------------------------------
    oracle.install.db.config.starterdb.characterSet=ZHS16GBK

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

    #-------------------------------------------------------------------------------
    # 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=myoracle@msn.com

    #-------------------------------------------------------------------------------
    # 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=
  • 静默安装

    通过以下命令完成静默安装

    1
    # ./runInstaller -silent -responseFile /home/oracle/scripts/response/db_install.rsp -ignorePrereq

    提示以下信息表示安装完成

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    #!/bin/sh 
    #Root scripts to run

    /home/app/oracle/oraInventory/orainstRoot.sh
    /home/app/oracle/product/11.2.0/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.

    切换到 root 用户

    1
    # su root

    执行以下命令

    1
    2
    # sh /home/app/oracle/oraInventory/orainstRoot.sh
    # sh /home/app/oracle/product/11.2.0/root.sh

    安装 libXext

    1
    # yum install libXext -y
  • 配置静默监听

    设置 DISPLAY 环境变量

    1
    export DISPLAY=192.168.187.130:0.0

    通过 response 文件运行 netca, 生成 sqlnet.oralistener.ora 文件,生成文件位于 $ORACLE_HOME/network/admin 目录下

    1
    # netca -silent -responsefile /home/oracle/scripts/response/netca.rsp

    修改文件 $ORACLE_HOME/network/admin/listener.ora

    1
    # vi $ORACLE_HOME/network/admin/listener.ora

    LISTEN 属性后添加以下内容:

    1
    2
    3
    4
    5
    6
    7
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = ORCL)
    (SID_NAME = ORCL)
    )
    )

    重新加载监听

    1
    # lsnrctl reload

    查看监听端口是否正常启动

    1
    # netstat -tnlp
  • 静默建库

    修改文件 /home/oracle/scripts/response/dbca.rsp

    1
    # vi  /home/oracle/scripts/response/dbca.rsp

    修改内容如下:

    1
    SID = "ORCL"

    执行以下命令,开始静默建库

    1
    # dbca -silent -responseFile  /home/oracle/scripts/response/dbca.rsp

    分别输入创建 syssystem 用户密码

    重启服务器后,连接到 oracle

    1
    # sqlplus / as sysdba

    启动数据库

    1
    SQL> startup;

配置

字符集修改

  • 修改服务端数据库字符集

    • 查询目前数据库所使用的字符集

      1
      # select * from V$NLS_PARAMETERS;

      其中查询结果中 “NLS_CHARACTERSET” 的值即为目前所使用的字符集,若字符集需要调整,则按照以下步骤操作

    • 连接到服务器数据库

      1
      # sqlplus / as sysdba
    • 关闭数据库

      1
      SQL> shutdown immediate;
    • 进入限制模式

      1
      SQL> startup mount;
      1
      SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
      1
      SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
      1
      SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
      1
      SQL> alter database open;
    • 修改字符集

      1
      SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
    • 重启数据库

      1
      2
      SQL> shutdown immediate;
      SQL> startup;