实验环境:
centos7
oracle11g-2.0.4
实验目的:
体验单机部署过程,记录优化脚本
[root@lab-250 db]# ll //oracle11g软件包 /tmp/db
total 2487200
-rw-r--r--. 1 root root 1395582860 Nov 7 06:20 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 root root 1151304589 Nov 7 06:20 p13390677_112040_Linux-x86-64_2of7.zip
01、selinux/firewalld/hosts
/etc/sysconfig/selinux
SELINUX=disabed
[root@lab-250 db]# systemctl disable firewalld
[root@lab-250 db]# systemctl stop firewalld
[root@lab-250 db]# hostname
lab-250
[root@lab-250 db]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.24.0.250 lab-250
02、kernel-turn
###/etc/sysctl.conf
#kernel.shmmax = 4294967296 //4g 单位k 单个共享内存段的最大值
#kernel.shmmni = 4096 //页大小 4kb
#kernel.shmall = 1048576 //共享内存段4g 页数量
注意:可根据实际内存大小做相应的调整
/etc/sysctl.d/oracle.conf
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.shmall = 1048576
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
syctl -p /etc/sysctl.d/oracle.conf //reflush
sysctl --system //check
###limits.conf
vim /etc/security/limits.conf
oracle soft nproc 102400
oracle hard nproc 102400
oracle soft nofile 102400
oracle hard nofile 102400
###/etc/pam.d/login
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
03、add user && group && dirs && env
groupadd -g 600 oinstall
groupadd -g 700 dba
useradd -g oinstall -G dba oracle
[root@lab-250 sysctl.d]# id oracle
uid=1000(oracle) gid=600(oinstall) groups=600(oinstall),700(dba)
mkdir -p /u01/{oracle,oraInventory}
chown -R oracle: /u01
su - oracle
~/.bash_profile
export ORACLE_SID=mvpbang
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=/u01/oracle/product/11.2.0/db1
export NLS_LANG=American_America.AL32UTF8
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:LD_LIBRARY_PATH
source ~/.bash_profile
04、requirements
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y sysstat*
yum install libXp* -y
yum install -y glibc-kernheaders
yum install -y binutils* compat-libstdc* elfutils-libelf* gcc* glibc* ksh* libaio* libgcc* libstdc* sysstat* libXp* glibc-kernheaders
05、unzip && setup-gui
[root@lab-250 db]# ls *.zip |xargs -n1 unzip
chown -R oracle: /tmp/db
su - oracle
cd /tmp/db/database
pass
注意:图形化安装就此忽略,相对简单前提是需要安装图形化
06、respone to initdb
###db_slown
01only_db.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 ###仅仅安装oracle软件 oracle.install.option=INSTALL_DB_SWONLY ###linux主机名 ORACLE_HOSTNAME= ###oracle属组 UNIX_GROUP_NAME=oinstall ###清单目录 INVENTORY_LOCATION=/u01/inventory ###支持语言 SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/oracle/product/11.2.0/db1 ORACLE_BASE=/u01/oracle ###企业版 oracle.install.db.InstallEdition=EE oracle.install.db.EEOptionsSelection=false 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=dba oracle.install.db.CLUSTER_NODES= oracle.install.db.isRACOneInstall= oracle.install.db.racOneServiceName= ###事务型数据库 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName= oracle.install.db.config.starterdb.SID= ###数据库语言 oracle.install.db.config.starterdb.characterSet=AL32UTF8 ###自动内存管理 oracle.install.db.config.starterdb.memoryOption= ###可分配给数据的内存大小 oracle.install.db.config.starterdb.memoryLimit= oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true ###账户密码 oracle.install.db.config.starterdb.password.ALL= 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.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= oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= oracle.install.db.config.asm.diskGroup= oracle.install.db.config.asm.ASMSNMPPassword= MYORACLESUPPORT_USERNAME= MYORACLESUPPORT_PASSWORD= ###不支持安全跟新(在线) SECURITY_UPDATES_VIA_MYORACLESUPPORT=false ###取消安全更新 DECLINE_SECURITY_UPDATES=true PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PWD= PROXY_REALM= COLLECTOR_SUPPORTHUB_URL= oracle.installer.autoupdates.option= oracle.installer.autoupdates.downloadUpdatesLoc= AUTOUPDATES_MYORACLESUPPORT_USERNAME= AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
[oracle@lab-250 database]$ cat -E 01only_db.rsp //注意检查是否存在空格,尾端!
[oracle@lab-250 database]$ ./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /tmp/db/database/01only_db.rsp
###root执行脚本
As a root user, execute the following script(s):
1. /u01/inventory/orainstRoot.sh
2. /u01/oracle/product/11.2.0/db1/root.sh
###初始化数据库实例
dbca -silent -createDatabase -templateName General_Purpose.dbc \
-gdbname mvpbang -sid mvpbang \
-sysPassword 123123 -systemPassword 123123 \
-responseFile NO_VALUE \
-datafileDestination /u01/oracle/oradata/ -redoLogFileSize 50 \
-recoveryAreaDestination /u01/oracle/flash_recovery_area \
-storageType FS -characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 \
-sampleSchema true \
-memoryPercentage 30 -totalMemory 2048 -databaseType MULTIPURPOSE -emConfiguration NONE
###启动监听器
lsnrctl status
lsnrctl start
07、psql connect instance
执行SQL查看database
总结:
整理文档,依稀记得当初第一次部署11g搞了一个星期记忆深刻,还是图形化安装!
网上的文档参差不齐,自己有理解浅薄,自然就磕磕盼盼!!!