1、安装包
yum install -y yum installyum install -y binutilsyum install -y compat-libstdc++-33yum install -y elfutils-libelfyum install -y elfutils-libelf-develyum install -y expatyum install -y gccyum install -y gcc-c++yum install -y glibcyum install -y glibc-commonyum install -y glibc-develyum install -y glibc-headersyum install -y libaioyum install -y libaio-develyum install -y libgccyum install -y libstdc++yum install -y libstdc++-develyum install -y makeyum install -y pdkshyum install -y sysstatyum install -y unixODBCyum install -y unixODBC-devel2、 增加数据库组和用户
# id oracle (确认oracle用户是否存在)# /usr/sbin/groupadd oinstall (建立产品清单管理组)# /usr/sbin/groupadd dba (建立数据库安装组)# /usr/sbin/groupadd asmadmin (建立ASM管理组)# /usr/sbin/groupadd asmdba (建立Grid管理组)# /usr/sbin/useradd -g oinstall -G dba,asmdba oracle -d /home/oracle (oinstall为主要组,确保/home/oracle原不存在)3、修改系统参数
vi /etc/sysctl.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152#kernel.shmmax = 536870912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586vi /etc/security/limits.conf
oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi 创建安装目录(可根据情况,选择比较多空间的目录创建) mkdir -p /u01/app/chown -R oracle:oinstall /u01/app/chmod -R 775 /u01/app/ 创建/etc/oraInst.loc文件,内容如下 inventory_loc=/u01/app/oracle/oraInventoryinst_group=oinstall更改文件的权限 chown oracle:oinstall /etc/oraInst.locchmod 664 /etc/oraInst.loc 设置oracle环境变量 su - oraclevi ~/.bash_profileexport ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orcl注意,除了ORACLE_BASE和ORACLE_SID,( /etc/profile和.bash_profile中)不设置任何oracle相关环境变量(ORACLE_HOME, PATH, LD_LIBRARY_PATH等)。
解压oracle安装文件 unzip linux.x64_11gR2_database_1of2.zipunzip linux.x64_11gR2_database_2of2.zip 复制响应文件模板 mkdir etccp /home/oracle/database/response/* /home/oracle/etc/设置响应文件权限
su - rootchmod 700 /home/oracle/etc/*.rsp静默安装Oracle软件
su - oracle修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsporacle.install.option=INSTALL_DB_SWONLY //29 行 安装类型ORACLE_HOSTNAME=oracledb//37 行 主机名称UNIX_GROUP_NAME=oinstall //42 行 安装组INVENTORY_LOCATION=/u01/app/oracle/oraInventory //47 行 INVENTORY目录SELECTED_LANGUAGES=en,zh_CN,zh_TW //78 行 选择语言ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //83 行 oracle_homeORACLE_BASE=/u01/app/oracle //88 行 oracle_baseoracle.install.db.InstallEdition=EE //99 行 oracle版本oracle.install.db.isCustomInstall=true //108行 自定义安装oracle.install.db.DBA_GROUP=dba //142行 dba用户组oracle.install.db.OPER_GROUP=oinstall //147行 oper用户组oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //160行 数据库类型oracle.install.db.config.starterdb.globalDBName=orcl //165行 globalDBNameoracle.install.db.config.starterdb.SID=orcl //170行 SIDoracle.install.db.config.starterdb.memoryLimit=512 //200行 自动管理内存的最小内存(M)oracle.install.db.config.starterdb.password.ALL=oracle //233行 设定所有数据库用户使用同一个密码DECLINE_SECURITY_UPDATES=true //385行 设置安全更新cd database ./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp安装中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。查看安装日志信息了解安装进度 cd $ORACLE_BASE/oraInventory/logstail -100f installActions*.log出现类似如下提示表示安装完成:#-------------------------------------------------------------------... /u01/app/oracle/product/11.2.0/db_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software. #------------------------------------------------------------------- 使用root用户执行root.sh su root /u01/app/oracle/product/11.2.0/db_1/root.sh 增加oracle环境变量su - oracle vi ~/.bash_profileexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export TNS_ADMIN=$ORACLE_HOME/network/adminexport PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/binexport PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JREexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/libexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/libexport ORACLE_OWNER=oracleexport SPFILE_PATH=$ORACLE_HOME/dbsexport ORA_NLS10=$ORACLE_HOME/nls/data 静默配置网络$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/etc/netca.rsp 静默安装数据库修改仅安装数据库的响应文件/home/oracle/etc/dbca.rspGDBNAME="orcl.java-linux-test" //78 行 全局数据库的名字=SID+主机域名SID="orcl" //149行 SIDCHARACTERSET="AL32UTF8" //415行 编码NATIONALCHARACTERSET="UTF8" //425行 编码进行静默安装数据库
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp[oracle@segment2 ~]$ $ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rspEnter SYS user password: Enter SYSTEM user password: Copying database files1% complete 3% complete 11% complete 18% complete 26% complete$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/dbca.rsp
建库后实例检查 ps -ef | grep ora_ | grep -v grep | wc -l ps -ef | grep ora_ | grep -v grep 建库后监听检查 lsnrctl status