CentOS命令行下装oracle 12c的方法(命令行模式安装)
实验环境:
1:安装oracle所需软件包
oracle 12c所需的rpm包如下:
binutils-2.20.51.0.2-5.11.el6 (x86_64) compat-libcap1-1.10-1 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (i686) gcc-4.4.4-13.el6 (x86_64) gcc-c++-4.4.4-13.el6 (x86_64) glibc-2.12-1.7.el6 (i686) glibc-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (i686) ksh libgcc-4.4.4-13.el6 (i686) libgcc-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (i686) libstdc++-devel-4.4.4-13.el6 (x86_64) libstdc++-devel-4.4.4-13.el6 (i686) libaio-0.3.107-10.el6 (x86_64) libaio-0.3.107-10.el6 (i686) libaio-devel-0.3.107-10.el6 (x86_64) libaio-devel-0.3.107-10.el6 (i686) libxext-1.1 (x86_64) libxext-1.1 (i686) libxtst-1.0.99.2 (x86_64) libxtst-1.0.99.2 (i686) libx11-1.3 (x86_64) libx11-1.3 (i686) libxau-1.0.5 (x86_64) libxau-1.0.5 (i686) libxcb-1.5 (x86_64) libxcb-1.5 (i686) libxi-1.3 (x86_64) libxi-1.3 (i686) make-3.81-19.el6 sysstat-9.0.4-11.el6 (x86_64)
[root@ser6-51 mongodb]# yum install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel libxext libxtst libx11 libxau libxcb libxi make sysstat
loaded plugins: fastestmirror, security determining fastest mirrors * base: mirrors.163.com * extras: mirrors.aliyun.com * updates: mirrors.163.com base | 3.7 kb 00:00 extras | 3.4 kb 00:00 updates | 3.4 kb 00:00 updates/primary_db | 3.9 mb 00:04 setting up install process package gcc-4.4.7-11.el6.x86_64 already installed and latest version package gcc-c++-4.4.7-11.el6.x86_64 already installed and latest version package libgcc-4.4.7-11.el6.x86_64 already installed and latest version package libstdc++-4.4.7-11.el6.x86_64 already installed and latest version package libstdc++-devel-4.4.7-11.el6.x86_64 already installed and latest version package libaio-0.3.107-10.el6.x86_64 already installed and latest version package libxau-1.0.6-4.el6.x86_64 already installed and latest version package 1:make-3.81-20.el6.x86_64 already installed and latest version resolving dependencies --> running transaction check ---> package binutils.x86_64 0:2.20.51.0.2-5.36.el6 will be updated ---> package binutils.x86_64 0:2.20.51.0.2-5.42.el6 will be an update ---> package compat-libcap1.x86_64 0:1.10-1 will be installed ---> package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 will be installed ---> package glibc.x86_64 0:2.12-1.132.el6 will be updated --> processing dependency: glibc = 2.12-1.132.el6 for package: glibc-headers-2.12-1.132.el6.x86_64 --> processing dependency: glibc = 2.12-1.132.el6 for package: glibc-common-2.12-1.132.el6.x86_64 ---> package glibc.x86_64 0:2.12-1.149.el6_6.9 will be an update ---> package glibc-devel.x86_64 0:2.12-1.132.el6 will be updated ---> package glibc-devel.x86_64 0:2.12-1.149.el6_6.9 will be an update ---> package ksh.x86_64 0:20120801-21.el6_6.3 will be installed ---> package libx11.x86_64 0:1.5.0-4.el6 will be updated ---> package libx11.x86_64 0:1.6.0-2.2.el6 will be an update --> processing dependency: libx11-common = 1.6.0-2.2.el6 for package: libx11-1.6.0-2.2.el6.x86_64 ---> package libxext.x86_64 0:1.3.1-2.el6 will be updated ---> package libxext.x86_64 0:1.3.2-2.1.el6 will be an update ---> package libxi.x86_64 0:1.6.1-3.el6 will be updated ---> package libxi.x86_64 0:1.7.2-2.2.el6 will be an update ---> package libxtst.x86_64 0:1.2.1-2.el6 will be updated ---> package libxtst.x86_64 0:1.2.2-2.1.el6 will be an update ---> package libaio-devel.x86_64 0:0.3.107-10.el6 will be installed ---> package libxcb.x86_64 0:1.8.1-1.el6 will be updated ---> package libxcb.x86_64 0:1.9.1-2.el6 will be an update ---> package sysstat.x86_64 0:9.0.4-22.el6 will be updated ---> package sysstat.x86_64 0:9.0.4-27.el6 will be an update --> running transaction check ---> package glibc-common.x86_64 0:2.12-1.132.el6 will be updated ---> package glibc-common.x86_64 0:2.12-1.149.el6_6.9 will be an update ---> package glibc-headers.x86_64 0:2.12-1.132.el6 will be updated ---> package glibc-headers.x86_64 0:2.12-1.149.el6_6.9 will be an update ---> package libx11-common.noarch 0:1.5.0-4.el6 will be updated ---> package libx11-common.noarch 0:1.6.0-2.2.el6 will be an update --> finished dependency resolution dependencies resolved ========================================================================================================================================================================================================= package arch version repository size ========================================================================================================================================================================================================= installing: compat-libcap1 x86_64 1.10-1 base 17 k compat-libstdc++-33 x86_64 3.2.3-69.el6 base 183 k ksh x86_64 20120801-21.el6_6.3 updates 758 k libaio-devel x86_64 0.3.107-10.el6 base 13 k updating: binutils x86_64 2.20.51.0.2-5.42.el6 base 2.8 m glibc x86_64 2.12-1.149.el6_6.9 updates 3.8 m glibc-devel x86_64 2.12-1.149.el6_6.9 updates 984 k libx11 x86_64 1.6.0-2.2.el6 base 586 k libxext x86_64 1.3.2-2.1.el6 base 35 k libxi x86_64 1.7.2-2.2.el6 base 37 k libxtst x86_64 1.2.2-2.1.el6 base 19 k libxcb x86_64 1.9.1-2.el6 base 110 k sysstat x86_64 9.0.4-27.el6 base 233 k updating for dependencies: glibc-common x86_64 2.12-1.149.el6_6.9 updates 14 m glibc-headers x86_64 2.12-1.149.el6_6.9 updates 612 k libx11-common noarch 1.6.0-2.2.el6 base 192 k transaction summary ========================================================================================================================================================================================================= install 4 package(s) upgrade 12 package(s) total download size: 24 m is this ok [y/n]: y downloading packages: (1/16): binutils-2.20.51.0.2-5.42.el6.x86_64.rpm | 2.8 mb 00:02 (2/16): compat-libcap1-1.10-1.x86_64.rpm | 17 kb 00:00 (3/16): compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm | 183 kb 00:00 (4/16): glibc-2.12-1.149.el6_6.9.x86_64.rpm | 3.8 mb 00:05 (5/16): glibc-common-2.12-1.149.el6_6.9.x86_64.rpm | 14 mb 00:13 (6/16): glibc-devel-2.12-1.149.el6_6.9.x86_64.rpm | 984 kb 00:02 (7/16): glibc-headers-2.12-1.149.el6_6.9.x86_64.rpm | 612 kb 00:01 (8/16): ksh-20120801-21.el6_6.3.x86_64.rpm | 758 kb 00:01 (9/16): libx11-1.6.0-2.2.el6.x86_64.rpm | 586 kb 00:01 (10/16): libx11-common-1.6.0-2.2.el6.noarch.rpm | 192 kb 00:00 (11/16): libxext-1.3.2-2.1.el6.x86_64.rpm | 35 kb 00:00 (12/16): libxi-1.7.2-2.2.el6.x86_64.rpm | 37 kb 00:00 (13/16): libxtst-1.2.2-2.1.el6.x86_64.rpm | 19 kb 00:00 (14/16): libaio-devel-0.3.107-10.el6.x86_64.rpm | 13 kb 00:00 (15/16): libxcb-1.9.1-2.el6.x86_64.rpm | 110 kb 00:00 (16/16): sysstat-9.0.4-27.el6.x86_64.rpm | 233 kb 00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- total 712 kb/s | 24 mb 00:35 running rpm_check_debug running transaction test transaction test succeeded running transaction updating : glibc-common-2.12-1.149.el6_6.9.x86_64 1/28 updating : glibc-2.12-1.149.el6_6.9.x86_64 2/28 updating : glibc-headers-2.12-1.149.el6_6.9.x86_64 3/28 updating : libxcb-1.9.1-2.el6.x86_64 4/28 updating : libx11-common-1.6.0-2.2.el6.noarch 5/28 updating : libx11-1.6.0-2.2.el6.x86_64 6/28 updating : libxext-1.3.2-2.1.el6.x86_64 7/28 updating : libxi-1.7.2-2.2.el6.x86_64 8/28 updating : libxtst-1.2.2-2.1.el6.x86_64 9/28 updating : glibc-devel-2.12-1.149.el6_6.9.x86_64 10/28 installing : compat-libcap1-1.10-1.x86_64 11/28 updating : sysstat-9.0.4-27.el6.x86_64 12/28 installing : ksh-20120801-21.el6_6.3.x86_64 13/28 installing : compat-libstdc++-33-3.2.3-69.el6.x86_64 14/28 updating : binutils-2.20.51.0.2-5.42.el6.x86_64 15/28 installing : libaio-devel-0.3.107-10.el6.x86_64 16/28 cleanup : glibc-devel-2.12-1.132.el6.x86_64 17/28 cleanup : libxtst-1.2.1-2.el6.x86_64 18/28 cleanup : glibc-headers-2.12-1.132.el6.x86_64 19/28 cleanup : libxi-1.6.1-3.el6.x86_64 20/28 cleanup : libxext-1.3.1-2.el6.x86_64 21/28 cleanup : libx11-1.5.0-4.el6.x86_64 22/28 cleanup : libxcb-1.8.1-1.el6.x86_64 23/28 cleanup : binutils-2.20.51.0.2-5.36.el6.x86_64 24/28 cleanup : sysstat-9.0.4-22.el6.x86_64 25/28 cleanup : libx11-common-1.5.0-4.el6.noarch 26/28 cleanup : glibc-common-2.12-1.132.el6.x86_64 27/28 cleanup : glibc-2.12-1.132.el6.x86_64 28/28 verifying : glibc-devel-2.12-1.149.el6_6.9.x86_64 1/28 verifying : libaio-devel-0.3.107-10.el6.x86_64 2/28 verifying : libx11-1.6.0-2.2.el6.x86_64 3/28 verifying : compat-libcap1-1.10-1.x86_64 4/28 verifying : libxext-1.3.2-2.1.el6.x86_64 5/28 verifying : glibc-2.12-1.149.el6_6.9.x86_64 6/28 verifying : sysstat-9.0.4-27.el6.x86_64 7/28 verifying : ksh-20120801-21.el6_6.3.x86_64 8/28 verifying : compat-libstdc++-33-3.2.3-69.el6.x86_64 9/28 verifying : glibc-headers-2.12-1.149.el6_6.9.x86_64 10/28 verifying : binutils-2.20.51.0.2-5.42.el6.x86_64 11/28 verifying : libxtst-1.2.2-2.1.el6.x86_64 12/28 verifying : libxi-1.7.2-2.2.el6.x86_64 13/28 verifying : glibc-common-2.12-1.149.el6_6.9.x86_64 14/28 verifying : libxcb-1.9.1-2.el6.x86_64 15/28 verifying : libx11-common-1.6.0-2.2.el6.noarch 16/28 verifying : glibc-2.12-1.132.el6.x86_64 17/28 verifying : glibc-devel-2.12-1.132.el6.x86_64 18/28 verifying : glibc-headers-2.12-1.132.el6.x86_64 19/28 verifying : glibc-common-2.12-1.132.el6.x86_64 20/28 verifying : binutils-2.20.51.0.2-5.36.el6.x86_64 21/28 verifying : libxi-1.6.1-3.el6.x86_64 22/28 verifying : libx11-common-1.5.0-4.el6.noarch 23/28 verifying : sysstat-9.0.4-22.el6.x86_64 24/28 verifying : libxcb-1.8.1-1.el6.x86_64 25/28 verifying : libxtst-1.2.1-2.el6.x86_64 26/28 verifying : libx11-1.5.0-4.el6.x86_64 27/28 verifying : libxext-1.3.1-2.el6.x86_64 28/28 installed: compat-libcap1.x86_64 0:1.10-1 compat-libstdc++-33.x86_64 0:3.2.3-69.el6 ksh.x86_64 0:20120801-21.el6_6.3 libaio-devel.x86_64 0:0.3.107-10.el6 updated: binutils.x86_64 0:2.20.51.0.2-5.42.el6 glibc.x86_64 0:2.12-1.149.el6_6.9 glibc-devel.x86_64 0:2.12-1.149.el6_6.9 libx11.x86_64 0:1.6.0-2.2.el6 libxext.x86_64 0:1.3.2-2.1.el6 libxi.x86_64 0:1.7.2-2.2.el6 libxtst.x86_64 0:1.2.2-2.1.el6 libxcb.x86_64 0:1.9.1-2.el6 sysstat.x86_64 0:9.0.4-27.el6 dependency updated: glibc-common.x86_64 0:2.12-1.149.el6_6.9 glibc-headers.x86_64 0:2.12-1.149.el6_6.9 libx11-common.noarch 0:1.6.0-2.2.el6 complete!
验证 oracle 所需要的系统依赖程序包是否完整。
[root@ser6-51 mongodb]# rpm -qa binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel libxext libxtst libx11 libxau libxcb libxi make sysstat
libgcc-4.4.7-11.el6.x86_64 libstdc++-4.4.7-11.el6.x86_64 gcc-c++-4.4.7-11.el6.x86_64 glibc-2.12-1.149.el6_6.9.x86_64 libx11-1.6.0-2.2.el6.x86_64 glibc-devel-2.12-1.149.el6_6.9.x86_64 compat-libstdc++-33-3.2.3-69.el6.x86_64 make-3.81-20.el6.x86_64 libaio-0.3.107-10.el6.x86_64 libxau-1.0.6-4.el6.x86_64 libstdc++-devel-4.4.7-11.el6.x86_64 libxext-1.3.2-2.1.el6.x86_64 libxtst-1.2.2-2.1.el6.x86_64 compat-libcap1-1.10-1.x86_64 ksh-20120801-21.el6_6.3.x86_64 binutils-2.20.51.0.2-5.42.el6.x86_64 gcc-4.4.7-11.el6.x86_64 libxcb-1.9.1-2.el6.x86_64 libxi-1.7.2-2.2.el6.x86_64 sysstat-9.0.4-27.el6.x86_64 libaio-devel-0.3.107-10.el6.x86_64
2:对os进行配置
2.1 创建相关用户和用户组
groupadd oinstall
groupadd oper
groupadd dba
useradd -g oinstall -g dba,oper oracle
2.2 修改oracle用户的密码
passwd oracle
2.3 修改系统参数
vi /etc/sysctl.conf
添加:
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586
运行sysctl -p应用以上参数
/sbin/sysctl -p
2.4 修改用户limits
vi /etc/security/limits.conf
新增如下内容:
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle stack nproc 10240
oracle stack nproc 10240
2.5 创建相关目录
mkdir -p /u01/app/oracle/product/12c/db_1
mkdir –p /u01/app/oracle/oradata
mkdir –p /u01/app/oracle/flash_recovery_area
mkdir -p /u01/app/oracle/archlog
chown -r oracle:oinstall /u01
2.6 配置环境变量
su - oracle
vi .bash_profile
添加:
# oracle settings columns=132; export columns lines=47; export lines editor=vi; export editor tmp=/tmp; export tmp tmpdir=$tmp; export tmpdir oracle_base=/u01/app/oracle; export oracle_base oracle_home=$oracle_base/product/12c/db_1; export oracle_home oracle_sid=orcl; export oracle_sid shlib_path=$ld_library_path;export shlib_path nls_lang=american_america.zhs16gbk;export nls_lang ora_nls10=$oracle_home/nls/data;export ora_nls10 tns_admin=$oracle_home/network/admin;export tns_admin oracle_term=xterm; export oracle_term path=/usr/sbin:$path; export path path=$oracle_home/bin:$path; export path ld_library_path=$oracle_home/lib:/lib:/usr/lib; export ld_library_path classpath=$oracle_home/jre:$oracle_home/jlib:$oracle_home/rdbms/jlib; export classpath alias glance=/opt/perf/bin/glance:x alias gohome='cd /u01/app/oracle/product/10.2.0' alias cdb='cd /u01/app/oracle/admin/orcl/bdump' alias cdu='cd /u01/app/oracle/admin/orcl/udump'
--里面的内容可以根据实际情况进行改动,如可以改动oracle_sid.
修改完用:source .bash_profile生效。
2.7修改/etc/hosts
[oracle@ser6-51 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[oracle@ser6-51 ~]$ hostname
ser6-51
把127.0.0.1那一行改为:127.0.0.1 ser6-51
2.8修改操作系统发行版本
由于 oracle 还没有推出支持 centos 的安装包,所以需要修改发行版本,以便通过 oracle 的安装检查。
vi /etc/redhat-release
把centos release 6.5 (final) 注释掉,前面加上一行redhat-4,当oracle安装完成后,再修改回来。
如:
redhat-4
#centos release 6.5 (final)
2.9 关闭selinux
vi /etc/selinux/config
将selinux那一行改成:
selinux=disabled
3:安装
3.1 解压安装包
[root@ser6-51 download]# ls -ltr
-rw-r--r-- 1 root root 1014530602 jul 6 15:07 linuxamd64_12102_database_2of2.zip
-rw-r--r-- 1 root root 1673544724 jul 6 15:12 linuxamd64_12102_database_1of2.zip
[root@ser6-51 download]# unzip linuxamd64_12102_database_1of2.zip
[root@ser6-51 download]# unzip linuxamd64_12102_database_2of2.zip
[root@ser6-51 download]# ls -ltr
drwxr-xr-x 7 root root 4096 jul 7 2014 database
-rw-r--r-- 1 root root 1014530602 jul 6 15:07 linuxamd64_12102_database_2of2.zip
-rw-r--r-- 1 root root 1673544724 jul 6 15:12 linuxamd64_12102_database_1of2.zip
3.2 安装oracle软件
3.2.1 新建静默安装的应答文件
su - oracle
vi 12102db_install.rsp
添加:
###################################################################### ## copyright(c) oracle corporation 1998,2013. 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_v12.1.0 #------------------------------------------------------------------------------- # specify the installation option. # it can be one of the following: # - install_db_swonly # - install_db_and_config # - 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=ser6-51 #------------------------------------------------------------------------------- # specify the unix group to be set for the inventory directory. #------------------------------------------------------------------------------- unix_group_name=oinstall #------------------------------------------------------------------------------- # specify the location which holds the inventory files. # this is an optional parameter if installing on # windows based operating system. #------------------------------------------------------------------------------- inventory_location=/u01/app/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 # # all_langs : all languages # # specify value as the following to select any of the languages. # example : selected_languages=en,fr,ja # # specify value as the following to select all the languages. # example : selected_languages=all_langs #------------------------------------------------------------------------------- selected_languages=en #------------------------------------------------------------------------------- # specify the complete path of the oracle home. #------------------------------------------------------------------------------- oracle_home=/u01/app/oracle/product/12c/db_1 #------------------------------------------------------------------------------- # specify the complete path of the oracle base. #------------------------------------------------------------------------------- oracle_base=/u01/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 ################################################################################# # # # 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 value to be specified for osdba and osoper group is only for unix based # # operating system. # # # ############################################################################### #------------------------------------------------------------------------------ # 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. # the value to be specified for osoper group is optional. #------------------------------------------------------------------------------ oracle.install.db.oper_group=oper #------------------------------------------------------------------------------ # the backupdba_group is the os group which is to be granted osbackupdba privileges. #------------------------------------------------------------------------------ oracle.install.db.backupdba_group=dba #------------------------------------------------------------------------------ # the dgdba_group is the os group which is to be granted osdgdba privileges. #------------------------------------------------------------------------------ oracle.install.db.dgdba_group=dba #------------------------------------------------------------------------------ # the kmdba_group is the os group which is to be granted oskmdba privileges. #------------------------------------------------------------------------------ oracle.install.db.kmdba_group=dba ################################################################################ # # # database configuration options # # # ################################################################################ #------------------------------------------------------------------------------- # specify the type of database to create. # it can be one of the following: # - general_purpose/transaction_processing # - data_warehouse #------------------------------------------------------------------------------- oracle.install.db.config.starterdb.type= #------------------------------------------------------------------------------- # specify the starter database global database name. #------------------------------------------------------------------------------- oracle.install.db.config.starterdb.globaldbname= #------------------------------------------------------------------------------- # specify the starter database sid. #------------------------------------------------------------------------------- oracle.install.db.config.starterdb.sid= #------------------------------------------------------------------------------- # specify whether the database should be configured as a container database. #------------------------------------------------------------------------------- oracle.install.db.configureascontainerdb= #------------------------------------------------------------------------------- # specify the pluggable database name for the pluggable database in container database. #------------------------------------------------------------------------------- oracle.install.db.config.pdbname= #------------------------------------------------------------------------------- # specify the starter database character set. # # 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= #------------------------------------------------------------------------------ # 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= #------------------------------------------------------------------------------- # 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= ################################################################################# # # # passwords can be supplied for the following four schemas in the # # starter database: # # sys # # system # # 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 dbsnmp password for the starter database. #------------------------------------------------------------------------------- oracle.install.db.config.starterdb.password.dbsnmp= #------------------------------------------------------------------------------- # specify the pdbadmin password required for creation of pluggable database in the container database. #------------------------------------------------------------------------------- oracle.install.db.config.starterdb.password.pdbadmin= #------------------------------------------------------------------------------ # specify whether user doesn't want to configure security updates. # the value for this variable should be true if you don't want to configure # security updates, false otherwise. # # 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 auto-updates option. it can be one of the following: # - myoraclesupport_download # - offline_updates # - skip_updates #------------------------------------------------------------------------------ oracle.installer.autoupdates.option=skip_updates
3.2.2 静默安装软件
[root@ser6-51 install]# su - oracle
[oracle@ser6-51 ~]$ cd /download/database/
[oracle@ser6-51 database]$ ./runinstaller -silent -responsefile /home/oracle/12102db_install.rsp
/*
假如安装过程中报错了,已经在$oracle_home和/u01/app/orainventory下生成了很多文件目录。想再次安装的话,需要先删除这些文件:
[oracle@ser6-52 app]$ pwd
/u01/app
[oracle@ser6-52 app]$ rm -rf /u01/app/orainventory
cd $oracle_home/
rm -rf *
*/
执行两个脚本:
[root@ser6-51 ~]# sh /u01/app/orainventory/orainstroot.sh
changing permissions of /u01/app/orainventory.
adding read,write permissions for group.
removing read,write,execute permissions for world.
changing groupname of /u01/app/orainventory to oinstall.
the execution of the script is complete.
root@ser6-51 ~]# sh /u01/app/oracle/product/12c/db_1/root.sh
check /u01/app/oracle/product/12c/db_1/install/root_ser6-51_2015-07-06_19-00-11.log for the output of root script
3.3 建库
3.3.1 建响应文件
v i /home/oracle/dbca.rsp
添加:
[general] responsefile_version = "12.1.2.0" operation_type = "createdatabase" [createdatabase] gdbname = "orcl" sid = "orcl" templatename = "new_database.dbt" syspassword = "orcl" systempassword = "orcl" sysmanpassword = "orcl" dbsnmppassword = "orcl" datafiledestination ="/u01/app/oracle/oradata" storagetype=fs characterset = "zhs16gbk" databasetype = "multipurpose" automaticmemorymanagement = "false"
3.3.2 执行命令
dbca -silent -responsefile /home/oracle/dbca.rsp
creating and starting oracle instance 1% complete 4% complete creating database files 5% complete 9% complete creating data dictionary views 10% complete 13% complete 14% complete 15% complete 16% complete 17% complete 18% complete 21% complete 22% complete 23% complete 24% complete adding oracle jvm 30% complete 37% complete 44% complete 46% complete adding oracle text 47% complete 48% complete 50% complete 51% complete adding oracle multimedia 52% complete 65% complete adding oracle olap 66% complete 67% complete 68% complete 69% complete adding oracle spatial 70% complete 78% complete adding oracle application express 83% complete 87% complete completing database creation 89% complete 90% complete 91% complete 95% complete 100% complete
[oracle@ser6-51 dbs]$ export oracle_sid=orcl
[oracle@ser6-51 dbs]$ sqlplus / as sysdba
sql*plus: release 12.1.0.2.0 production on wed jul 8 09:29:16 2015
copyright (c) 1982, 2014, oracle. all rights reserved.
connected to:
oracle database 12c enterprise edition release 12.1.0.2.0 - 64bit production
with the partitioning, olap, advanced analytics and real application testing options
sql> select status from v$instance;
status
------------
open
3.4配监听
3.4.1 建响应文件
vi 12102_netca.rsp
添加:
[general] responsefile_version="12.1" create_type="custom" #------------------------------------------------------------------------------- # name : show_gui # datatype : boolean # description: this variable controls appearance/suppression of the netca gui, # pre-req : n/a # default : true # note: # this must be set to false in order to run netca in silent mode. # this is a substitute of "/silent" flag in the netca command line. # the command line flag has precedence over the one in this response file. # this feature is present since 10.1.0.3. #------------------------------------------------------------------------------- #show_gui=false #------------------------------------------------------------------------------- # name : log_file # datatype : string # description: if present, netca will log output to this file in addition to the # standard out. # pre-req : n/a # default : none # note: # this is a substitute of "/log" in the netca command line. # the command line argument has precedence over the one in this response file. # this feature is present since 10.1.0.3. #------------------------------------------------------------------------------- #log_file=""/oracle12chome/network/tools/log/netca.log"" [oracle.net.ca] #installed_components;stringlist;list of installed components # the possible values for installed components are: # "net8","server","client","aso", "cman", "javavm" installed_components={"server","net8","javavm"} #install_type;string;type of install # the possible values for install type are: # "typical","minimal" or "custom" install_type=""typical"" #listener_number;number;number of listeners # a typical install sets one listener listener_number=1 #listener_names;stringlist;list of listener names # the values for listener are: # "listener","listener1","listener2","listener3", ... # a typical install sets only "listener" listener_names="listener" #listener_protocols;stringlist;list of listener addresses (protocols and parameters separated by semicolons) # the possible values for listener protocols are: # "tcp;1521","tcps;2484","nmp;orapipe","ipc;ipckey","vi;1521" # a typical install sets only "tcp;1521" listener_protocols="tcp;1521" #listener_start;string;name of the listener to start, in double quotes listener_start=""listener"" #naming_methods;stringlist;list of naming methods # the possible values for naming methods are: # ldap, tnsnames, onames, hostname, novell, nis, dce # a typical install sets only: "tnsnames","onames","hostnames" # or "ldap","tnsnames","onames","hostnames" for ldap naming_methods={"tnsnames","onames","hostname"} #novell_namecontext;string;novell directory service name context, in double quotes # a typical install does not use this variable. #novell_namecontext = ""namcontext"" #sun_metamap;string; sun meta map, in double quotes # a typical install does not use this variable. #sun_metamap = ""map"" #dce_cellname;string;dce cell name, in double quotes # a typical install does not use this variable. #dce_cellname = ""cell"" #nsn_number;number;number of netservice names # a typical install sets one net service name nsn_number=1 #nsn_names;stringlist;list of net service names # a typical install sets net service name to "extproc_connection_data" nsn_names="extproc_connection_data" #nsn_service;stringlist;oracle12c database's service name # a typical install sets oracle12c database's service name to "plsextproc" nsn_service="plsextproc"
3.4.2 执行命令
[oracle@ser6-51 ~]$ netca -silent -responsefile /home/oracle/12102_netca.rsp
parsing command line arguments:
parameter "silent" = true
parameter "responsefile" = /home/oracle/12102_netca.rsp
done parsing command line arguments.
oracle net services configuration:
profile configuration complete.
oracle net listener startup:
running listener control:
/u01/app/oracle/product/12c/db_1/bin/lsnrctl start listener
listener control complete.
listener started successfully.
listener configuration complete.
oracle net services configuration successful. the exit code is 0
4:设置开机启动
4.1 修改dbstart文件
假如执行/u01/app/oracle/product/12c/db_1/bin/dbstart报错:
oracle_home_listner is not set, unable to auto-start oracle net listener
usage: /u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart oracle_home
修改dbstart文件,将oracle_home_listner=$1
修改为oracle_home_listner=$oracle_home
4.2修改/etc/oratab
添加:
orcl:/u01/app/oracle/product/12c/db_1:y
4.3修改/etc/rc.d/rc.local
添加一行:
su oracle -lc /u01/app/oracle/product/12c/db_1/bin/dbstart
--说明:/u01/app/oracle/product/12c/dbhome_1为oracle的安装目录,要根据实际情况进行修改。
reboot试验下看是否能开机自动启动。
5:开1521端口
如果防火墙开启了的话,要开1521端口,允许远程访问。
vi /etc/sysconfig/iptables
直接在配置文件里已有的-a input那些命令下面
添加一行:
-a input -m state --state new -m tcp -p tcp --dport 1521-j accept
重启防火墙
[root@ser6-52 mongodb]# /etc/init.d/iptables restart
iptables: setting chains to policy accept: filter [ ok ]
iptables: flushing firewall rules: [ ok ]
iptables: unloading modules: [ ok ]
iptables: applying firewall rules: [ ok ]
6:后续配置
#把操作系统版本改回原来的配置
[root@pc ~]# vi /etc/redhat-release
red hat enterprise linux server release 5.8 (tikanga)
修改后:
#redhat-4
centos release 6.5 (final)
对应步骤2.8。
--静默方式建库参考这篇文章。
上一篇: 炒牛肉要买哪个部位最好吃
下一篇: 常用Oracle分析函数大全