写给自己:linux运维路,自己动手趟一遍
参考:http://www.cnblogs.com/yingsong/p/6031235.html
----------------------------
准备工作:
内存及swap要求
1-2G物理内存时 swap是1.5倍
2-16G物理内存时 swap相等
大于16G物理内存时 swap 16G
硬盘空间 >20G
关闭防火墙及SELINUX
修改内核参数:
#vi/etc/sysctl.conf net.ipv4.ip_local_port_range= 9000 65500 fs.file-max = 6815744 kernel.shmall = 10523004 kernel.shmmax = 6465333657 kernel.shmmni = 4096 kernel.sem = 250 32000 100128 net.core.rmem_default=262144 net.core.wmem_default=262144 net.core.rmem_max=4194304 net.core.wmem_max=1048576 fs.aio-max-nr = 1048576 # sysctl -p
修改用户限制文件
#vi /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 102405
创建用户及组
#groupadd dba #useradd -m -g dba oracle #passwd oracle
创建安装目录
#mkdir -p /ora11/product/11.2.0/db_1
数据文件存放目录
#mkdir -p /ora11/oradata
数据恢复目录
#mkdir -p /ora11/recovery_data
数据库创建及使用过程中的日志目录
#mkdir -p /ora11/oraInventory
修改安装目录权限
#chown -R oracle:dba /ora11 #chmod -R 775 /ora11
登录oracle用户,设置环境变量
#su - oracle $vim .bash_profile
export ORACLE_BASE=/ora11 export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64 export ORACLE_SID=rac1 export PATH=$PATH:$ORACLE_HOME/bin
$source .bash_profile //使设置生效
安装依赖包
自己整理了一下(全部在这里了)
#yum install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 \ elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-devel\ glibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libaio \ libaio.i686 libaio-devel libaio-devel.i686 make sysstat
---------------------------------------
将安装包上传到oracle用户的home目录
链接:http://pan.baidu.com/s/1bNvf22 密码:zxmv
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
#unzip linux.x64_11gR2_database_1of2.zip #unzip linux.x64_11gR2_database_1of2.zip #cd database #su - oracle
数据库安装配置 文件
/database/response/db_install.rsp 安装应答配置文件
/database/response/dbca.rsp 创建数据库应答
/database/response/netca.rsp 建立监听、本地服务名等网络设置应答
修改配置文件db_install.rsp,并安装 (实例名为rac1,密码为12345678)
#vim /home/oracle/database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=centos6-1 UNIX_GROUP_NAME=dba INVENTORY_LOCATION=/ora11/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/ora11/product/11.2.0/db_1 ORACLE_BASE=/ora11 oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=false 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 oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=rac1 oracle.install.db.config.starterdb.SID=rac1 oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=400 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.password.ALL=12345678 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.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/ora11/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/ora11/recovery_data DECLINE_SECURITY_UPDATES=true
登录oracle用户,执行安装
#su - oracle $./runInstaller -silent -ignorePrereq -responseFile /home/oracle/database/response/db_install.rsp
其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,responseFile是安装文件。
安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。
打开另一个终端,执行命令
#tail -100 f /u01/app/oracle/oraInventory/logs/installActions......log
可以实时跟踪查看安装日志,了解安装的进度。
---------------------------------------------
出错后,需要删除已经创建的目录,再次安装
rm -rf /ora11/* mkdir -p /ora11/product/11.2.0/db_1 /ora11/oradata /ora11/recovery_data /ora11/oraInventory chown -R oracle:dba /ora11 chmod -R 775 /ora11
-----------------------------------------------------------
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 7910 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1631 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-04-22_09-18-14PM. Please wait ...[oracle@centos6-1 database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-30011] The password entered does not conform to the Oracle recommended standards.
CAUSE: Oracle recommends that the ADMIN password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
ACTION: Provide a password that conforms to the Oracle recommended standards.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-30011] The password entered does not conform to the Oracle recommended standards.
CAUSE: Oracle recommends that the ADMIN password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
ACTION: Provide a password that conforms to the Oracle recommended standards.
You can find the log of this install session at:
/ora11/oraInventory/logs/installActions2017-04-22_09-18-14PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/ora11/oraInventory/orainstRoot.sh
/ora11/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
出现这个的话,说明已安装成功,则需要按提示操作,操作完返回Enter成功
以root用户执行下面这二条脚本
/ora11/oraInventory/orainstRoot.sh /ora11/product/11.2.0/db_1/root.sh