1.修改linux透明大页(根据Oracle官方说法,此操作可以提升Oracle性能)
要检查是否已启用Transparent HugePage
cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
或
cat /sys/kernel/mm/transparent_hugepage/enabled
以下是一个示例输出,显示正在使用透明HugePages,因为[always]标志已启用。
[always] never
查看要禁用透明HugePages:
- 对于Oracle Linux 7和Red Hat Enterprise Linux 7,在文件中添加或修改transparent_hugepage = never参数
/etc/default/grub
:
例如:transparent_hugepage=never
注意:RUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
文件名可能因操作系统而异。检查操作系统文档以获取确切的文件名和禁用透明HugePages的步骤。
运行该grub2–mkconfig
命令以重新生成该grub.cfg
文件。
重新启动系统以使更改成为永久更改# grub2-mkconfig -o /boot/grub2/grub.cfg
配置标准大页:
kb为单位
设置启动分配内存大小cat /proc/meminfo
Hugepagesize: 2048 kB
400为800M内存,通过400*上面2048得到 ``` vi /etc/sysctl.d/99-oracle-database-preinstall-19c-sysctl.conf 或者 /etc/sysctl.conf
vm.nr_hugepages = 400
重启系统生效
使用oracle推荐脚本计算内存大页大小<br />uname -r 确定操作系统内核,以4.14为例如下下列脚本中没有则'2.6'|'3.8'|'4.14'追加内核选项
4.14.35-2047.500.10.el7uek.x86_64
```
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`
# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6'|'3.8'|'4.14') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
2.安装 oracle yum 源 or oracle 预安装rpm
wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo
yum install oracle-database-preinstall-19c
ol7 12cR2
yum install https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackageSource/oracle-database-server-12cR2-preinstall-1.0-5.el7.src.rpm
ol7 19c
yum install https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackageSource/oracle-database-preinstall-19c-1.0-3.el7.src.rpm
ol7 21c
yum install https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackageSource/oracle-database-preinstall-21c-1.0-1.el7.src.rpm
centos8 19c
dnf install https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm
centos8 21c
dnf install https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
3.设置hosts文件ip
[oracle@instance-ej1hspdt ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.0.4 instance-ej1hspdt instance-ej1hspdt.novalocal
4.设置防火墙和selinux
[root@instance-ej1hspdt ~]# systemctl stop firewalld
[root@instance-ej1hspdt ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are p
rotected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
5.修改oracle账户密码,修改安装目录用户和所属组及权限
chmod 777 /opt/oracle -R
chown oracle:oinstall /opt/oracle -R
6.安装oracle 软件
./runInstaller
7.安装数据库
/etc/init.d/oracledb_ORCLCDB-18c configure
8.设置环境变量
su - oracle
vi .bash_profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/18c/dbhome_1
export NLS_DATE_FORMAT = "yyyy-mm-dd:hh24:mi:ss"
PATH=$ORACLE_HOME/bin:$PATH;
export ORACLE_SID=ORCLCDB
9.netmgr设置监听,或者手工设置相关文件
分别将tsname.ora ,listener.ora当中的计算机名改为ip地址。
------------------------------------------------------------------
[oracle@instance-ej1hspdt ~]$ cat /opt/oracle/product/18c/dbhome_1/network/adm
in/listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/18c/dbhome_1/ne
twork/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.4)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
10.设置缺省账户过期时间
1.密码180天过期的问题
alter profile default limit password_life_time unlimited;
2.登录10次密码错误账户锁定
alter profile default limit failed_login_attempts unlimited;
3.取消段延迟特性
SQL> alter system set deferred_segment_creation=false;
4.密码大小写
sec_case_sensitive_logon
12c里面保持默认,不要设置为false,否则会提示密码错误
SQL> show parameter sec_case
NAME TYPE VALUE
------------------------------------ ----------- -----------------------------
-
sec_case_sensitive_logon boolean TRUE
11.设置rlwrap,下载epel-release yum ,安装rlwrap 设置环境变量
http://download.fedoraproject.org/pub/epel
yum install rlwrap
su - oracle
vi .bash_profile 追加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'