1、安装oracle 时,swap空间是必须的
grep SwapTotal /proc/meminfo
2、从Oracle Database 11g开始,自动内存管理功能需要更多的共享内存(/dev/shm)和文件描述符。
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory must be at least the greater of the MEMORY_MAX_TARGET and MEMORY_TARGET parameters for each Oracle instance on the computer. If the MEMORY_MAX_TARGET parameter or the MEMORY_TARGET parameter is set to a nonzero value, and an incorrect size is assigned to the shared memory, it results in an ORA-00845 error at startup. On Linux systems, if the operating system /dev/shm mount size is too small for the Oracle system global area (SGA) and program global area (PGA), it results in an ORA-00845 error.
The number of file descriptors for each Oracle instance must be at least 512*PROCESSES. The limit of descriptors for each process must be at least 512. If file descriptors are not sized correctly, you see an ORA-27123 error from various Oracle processes and potentially Linux Error EMFILE (Too many open files)in non-Oracle processes.
To determine the amount of shared memory available, enter the following command:
#df -h /dev/shm/
共享内存的大小必须至少大于计算机上每个Oracle实例的memory_MAX_TARGET和memory_TARGET参数。如果MEMORY_MAX_TARGET参数或MEMORY_TARGET参数设置为非零值,并且分配给共享内存的大小不正确,则会导致启动时出现ORA-00845错误。在Linux系统上,如果操作系统/dev/shm装载大小对于Oracle系统全局区域(SGA)和程序全局区域(PGA)来说太小,则会导致ORA-00845错误。
每个Oracle实例的文件描述符数必须至少为512*PROCESSES。每个进程的描述符限制必须至少为512个。如果文件描述符的大小不正确,您会看到来自各种Oracle进程的ORA-27123错误,以及非Oracle进程中可能出现的Linux错误EMFILE(打开的文件太多)。
要确定可用的共享内存量,请输入以下命令:
#df-h/dev/shm/
扩大共享内存大小,直接指定大小为size=4096M
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=4096M 0 0
umount /dev/shm
mount /dev/shm
df -h /dev/shm
3、当LOCK_SGA参数启用时,或在Linux上使用HugePages时,不能使用MEMORY_MAX_TARGET和MEMORY_TARGET参数。
The MEMORY_MAX_TARGET and MEMORY_TARGET parameters cannot be used when the LOCK_SGA parameter is enabled, or with HugePages on Linux.
4、全局数据库名称超过八个字符,则数据库名称值(在DB_name参数中)将被截断为前八个字符并且DB_UNIQUE_name参数值将设置为全局名称。
In addition, if you click All Initialization Parameters and the global database name is longer than eight characters, then the database name value (in the DB_NAME parameter) is truncated to the first eight characters, and the DB_UNIQUE_NAME parameter value is set to the global name.
5、/tmp临时目录空间要求大于1G
1 GB of space in the /tmp directory
6、OUI安装时,像素显示比例要求 1024 x 768 or higher.
The minimum resolution for Oracle Database 11g Release 2 (11.2) is 1024 x 768 or higher.
7、设置TCP/IP临时端口范围参数,以便为预期的服务器工作负载提供足够的临时端口。确保将下限设置为至少9000或更高,以避免使用众所周知的端口,并避免使用Oracle和其他服务器端口通常使用的注册端口范围内的端口。
For example, with IPv4, use the following command to check your current range for ephemeral ports:
$ cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000
如果范围的下限值大于9000,并且该范围对于预期的工作负载足够大,则可以忽略有关临时端口范围的OUI警告。
例如,对于IPv4,使用以下命令检查临时端口的当前范围:
$cat/proc/sys/net/ipv4/ip_local_port_range
32768 61000
在前面的示例中,最低端口(32768)和最高端口(61000)设置为默认范围。
如有必要,请将UDP和TCP临时端口范围更新到足以满足预期系统工作负载的范围,并确保临时端口范围从9000及以上开始。例如:
#echo 9000 65500>/proc/sys/net/ipv4/ip_local_port_range
Oracle建议您将这些设置永久化。例如,作为root用户,使用文本编辑器打开/etc/sysctl.conf,并添加或更改为:net.ipv4.ip_local_port_range=9000 65500,然后重新启动网络(#/etc/rc.d/init.d/networkrestart)。有关如何在系统重新启动时自动执行这种短暂的端口范围更改的详细信息,请参阅Linux分发系统管理文档。
8、安装 cvuqdisk包。
install the operating system package cvuqdisk. Without cvuqdisk, the Cluster Verification Utility (CVU) cannot find shared disks,
如果没有cvuqdisk,群集验证实用程序(CVU)将无法找到共享磁盘,并且在运行群集验证实用工具时会收到“Package cvuqdisk not installed”错误。
9、关闭透明HugePage
Red Hat Enterprise Linux 6、Oracle Linux 6、SUSE 11和Unbreakable Enterprise Kernel 2(UEK2)内核开始,透明HugePages默认在运行时启用。然而,透明HugePages可能会导致内存分配延迟,因为内存是动态分配的。因此,Oracle建议您在所有Oracle数据库服务器上禁用透明HugePage,以避免性能问题。
虽然透明HugePage与HugePage类似,但它们是在运行时由内核中的khugepaged线程动态设置的,而标准HugePage是在启动时预先分配的。Oracle建议您使用标准HugePages来增强性能。
不同操作系统版本关闭透明大页的方法不一样,可参考:https://blog.csdn.net/weixin_34792272/article/details/116967480?ops_request_misc=&request_id=&biz_id=102&utm_term=centos7%20%20%E6%B0%B8%E4%B9%85%E5%85%B3%E9%97%AD%E9%80%8F%E6%98%8E%E5%A4%A7%E9%A1%B5%E9%85%8D%E7%BD%AE&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-2-116967480.142v68pc_rank_34_queryrelevant25,201v4add_ask,213v2t3_control1&spm=1018.2226.3001.4187
centos7关闭透明大页步骤:
cd /etc/default/
cp grub grub_bak_180508
vi grub 在 rhgb quiet 后面加上 transparent_hugepage=never
生效配置cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg_bak180508
grub2-mkconfig -o /boot/grub2/grub.cfg
重启操作系统后,查询如下 grep Huge /proc/meminfo,认为最简单方便的:是否禁用透明大页
AnonHugePages: 0 kB 与透明大页有关,透明大页关闭,则显示0
10、安装包
yum install -y binutils compat-libcap1 compat-libstdc++ compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc+±devel libXi libXtst make sysstat compat-libstdc+±33 elfutils-libelf-devel unixODBC unixODBC-devel
11、创建用户和组
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/useradd -u 502 -g oinstall -G dba oracle
12、配置/etc/security/limits.conf参数,一般配置oracle及grid用户
nofile(Open file descriptors) at least 1024 at least 65536
nproc(Number of processes available to a single user) at least 2047 at least 16384
stack(Size of the stack segment of the process) at least 10240 KB at least 10240 KB, and at most 32768 KB
以下设置的是oracle给的最小值,实际设置可以大一些
oracle soft nofile 1024
oracle hard nofile 65535
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
13、配置内核参数/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
14、创建oracle_base目录
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
mkdir -p /u01/app/oracle/product/11.2.0
mkdir /u01/app/oracle/oradata
mkdir /u01/app/oracle/inventory
mkdir /u01/app/oracle/fast_recovery_area
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
15、设置环境变量
su - oracle
vim /home/oracle/.bash_profile
添加:
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=
O
R
A
C
L
E
B
A
S
E
/
p
r
o
d
u
c
t
/
11.2.0
O
R
A
C
L
E
S
I
D
=
o
r
c
l
P
A
T
H
=
ORACLE_BASE/product/11.2.0 ORACLE_SID=orcl PATH=
ORACLEBASE/product/11.2.0ORACLESID=orclPATH=PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT=‘yyyy-mm-dd hh24:mi:ss’
立即生效:source /home/oracle/.bash_profile
16、将安装介质中的res文件模板根据需要进行修改后报错,执行静默安装oracle软件
root用户编辑响应文件
vim /tmp/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=localhost
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
切换到oracle用户,执行
cd /tmp/database
./runInstaller -silent -force -ignorePrereq -responseFile /tmp/database/response/db_install.rsp
现Successfully Setup Software代表安装完成
2.切换root用户运行脚本
sh /u01/app/oracle/inventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/root.sh
17、用oracle用户登录配置监听
$ORACLE_HOME/bin/netca -silent -responseFile /tmp/database/response/netca.rsp
执行成功后监听启动成功
18、使用静默方式创建数据库
切换到root用户
vim /tmp/database/response/dbca.rsp
GDBNAME = “orcl”
SID = “orcl”
SYSPASSWORD = “oracle”
SYSTEMPASSWORD = “oracle”
SYSMANPASSWORD = “oracle”
DBSNMPPASSWORD = “oracle”
DATAFILEDESTINATION =/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = “ZHS16GBK”
TOTALMEMORY = “800”
切换到Oracle用户进行静默配置
$ORACLE_HOME/bin/dbca -silent -responseFile /tmp/database/response/dbca.rsp
执行成功后检查ora进程是否存在,连接数据库是否可以成功
19、数据库默认为非归档模式,可修改为归档模式或重新配置内存大小
20、将oracle设置为开机自启动
oracle用户新增启动文件
vim /u01/app/oracle/start_ora.sh
#!/bin/sh
lsnrctl start
echo “Oracle just have been started!”
echo “Begin to start the oracle!”
sqlplus /nolog <<EOF
connect / as sysdba
startup
exit
EOF
exit
root用户修改文件
vim /etc/rc.d/rc.local
su - oracle -c “/u01/app/oracle/start_ora.sh”
root用户,增加执行权限
chmod 755 /etc/rc.d/rc.local
oracle 12c静默安装时需要多创建几个组
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba oracle
创建数据库的静默脚本
[GENERAL]
RESPONSEFILE_VERSION = “12.1.0”
OPERATION_TYPE = “createDatabase”
[CREATEDATABASE]
GDBNAME = “orcl12c”
SID = “orcl12c”
CREATEASCONTAINERDATABASE =true
NUMBEROFPDBS = 1
PDBNAME = PDB1
PDBADMINPASSWORD = “oracle”
TEMPLATENAME = “General_Purpose.dbc”
SYSPASSWORD = “oracle”
SYSTEMPASSWORD = “oracle”
DBSNMPPASSWORD = “oracle”
DATAFILEDESTINATION = /u01/app/oracle/oradata
RECOVERYAREADESTINATION= /u01/app/oracle/fast_recovery_area
CHARACTERSET = “ZHS16GBK”
LISTENERS = “listener”
TOTALMEMORY = “1000”
[createTemplateFromDB]
[createCloneTemplate]
SOURCEDB = “orcl”
TEMPLATENAME = “My Clone TEMPLATE”
[DELETEDATABASE]
SOURCEDB = “orcl”
[generateScripts]
TEMPLATENAME = “New Database”
GDBNAME = “orcl12.us.oracle.com”
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = “orcl12c.us.oracle.com”
NODENAME=
SYSDBAUSERNAME = “sys”
[DELETEINSTANCE]
DB_UNIQUE_NAME = “orcl12c.us.oracle.com”
INSTANCENAME = “orcl12c”
SYSDBAUSERNAME = “sys”
[CREATEPLUGGABLEDATABASE]
SOURCEDB = “orcl”
PDBNAME = “PDB1”
PDBADMINPASSWORD = “oracle”
[UNPLUGDATABASE]
SOURCEDB = “orcl”
PDBNAME = “PDB1”
ARCHIVETYPE = “TAR”
[DELETEPLUGGABLEDATABASE]
SOURCEDB = “orcl”
PDBNAME = “PDB1”
[CONFIGUREPLUGGABLEDATABASE]
SOURCEDB = “orcl”
PDBNAME = “PDB1”