今天在公司做测试内存数据库timesten的时候,需要安装一个数据库,发现linux操作系统没有图形界面,配置的yum源是远程的,不能进行yum group install 方式安装图形界面,只能进行静默的方式安装一个数据库了,下面是安装步骤:
1、 安装必须的软件
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
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
rpm -q \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
expat \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
pdksh \
sysstat \
unixODBC \
unixODBC-devel | grep "notinstalled"
2、创建用户和目录
[root@mongo7 ~]# groupadd -g 1000 oinstall
[root@mongo7 ~]# groupadd -g 1001 dba
[root@mongo7 ~]# useradd -u 1000 -goinstall -G dba,oinstall oracle
[root@mongo7 ~]#passwd oracle
[root@mongo7 ~]#mkdir -p/u01/app/oracle/11.2.0.4/product
[root@mongo7 ~]#chown -R oracle:oinstall/u01/app/oracle
3、配置用户的环境变量
# vi /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/11.2.0.4/product
exportPATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_SID=testdb
[root@mongo7 ~]# cat /etc/hosts
127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4
::1localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.130.12 mongo7
4、内存参数设置
kernel.shmall = 8388608
kernel.shmmax = 34359738368
kernel.shmmni = 4096
# semaphores: semmsl,semmns,semopm,semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
vm.dirty_background_ratio = 3
vm.dirty_ratio = 20
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.min_free_kbytes=524288
vm.swappiness = 10
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 4194304
net.core.wmem_max =4194304
fs.file-max = 6815744
fs.aio-max-nr = 4194304
kernel.sem = 20000 1280000 20000 1024
vm.nr_hugepages = 16384
sga打算给了32G
[root@mongo7 /]# grep HugePages/proc/meminfo
AnonHugePages: 129024 kB
HugePages_Total: 16384
HugePages_Free: 16384
HugePages_Rsvd: 0
HugePages_Surp: 0
vi /etc/security/limits.conf
oraclesoft memlock 33554432
oraclehard memlock 33554432
oraclesoft nofile 1024
oraclehard nofile 65536
oraclesoft nproc 2047
oraclehard nproc 16384
oraclesoft stack 10240
oraclehard stack 32768
5、下面开始配置静默安装数据库的软件
静默安装数据库
vim /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
在安装软件目录下面执行下面命令,
./runInstaller -silent -debug -force -noconfig-IgnoreSysPreReqs \
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0\
oracle.install.option=INSTALL_DB_SWONLY \
DECLINE_SECURITY_UPDATES=true \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,zh_CN,zh_TW \
ORACLE_HOME=/u01/app/oracle/11.2.0.4/product\
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=dba
[oracle@mongo7 response]$ pwd
/tmp/database/response
[oracle@mongo7 response]$ ls
dbca.rspdb_install.rsp netca.rsp
编辑文件db_install.rsp
[oracle@mongo7 response]$ catdb_install.rsp |grep -v ^#
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option= INSTALL_DB_SWONLY
ORACLE_HOSTNAME=mongo7
UNIX_GROUP_NAME= oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/11.2.0.4/product
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition= EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP= dba
oracle.install.db.OPER_GROUP= dba
./runInstaller -silent -responsefile/home/oracle/new.rsp -ignoreSysPrereqs
安装完成会有提示执行root.sh 脚本
As a root user,execute the followingscript(s):
1./u01/app/oracle/11.2.0.4/product/root.sh
Successfully Setup Software.
copying/u01/app/oraInventory/logs/time2017-10-14_05-07-46PM.log to/u01/app/oracle/11.2.0.4/product/cfgtoollogs/oui/time2017-10-14_05-07-46PM.log
copying/u01/app/oraInventory/logs/oraInstall2017-10-14_05-07-46PM.err to/u01/app/oracle/11.2.0.4/product/cfgtoollogs/oui/oraInstall2017-10-14_05-07-46PM.err
copying/u01/app/oraInventory/logs/oraInstall2017-10-14_05-07-46PM.out to/u01/app/oracle/11.2.0.4/product/cfgtoollogs/oui/oraInstall2017-10-14_05-07-46PM.out
copying/u01/app/oraInventory/logs/silentInstall2017-10-14_05-07-46PM.log to/u01/app/oracle/11.2.0.4/product/cfgtoollogs/oui/silentInstall2017-10-14_05-07-46PM.log
copying/u01/app/oraInventory/logs/installActions2017-10-14_05-07-46PM.log to/u01/app/oracle/11.2.0.4/product/cfgtoollogs/oui/installActions2017-10-14_05-07-46PM.log
采用debug模式安装,如果有异常则更容易发现错误原因。
附上oracle软件静默安装的参数含义如下:
-silent 表示以静默方式安装,不会有任何提示
-force 表示允许安装到一个非空目录
-noconfig 表示不运行配置助手netca
-responseFile 表示使用哪个响应文件,必需使用绝对路径
oracle.install.responseFileVersion 响应文件模板的版本,该参数不要更改
oracle.install.option 安装模式选项,本例只安装oracle软件,该参数不要更改
DECLINE_SECURITY_UPDATES 是否需要在线安全更新,设置为false,该参数不要更改
UNIX_GROUP_NAME oracle 用户用于安装软件的组名
INVENTORY_LOCATION oracle 产品清单目录
SELECTED_LANGUAGES oracle 运行语言环境,一般包括引文和简繁体中文
ORACLE_HOME oracle安装目录
ORACLE_BASE oracle基础目录
oracle.install.db.InstallEdition 安装版本类型,一般是企业版
oracle.install.db.isCustomInstall 是否定制安装,默认Partitioning,OLAP,RAT都选上。根据自己的需要选择组件。
oracle.install.db.customComponents 定制安装组件列表:除了以上默认的,可加上LabelSecurity和Database Vault
oracle.install.db.DBA_GROUP oracle 用户用于授予osdba权限的组名
oracle.install.db.OPER_GROUP oracle 用户用于授予osoper权限的组名
静默安装db
安装完成oracle软件之后还没创建db,我们可以继续使用静默方式创建数据库。
模板在/tmp/database/response/dbca.rsp
[oracle@mongo7 u01]$ vi db.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0.4"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "testdb"
SID = "testdb"
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION ="/u01/app/oracle/oradata"
STORAGETYPE=FS
CHARACTERSET = "ZHS16GBK"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"
TOTALMEMORY =32768
TOTALMEMORY 单位是内存大小M
--开始安装数据库
[oracle@mongo7 u01]$ dbca -silent-responseFile /u01/db.rsp
Creating and starting Oracle instance
1% complete
3% complete
Creating database files
4% complete
7% complete
Creating data dictionary views
8% complete
9% complete
10% complete
11% complete
12% complete
13% complete
14% complete
16% complete
17% complete
18% complete
19% complete
Adding Oracle JVM
25% complete
30% complete
36% complete
38% complete
Adding Oracle Text
39% complete
41% complete
Adding Oracle XML DB
43% complete
44% complete
45% complete
49% complete
Adding Oracle Multimedia
50% complete
60% complete
Adding Oracle OLAP
61% complete
62% complete
64% complete
Adding Oracle Spatial
65% complete
66% complete
67% complete
71% complete
Adding Enterprise Manager Repository
73% complete
75% complete
Adding Oracle Application Express
78% complete
82% complete
Adding Oracle Warehouse Builder
86% complete
90% complete
Completing Database Creation
91% complete
92% complete
93% complete
96% complete
100% complete
Look at the log file"/u01/app/oracle/cfgtoollogs/dbca/testdb/testdb.log" for furtherdetails.
静默安装监听
[oracle@mongo7 response]$ cat /u01/net.rsp |grep-v ^#|grep -v ^$
[GENERAL]
RESPONSEFILE_VERSION="11.2.0.4"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
--这里只改动了数据库的版本一个参数
[oracle@mongo7 response]$ netca /u01/net.rsp****DISPLAY environment variable not set!
Oracle Net Configuration Assistant is a GUI tool
which requires that DISPLAY specify a location
where GUI tools can display.
Set and export DISPLAY,then re-run.
[oracle@mongo7 response]$ netca -silent -responseFile /u01/net.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/net.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/11.2.0.4/product/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
到此数据库安装成功
[oracle@mongo7 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-OCT-2017 18:59:40
Copyright (c) 1991,2013,Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 14-OCT-2017 18:58:37
Uptime 0 days 0 hr. 1 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/11.2.0.4/product/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/mongo7/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mongo7)(PORT=1521)))
Services Summary...
Service "testdb" has 1 instance(s).
Instance "testdb",status READY,has 1 handler(s) for this service...
Service "testdbXDB" has 1 instance(s).
Instance "testdb",has 1 handler(s) for this service...
The command completed successfully
手工配置客户端监听
[oracle@mongo7 admin]$ cat tnsnames.ora test = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.130.12)(PORT = 1521)) ) (CONNECT_DATA = (service_names = testdb) ) )
原文链接:https://www.f2er.com/oracle/207383.html