CentOS7.5 install Oracle12.1 and update
1.1 、 install centos7.5 1.2 、 vi etc/sysctl.conf add row: fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 1024 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 vm.swappiness = 0 vm.vfs_cache_pressure = 62 # net.core.default_qdisc = fq # net.ipv4.tcp_congestion_control = bbr net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_keepalive_time = 1800 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 #### net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_max_syn_backlog = 8192 net.ipv4.tcp_max_tw_buckets = 5000 1.3 、 vi etc/security/limits.conf add row: oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240oracle hard stack 32768 1.4 、 vi etc/pam.d/login add row: session required /lib64/security/pam_limits.so session required pam_limits.so 1.5 、 vi etc/profile add row: if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi 1.6 、 vi etc/hosts add row:127.0.0.1 oracle12c oracle12c.localdomain sysctl -p 1.7 、 for group in oinstall dba backupdba oper dgdba kmdba; do groupadd $group ; done 1.8 、 useradd -g oinstall -G dba,oper,backupdba,dgdba,kmdba -d /home/oracle -m oracle 1.9 、 passwd oracle 1.10 、 vi home/oracle/.bash_profile add row: export ORACLE_BASE=/opt/oracle #oracle 数据库安装目录 export ORACLE_HOME=$ORACLE_BASE/12c #oracle 数据库 路径 export ORACLE_SID=oracle12c #oracle 启动数据库实例名 export ORACLE_TERM=xtermexport ORACLE_HOSTNAME=oracle12c.localdomain export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi export LANG=C # 防止安装过程出现乱码 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK # 设 置 Oracle 客户端字符集,必须与 Oracle# 安装时设置的字符集保持 一致,如: ZHS16GBK ,否则出现数据导入导出中文乱码问题 1.11 、 mount -B /run/media/birdofprey/CentOS\ 7\ x86_64/ /mnt 1.12 、 cp -r /etc/yum.repos.d/ /etc/yum.repos.d.backup 1.13 、 vi etc/yum.repos.d/CentOS-Base.repo contents: [base] name=CentOS-$releasever - Base baseurl=file:///mnt gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 1.14 、 yum -y install binutils compat-libstdc++ compat-libstdc++- 33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel make sysstat unixODBC-devel binutils-* compat-libstdc++* elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc++* make* sysstat* unixODBC* wget unzip compat-libcap1.i686 compat-libcap1.x86_64 1.15 、 upload oracle12cinstall.zip 1.16 、 ./runInstaller2、update 12.1 2.1、download zip p28259833_121020_Linux-x86-64.zip #### Database Patch Set Update 12.1.0.2.181016 p28440711_121020_Linux-x86-64.zip #### OJVM PATCH SET UPDATE 12.1.0.2.181016 p6880880_121010_Linux-x86-64.zip #### OPatch Version: 12.2.0.1.16 2.2、以 oracle 登陆用户,vi .bash_profile : add row: export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch 2.3、mv $ORACLE_HOME/Opatch $ORACLE_HOME/Opatch.backup 2.4、unzip p6880880_121010_Linux-x86-64.zip 2.5、mv Opatch/ $ORACLE_HOME/ 2.6、sqlplus / as sysdba SQL>SHUTDOWN IMMEDIATE; 2.7、lsnrctl stop 2.8、cd <PATCH_TOP_DIR>/28440711 2.9、opatch prereq CheckConflictAgainstOHWithDetail -ph ./ && opatch apply 2.10、cd cd <PATCH_TOP_DIR>28259833 && opatch apply 2.11、sqlplus / as sysdba SQL>startup; SQL>alter pluggable database {databasename} open; SQL>show pdbs; 2.12、cd $ORACLE_HOME/Opatch 2.13、./datapatch -verbose 2.14、shutdown 2.15、startup 2.16、alter pluggable database all open; 2.17、sqlplus / as sysdba SQL> select comments from dba_registry_history; COMMENTS -------------------------------------------------------------------------------- RAN jvmpsu.sql RDBMS_12.1.0.2.0DBPSU_LINUX.X64_161210 SQL>select * from product_component_version 3、update linux kernel and configure autostart oracle12c 3.1、[oracle ~]$ vi /lib/systemd/system/oracle-rdbms.service row: # /etc/systemd/system/oracle-rdbms.service # Invoking Oracle scripts to start/shutdown Instances defined in /etc/oratab # and starts Listener [Unit] Description=Oracle Database(s) and Listener Requires=network.target [Service] Type=forking Restart=no ExecStart=/opt/oracle/12c/bin/dbstart /opt/oracle/12c ### 按照用户自己的 ORACLE_HOME 编写ExecStop=/opt/oracle/12c/bin/dbshut /opt/oracle/12c ### 按照用户自己的 ORACLE_HOME 编写 User=oracle [Install] WantedBy=multi-user.target # kongxx # CSDN # https://blog.csdn.net/kongxx/article/details/82155876 3.2、[oracle ~]$ systemctl daemon-reload [oracle ~]$ systemctl enable oracle-rdbms.service 3.3、[oracle ~]$ vi /etc/oratab rewrit: oracle12c:/opt/oracle/12c:Y 3.4、download linux-kernel package: kernel-ml-4.18.3-1.el7.elrepo.x86_64.rpm, kernel-ml-devel-4.18.3-1.el7.elrepo.x86_64.rpm, kernel-ml-doc-4.18.3-1.el7.elrepo.noarch.rpm, kernel-ml-headers-4.18.3-1.el7.elrepo.x86_64.rpm, kernel-ml-tools-4.18.3-1.el7.elrepo.x86_64.rpm, kernel-ml-tools-libs-4.18.3-1.el7.elrepo.x86_64.rpm, perf-4.18.3-1.el7.elrepo.x86_64.rpm, python-perf-4.18.3-1.el7.elrepo.x86_64.rpm rpm -ivh *.rpm --force –nodeps cat /boot/grub2/grub.cfg | grep menuentry menuentry 'CentOS Linux (4.18.3-1.el7.elrepo.x86_64) 7 (Core)' grub2-set-default "CentOS Linux (4.18.3-1.el7.elrepo.x86_64) 7 (Core)" grub2-editenv list 4、update oracle12c is archivelog mode and rman dbbackup full database 4.1、sqlplus / as sysdba SQL>shutdown immediate; SQL>startup mount; SQL>alter database archivelog; SQL>alter database open; SQL>alter pluggable database oracle12cpdb open; SQL> select log_mode from v$database; 4.2、rman target / CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/oracle12cdbbackupfull/oracle12c/control%F.bak'; CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 1024 M; 4.3、cd $ORACLE_BASE && mkdir oracle12cdbbackupfull && cd oracle12cdbbackupfull/ vi dbfullbackup.rman row: run{ crosscheck backup of database; delete noprompt backupset; backup as backupset database format '/opt/oracle/oracle12cdbbackupfull/oracle12c/oracle12cdbbackupfull%U_%d_%T_%s_ %p.bak'include current controlfile plus archivelog format '/opt/oracle/oracle12cdbbackupfull/oracle12c/oracle12carchivelog%U_%d_ %T_%s_%p.bak' delete all input; report obsolete; delete noprompt obsolete; } 4.4、vi oracle12cdbfullbackup.sh row: !#/bin/bash cd /opt/oracle/oracle12cdbbackupfull rman target / @dbfullbackup.rman chmod +x oracle12cdbfullbackup.sh 4.5、crontab -e row: 0 3 * * * /opt/oracle/oracle12cdbbackupfull/oracle12cdbfullbackup.sh /opt/oracle/oracle12cdbbackupfull/rman.log 2>&1 >感谢打赏,不论多少,都感激不尽