Linux 平台下Oracle Silent Installations(静默安装),一直都没有尝试过用这种方法来装数据库。 因为有高级的工具,就没有必要在来用这种方法了,Oracle 的界面还是比较方便,而且我们还有Xmanager 工具,所以在linux 下装软件,还是很方便的。
因此也就没有太在意这种方法,昨天有网友问我了,就整理下吧。 自己也顺便了解一下。 毕竟没有实践过,就没有发言权。
贴了很多安装的 Log,所以很长,其实安装过程很简单。
相关连接:
linux平台下oracle数据库安装
http://blog.csdn.net/xujinyang/article/details/6830215
linux 下手工新建数据库
http://blog.csdn.net/xujinyang/article/details/6830423
Oracle数据库静默安装实践
http://www.oracle.com/technology/global/cn/pub/articles/10gdba/wininst_otn.html
实验平台: redhat 4 update 7 + oracle 10g
1. 下载软件
10G和11G的官网下载地址:
http://www.oracle.com/technology/software/products/database/index.html
2.检查相关包:
用命令:
rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common /
gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21
哪些包没有打,把那些包打上就可以了。 如果在安装系统的时候把所有的包都安装上的话,就不用做这一步了。
3. 设置内核参数(在/etc/sysctl.conf文件中加入下列行)
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
--然后运行下面命令,使上面的设置生效
#/sbin/sysctl -p
kernel.shmall为物理内存除以pagesize;
kernel.shmmax为物理内存的一半;
fs.file-max为512 乘以 processes (如128个process则为 65536);
net.ipv4.ip_local_port_range/net.core.rmem_default/net.core.rmem_max三个参数设置和官方文档不一样, 这是根据metalink 343431.1 最新要求更改的;
net.ipv4.tcp_rmem/net.ipv4.tcp_wmem两个参数一般情况下无需设置, 除非是在Dataguard/Streams等需很多网络传输情况下;
其它参数根据官方文档要求设置即可.
具体内容参考我的blog:
Linux 内核参数及Oracle相关参数调整
http://blog.csdn.net/xujinyang/article/details/6830493
4. 因为所有的进程都是以Oracle 身份来运行的,因此需要定义Oracle 用户能够使用的系统资源数量。
vi /etc/sysconfig/limits.conf
--使用HugePage 内存技术,添加下面2行
Oracle soft memlock 5242880
Oracle hard memlock 524280
--进程句柄数量
oracle soft nproc 2047
oracle hard nproc 16384
-- 文件句柄
oracle soft nofile 65536
oracle hard nofile 65536
将下面一行添加到/etc/pam.d/login文件中:
session required /lib/security/pam_limits.so
5. 禁用SELINUX,编辑/etc/selinux/config,将SELINUX设置为SELINUX=disabled
6. 添加用户组和用户,并为oracle用户设置密码
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle
-g后面只有一个参数,也就是指定用户属于该组
-G后面有好几个参数,也就是指定用户属于后面的多个组
-g initial_group :group名称或以数字来做为使用者登入起始 群 组 (group) 。群组名须为 现有存在的名称。群组数字也须为现有存在的群组 。预设的群组数字为1 。
-G group,[...] 定义此使用者为此一堆 roups 的成员 。不可以夹杂空白字元。群组名同-g选项的限制. 定义值为使用者的起始群组 。
若存在oracle 用户,则用以下语句来修改用户组:
###change user group attribute
usermod -g oinstall -G dba oracle
#passwd oracle
7. 创建Oracle安装文件夹
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
chmod -R 777 /u01
8. 设置oracle用户的环境变量
#vi /home/oracle/.bash_profile
--将如下代码添加到.bash_profile文件中:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
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
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
9. 修改静默安装的参数文件
在安装软件install/response目录下有如下文件:custom.rsp, dbca.rsp,emca.rsp,enterprise.rsp,netca.rsp,standard.rsp。 看到文件的名字就知道他的作用了。 我们选择enterprise.rsp,修改相关参数后即可安装。
要修改的地方如下:
#------------------------------------------------------------------------------
#Name : ORACLE_HOME
#Datatype : String
#Description: Complete path of the Oracle Home.
#Example : ORACLE_HOME = "/product/10.2.0/db_1"
#------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
#------------------------------------------------------------------------------
#Name : ORACLE_HOME_NAME
#Datatype : String
#Description: Oracle Home Name. Used in creating folders and services.
#Example : ORACLE_HOME_NAME = "OraDbHome1"
#------------------------------------------------------------------------------
ORACLE_HOME_NAME=ORACLE_HOME
#------------------------------------------------------------------------------
# Name : n_configurationOption
# Datatype : Number
# Description: Determines the type of configuration to perform for the session.
#
# This entry should be specified as an number. The valid values
# that you can use map to the following options:
# 1 - Create a Database
# 2 - Configure an ASM instance
# 3 - Install Software Only
#
# Example : n_configurationOption=1
#------------------------------------------------------------------------------
n_configurationOption=1
#------------------------------------------------------------------------------
# Name : n_dbType
# Datatype : Number
# Description: Determines the type of database to create.
#
# This entry should be specified as a number. The valid values
# you can specify map to the following options:
# 1 - General Purpose Starter Database
# 2 - Transaction Processing Starter Database
# 3 - Data Warehouse Starter Database
# 4 - Advanced Configuration
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
#
# Example : n_dbType=1
#------------------------------------------------------------------------------
n_dbType=1
#------------------------------------------------------------------------------
# Name : s_responseFileName
# Datatype : String
# Description: Stores the location of the DBCA response file for an Advanced
# Configuration.
#
# If you chose to perform a silent Advanced Configuration by
# specifying n_dbType=4 above, then you need to specify a number
# of additional Advanced Configuration parameters in a response
# file that is used by the DBCA. A template of this response file
# can be found on the installation media in response/dbca.rsp. Use
# this file to completely customize the silent database
# configuration, and set s_responseFileName to the location of
# this response file.
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType=4
#
# Example : oracle.assistants.server:s_responseFileName = "/tmp/dbca.rsp"
#------------------------------------------------------------------------------
oracle.assistants.server:s_responseFileName=/mnt/10201_database_linux32_FromOracle/database/response/dbca.rsp
#------------------------------------------------------------------------------
# Name : s_globalDBName
# Datatype : String
# Description: The Starter Database Global Database Name
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
#
# Example : s_globalDBName = "mydb.mydomain.com"
#------------------------------------------------------------------------------
s_globalDBName=orcl
#------------------------------------------------------------------------------
# Name : s_dbSid
# Datatype : String
# Description: The Starter Database SID.
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
#
# Example : s_dbSid = "orcl"
#------------------------------------------------------------------------------
s_dbSid=orcl
#------------------------------------------------------------------------------
# Name : n_dbStorageType
# Datatype : Number
# Description: Determines the type of storage to use for the the database.
#
# This entry should be specified as an number. The valid values
# that you can use map to the following options:
# 1 - Place the data files on a file system
# 2 - Use Automatic Storage Management (ASM)
# 3 - Place the datafiles on raw partitions
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
#
#------------------------------------------------------------------------------
n_dbStorageType=1
#------------------------------------------------------------------------------
# Name : s_dlgRBORecoveryLocation
# Datatype : String
# Description: If using a file system for storing backup and recovery files,
# this entry is used for specifying the location on the file
# system for storing these files..
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_enableAutoBackup=true
# b_useFileSystemForRecovery=true
#
# Example : s_dlgRBORecoveryLocation="/u01/app/oracle/flash_recovery_area"
#------------------------------------------------------------------------------
s_dlgRBORecoveryLocation="/u01/app/oracle/flash_recovery_area"
#------------------------------------------------------------------------------
# Name : s_dlgRBOUsername
# Datatype : String
# Description: Regardless of the type of storage you choose for backup and
# recovery, if you decide to enable automated backups, a job will
# be scheduled to run daily at 2:00 AM to backup your database.
#
# This job will run as the operating system user that you specify
# using this entry.
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_enableAutoBackup=true
#
# Example : s_dlgRBOUsername = "oracle"
#------------------------------------------------------------------------------
s_dlgRBOUsername=oracle
#------------------------------------------------------------------------------
# Name : s_superAdminSamePasswd
# Datatype : String
# Description: Stores the password to be used for all accounts.
#
# NOTE: In order to perform the silent install successfully, you
# must specify the same password in both variables:
# - s_superAdminSamePasswd
# - s_superAdminSamePasswdAgain
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_useSamePassword=true
#
#------------------------------------------------------------------------------
s_superAdminSamePasswd=admin
#------------------------------------------------------------------------------
# Name : s_superAdminSamePasswdAgain
# Datatype : String
# Description: Stores the password to be used for all accounts.
#
# NOTE: In order to perform the silent install successfully, you
# must specify the same password in both variables:
# - s_superAdminSamePasswd
# - s_superAdminSamePasswdAgain
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_useSamePassword=true
#
#------------------------------------------------------------------------------
s_superAdminSamePasswdAgain=admin
#------------------------------------------------------------------------------
# Name : s_superAdminSamePasswd
# Datatype : String
# Description: Stores the password to be used for each of the database schemas
# SYS, SYSTEM, SYSMAN, and DBSNMP.
#
# NOTE: In order to perform the silent install successfully, you
# must specify the same passwords for each schema using both:
# - sl_superAdminSamePasswds
# - sl_superAdminSamePasswdsAgain
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_useSamePassword=false
#
# Example : sl_superAdminPasswds = {"<password for SYS>","<password for SYSTEM>","<password for SYSMAN>","<password for DBSNMP>"}
#------------------------------------------------------------------------------
sl_superAdminPasswds=admin
#------------------------------------------------------------------------------
# Name : s_superAdminSamePasswdAgain
# Datatype : String
# Description: Stores the password to be used for each of the database schemas
# SYS, SYSTEM, SYSMAN, and DBSNMP.
#
# NOTE: In order to perform the silent install successfully, you
# must specify the same passwords for each schema using both:
# - sl_superAdminSamePasswds
# - sl_superAdminSamePasswdsAgain
#
# Pre-requsites for setting this variable:
# n_configurationOption=1
# n_performUpgrade=0
# n_dbType = 1, 2, or 3
# b_useSamePassword=false
#
# Example : sl_superAdminPasswdsAgain = {"<password for SYS>","<password for SYSTEM>","<password for SYSMAN>","<password for DBSNMP>"}
#------------------------------------------------------------------------------
sl_superAdminPasswdsAgain=admin
其他的一切默认。
Linux 挂载windows 共享盘方法:
#service nfs start
#mount -o username=administrator,password=pwd //10.85.10.80/RAC /mnt
10. 开始安装
[oracle@Dave database]$ pwd
/mnt/10201_database_linux32_FromOracle/database
[oracle@Dave database]$ ./runInstaller -silent -responseFile /mnt/10201_database_linux32_FromOracle/database/response/enterprise.rsp
................................................
..... 半个小时之后....
................................................
Configuration assistant "Oracle Net Configuration Assistant" succeeded
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 "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbca/orcl/orcl.log" for further details.
Configuration assistant "Oracle Database Configuration Assistant" succeeded
INFO: Command = /u01/app/oracle/product/10.2.0/db_1/bin/isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.
Configuration assistant "iSQL*Plus Configuration Assistant" succeeded
INFO: All the tools have been executed Successfully
INFO: The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolAllCommands" script contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
-----------------------------------------------------------------------------
WARNING: A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/u01/app/oracle/oraInventory/orainstRoot.sh' with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.
11. 运行root.sh 脚本
[root@Dave ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@Dave ~]#
12. 验证Oracle:
[root@Dave hsperfdata_oracle]# ps -ef|grep smon
oracle 15233 1 0 00:39 ? 00:00:01 ora_smon_orcl
root 22293 22126 0 01:43 pts/3 00:00:00 grep smon
[root@Dave hsperfdata_oracle]# su - oracle
[oracle@Dave ~]$ export ORACLE_SID=orcl
[oracle@Dave ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 3 01:43:32 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
13. 其他命令使用参考:
$./dbca -silent -createdatabase -responseFile /home/oracle/embed/dbca.rsp
$./dbca /silent /responseFile /home/oracle/embed/netca.rsp