1、檢查安裝包 安裝依賴包 yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ks ...
- 1、檢查安裝包
安裝依賴包
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
- 2、創建用戶組和用戶
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
- 3、修改內核參數
vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 4294967295
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048576
使用/sbin/sysctl -p 使內核參數實時生效
- 4、修改用戶資源限制
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
- 5、修改配置文件
vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so
- 6、關閉selinux
vi /etc/selinux/config
把 SELINUX=disabled 設置為disabled即可
sed -i “s/SELINUX=enforcing/SELINUX=disabled/”
- 7、創建安裝目錄
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app
chmod -R 755 /u01/app/
- 8、修改/etc/profile配置文件
vi /etc/profile
if [ $USER = "oracle" ];then
if [ $SHELL = "/bin/ksh" ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
- 9、修改主機名
vi /etc/sysconfig/network
hostname=oracledb
vi /etc/hosts
192.168.0.106 oracledb
- 10、修該Oracle用戶變數
vi /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orcl
#export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
- 11、解壓安裝包
unzip linux.x64_11gR2_database_1of2.zip -d /u01/app/
unzip linux.x64_11gR2_database_2of2.zip -d /u01/app/
- 12、 靜默安裝
cd /u01/app/database/response
cp db_install.rsp db_install.rsp.bak
vi db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracledb
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app
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.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=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=orcl
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
註:
oracle.install.option=INSTALL_DB_SWONLY //安裝類型,只裝資料庫軟體
ORACLE_HOSTNAME=oracledb //主機名稱(命令hostname查詢)
UNIX_GROUP_NAME=oinstall // 安裝組
INVENTORY_LOCATION=/u01/app/oracle/oraInventory //INVENTORY目錄(不填就是預設值,本例此處需修改,因個人創建安裝目錄而定)
SELECTED_LANGUAGES=en,zh_CN // 選擇語言
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 // oracle_home 路徑根據目錄情況註意修改 本例安裝路徑/u01/app/oracle
ORACLE_BASE=/u01/app/oracle // oracle_base 註意修改
oracle.install.db.InstallEdition=EE // oracle版本
oracle.install.db.isCustomInstall=false //自定義安裝,否,使用預設組件
oracle.install.db.DBA_GROUP=dba //dba用戶組
oracle.install.db.OPER_GROUP=oinstall //oper用戶組
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //資料庫類型
oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName
oracle.install.db.config.starterdb.SID=orcl //SID(此處註意與環境變數內配置SID一致)
oracle.install.db.config.starterdb.memoryLimit=81920 //自動管理記憶體的記憶體(M)
oracle.install.db.config.starterdb.password.ALL=oracle //設定所有資料庫用戶使用同一個密碼
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手動寫了false)
DECLINE_SECURITY_UPDATES=true // **註意此參數 設定一定要為true
- 13、開始安裝
su - oracle
cd /u01/app/database
./runInstaller -silent -responseFile /u01/app/database/response/db_install.rsp
./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /u01/app/database/response/db_install.rsp
- 14、用oracle用戶登錄配置監聽
netca -silent -responseFile /u01/app/database/response/netca.rsp
netca -silent -responseFile /u01/app/database/response/netca.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@oracledb database]$ export DISPLAY=localhost:0.0
[oracle@oracledb database]$ netca -silent -responseFile /u01/app/database/response/netca.rsp
- 15、建立資料庫
dbca -silent -responseFile /u01/app/database/response/dbca.rsp
備註:需要修改dbca文件中的實例名稱,sys和system用戶的密碼