客服微信
本文为云贝教育 刘峰 原创,请尊重知识产权,转发请注明出处,不接受任何抄袭、演绎和未经注明出处的转载。
Ø数据库安装版本 19c单机
Ø操作系统版本 Linux 8+
如果是运行数据库,建议更改为英语使用UTF8,查看命令如下:
localectl status|grep LANG
设置语言
localectl set-locale.UTF8 && localectl status|grep LANG
查看时间的时区,如果不是中国内的,请修改
查看时间时区 Timedatectl 设置时区 timedatectl set-timezone "Asia/Shanghai" timedatectl set-time HH:MM:SS timedatectl set-time "2012-10-30 18:17:16" --将系统时间同步给硬件时间 timedatectl set-local-rtc 1
hostnamectl set-hostname ora19c
1)防火墙 systemctl stop firewalld systemctl disable firewalld 2)selinux--查看 getenforce if [ $SELINUX != "SELINUX=disabled" ];then cp /etc/selinux/config /etc/selinux/config.bak sed -i 's/^SELINUX=/#SELINUX=/g' /etc/selinux/config sed -i '$a SELINUX=disabled' /etc/selinux/config else echo "SELINUX is already disabled" fi 3)透明大页 --查看 [root@pgDB01 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never --关闭 sed -i 's/quiet/quiet transparent_hugepage=never/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg reboot
cp /etc/fstab /etc/fstab_`date +"%Y%m%d_%H%M%S"` echo "tmpfs /dev/shm tmpfs rw,exec 0 0">>/etc/fstab
cp /etc/hosts /etc/hosts_`date +"%Y%m%d_%H%M%S"` echo ' 192.168.74.129 ora19c1 '>> /etc/hosts cat /etc/hosts
--备份 cp /etc/sysctl.conf /etc/sysctl.conf.bak --配置 echo MemTotal=`grep MemTotal /proc/meminfo | awk '{print $2}'` PAGE_SIZE=`getconf PAGE_SIZE` shmmax=`expr $MemTotal \* 1024` shmall=`expr $shmmax / $PAGE_SIZE` cat >> /etc/sysctl.conf << EOF fs.file-max = 6815744 kernel.sem = 10000 10240000 10000 1024 kernel.shmmni = 4096 kernel.shmall = $shmall kernel.shmmax = $shmmax net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 16777216 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.core.wmem_default = 16777216 fs.aio-max-nr = 6194304 vm.dirty_ratio=20 vm.dirty_background_ratio=3 vm.dirty_writeback_centisecs=100 vm.dirty_expire_centisecs=500 vm.swappiness=10 vm.min_free_kbytes=524288 net.core.netdev_max_backlog = 30000 net.core.netdev_budget = 600 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 #vm.nr_hugepages =51200 EOF --启用参数 sysctl --system
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \ bc \ binutils \ compat-libcap1 \ compat-libstdc++ \ elfutils-libelf \ elfutils-libelf-devel \ fontconfig-devel \ glibc \ glibc-devel \ ksh \ libaio \ libaio-devel \ libX11 \ libXau \ libXi \ libXtst \ libXrender \ libXrender-devel \ libgcc \ libstdc++ \ libstdc++-devel \ libxcb \ make \ net-tools \ nfs-utils \ python \ python-configshell \ python-rtslib \ python-six \ targetcli \ smartmontools \ sysstat \ kmod-oracleasm \ kmod-libs \
rpm安装
yum -y install targetcli python python-configshell python-rtslib python-six bc binutils compat-libstdc compat-libcap1 gcc gcc-c++ libX11 libXau libXi libXtst libXrender libXrender-devel libxcb glibc glibc-common glibc-devel fontconfig-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat openssh-clients compat-libcap1 xorg-x11-utils xorg-x11-xauth elfutils unixODBC unixODBC-devel libXp elfutils-libelf elfutils-libelf-devel smartmontools yum install -y /soft/*.rpm yum -y install /lib64/libnsl.so.1
日常管理工作安装
yum -y install unzip sysstat setuptool telnet iotop openssh-clients net-tools unzip libvncserver tigervnc-server device-mapper-multipath dstat lsof ntp psmisc redhat-lsb-core parted xhost strace showmount expect tcl
1)创建用户组 groupadd -g 54321 oinstall groupadd -g 54322 dba groupadd -g 54323 oper groupadd -g 54324 backupdba groupadd -g 54325 dgdba groupadd -g 54326 kmdba groupadd -g 54327 asmdba groupadd -g 54330 racdba 2)创建oracle用户 useradd -g oinstall -G dba,oper,backupdba,dgdba,kmdba,asmdba,racdba -u 6000 oracle --修改oracle密码 echo "Oracle123()"|passwd oracle --stdin 3)创建目录 mkdir -p /u01/app mkdir -p /u01/app/oracle mkdir -p /u01/app/oracle/product/19.3/dbhome_1 chown -R oracle:oinstall /u01/app chmod -R 775 /u01/app
cat >> /home/oracle/.bash_profile << "EOF" umask 022 export TMP=/tmp export TMPDIR=$TMP export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/19.3/dbhome_1 export ORACLE_SID=orclcdb export PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH EOF
1、备份配置文件 cp /etc/security/limits.conf /etc/security/limits.conf.bak 2、修改oracle会话限制 cat >> /etc/security/limits.conf << "EOF" oracle soft nproc 655350 oracle hard nproc 655350 oracle soft nofile 655360 oracle hard nofile 655360 oracle soft stack 102400 oracle hard stack 327680 EOF echo --------------/etc/pam.d/login----------------- echo cat >> /etc/pam.d/login << "EOF" session required pam_limits.so EOF --------------/etc/profile----------------- cat >> /etc/profile << "EOF" if [ $USER = "oracle" ] || [ $USER = "root" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi EOF
su – oracle cd /soft/ unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
1)配置rsp文件,静默安装db
$ORACLE_HOME/install/response/db_install.rsp
模版如下:
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/19.3/dbhome_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSDGDBA_GROUP=dgdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=racdba oracle.install.db.rootconfig.executeRootScript=false
2)执行安装
--设置兼容性, 解决[INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck' export CV_ASSUME_DISTID=RHEL7.6 cd $ORACLE_HOME --安装前检查 ./runInstaller -executePrereqs -silent -responseFile /u01/app/oracle/product/19.3/dbhome_1/install/response/db_install.rsp --安装DB软件 ./runInstaller -silent -responseFile /u01/app/oracle/product/19.3/dbhome_1/install/response/db_install.rsp -skipPrereqs
--配置文件 $ORACLE_HOME/assistants/dbca/dbca.rsp --配置内容 responseFileVersion=/home/oracle/rspfmt_dbca_response_schema_v19.0.0 gdbName=orclcdb sid=orclcdb sysPassword=oracle oracleHomeUserPassword=oracle templateName=General_Purpose.dbc emExpressPort=5500 totalMemory=800 sysPassword=Oracle123 systemPassword=Oracle123 datafileDestination=/u01/app/oracle/oradata characterSet=ZHS16GBK nationalCharacterSet=AL16UTF16 databaseType=OLTP createAsContainerDatabase=true
$ dbca -silent -createDatabase -responseFile $ORACLE_HOME/assistants/dbca/dbca.rsp Prepare for db operation 10% complete Copying database files 40% complete Creating and starting Oracle instance 42% complete 46% complete 52% complete 56% complete 60% complete Completing Database Creation 66% complete 69% complete 70% complete Executing Post Configuration Actions 100% complete Database creation complete. For details check the logfiles at: /u01/app/oracle/cfgtoollogs/dbca/orclcdb. Database Information: Global Database Name:orclcdb System Identifier(SID):orclcdb Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orclcdb/orclcdb.log" for further details