2.1依赖包检查安装
yum –y install binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel sysstat libaio libaio-devel elfutils-libelf-devel unixODBC unixoODBC-devel ntpdate lvm2 rsync net-tools unzip
此处要认真确认所需包都已安装,不然后面可能会报因依赖包缺少的WARNING。
2.2 修改系统参数
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
vi /etc/pam.d/login 最后加上:
#ORACLE SETTING
session required pam_limits.so
vi /etc/sysctl.conf
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2073116672
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 = 1048586
2.3 创建用户及权限目录
/usr/sbin/groupadd –g 501 oinstall && /usr/sbin/groupadd –g 502 dba && /usr/sbin/groupadd –g 503 oper &&/usr/sbin/useradd –g oinstall –G dba,oper –d /home/oracle –s /bin/bash oracle
mkdir –p /data/ora11g/product/11.2.0.4/db_1 && chown –R oracle:oinstall /data/ora11g && chmod –R 775 /data/ora11g && mkdir /home/oracle && chown –R oracle:oinstall /home/oracle
mkdir –p /data/ora11g/oraInventory && chown –R oracle:oinstall /data/ora11g/oraInventory
2.4 配置ORACLE家目录PROFILE
su – oracle
vi ~/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/data/ora11g
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
export ORACLE_SID=test
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$ORACLE_HOME/bin:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG="simplified chinese"_china.utf8
2.5 同步时钟
crontab –l
0 0 * * * /usr/sbin/ntpdate 192.168.1.1
三、 安装ORACLE 软件
cd /data/test/software
unzip p13390677_112040_Linux-x86-64_*.zip
关闭防火墙
Systemctl stop firewall
Systemctl disable firewall
使用静默方式安装oracle软件。在response目录下,有3个标准模板。
dbca.rsp , db_install.rsp netca.rsp
cp response/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=192.168.1.3
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/ora11g/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/data/ora11g/product/11.2.0.4/db_1
ORACLE_BASE=/data/ora11g
oracle.install.db.InstallEdition=EE
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=oper
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=test
oracle.install.db.config.starterdb.SID=test
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1536
oracle.install.db.config.starterdb.password.SYS=oracle
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=FILE_SYSTEM_STORAGE
SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
DECLINE_SECURITY_UPDATES=true
最后一条一定要写true.
开始静默安装oralce软件:
./runInstaller –silent –force –ignoreSysPrereqs –ignorePrereq –responseFile /home/oracle/db_install.rsp
./runInstaller -silent -force -ignoreSysPrereqs -ignorePrereq -responseFile /home/oracle/db_install.rsp
结束之后需要运行2条脚本,以root身份:
/data/ora11g/oraInventory/orainstRoot.sh
/data/ora11g/product/11.2.0.4/db_1/root.sh
四、 创建数据库
同样编辑dbca.rsp 模板:
cd /data/test/software/database/response/
cp dbca.rsp dbca.rsp.bak
vi dbaca.rsp
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "test"
SID = "test"
SYSPASSWORD = “oracle”
SYSTEMPASSWORD = “oracle”
TEMPLATENAME = "General_Purpose.dbc"
CHARACTERSET = "AL16UTF16"
$ORACLE_HOME/bin/dbca –silent –responseFile /data/test/software/database/dbca.rsp
五、 创建并修改监听
同样编辑netca.rsp 模板:
cd /data/test/software/database/response/
cp netca.rsp netca.rsp.bak
$ORACLE_HOME/bin/netca –silent –responseFile /data/test/software/database/response/netca.rsp
手动修改监听配置文件listener.ora 与tnsnames.ora:
cd /data/ora11g/product/11.2.0.4/db_1/network/admin
vi
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /data/ora11g
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /data/ora11g/product/11.2.0.4/db_1)
(SID_NAME = test)
)
)
Vi tnsnames.ora
test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test)
)
)
设置监听不产生XML日志
1)To avoid generating or reduce the xml files, please set the following parameter:
In sqlnet.ora
In listener.ora
Where the should be replaced with the actual name of the configured listener(s) in the listener.ora file.
For example, if the listener name is 'LISTENER_SCAN1', the parameter should be:
DIAG_ADR_ENABLED_LISTENER_SCAN1=OFF
-Reload or restart the TNS Listener for the parameter change to take effect.
设置这两个参数不会影响到listener.log日志的产生。
相比直接关闭Listener log的方式,还保留原有日志的产生.