redhat 8.8 安装oracle 19c
文件名:LINUX.X64_193000_db_home.zip。
redhat 8.8 安装oracle 19c
- 0、受到oracle 19c 支持的linux发行版
- 1、官方下载链接
- 2、官方文档
- 3、安装前基础环境准备
- 4、安装前系统配置
- 4.0、修改主机名-重要
- 4.1、硬件要求
- 4.2、软件要求
- 4.3、Installation Fixup Scripts
- 4.4、端口范围-Verifying UDP and TCP Kernel Parameters
- 4.5、Installing the cvuqdisk Package for Linux
- 4.6、配置/etc/hosts文件
- 4.7、禁用 Transparent HugePages
- 4.8、创建用户和组
- 4.9、创建安装目录
- 4.10、Checking Resource Limits for the Oracle Software Installation Users
- 4.11、Configuring Kernel Parameters for Linux
- 4.12、Setting the shell profile
- 4.13、Configuring Oracle Software Owner Environment
- 5、安装
- 6、安装后查看数据库状态
- 7、使用oracle数据库
- 8、SQL Developer 安装
0、受到oracle 19c 支持的linux发行版
写在前面:本文使用redhat 8.8 安装oracle 19c。
很遗憾,debian不能安装oracle 19c。
参考链接: 很遗憾,debian不能安装oracle 19c
受到oracle 19c 支持的linux发行版有centos 7/8,redhat 7/8,sels 12/15
参考链接:受到oracle 19c 支持的linux发行版
1、官方下载链接
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
安装包信息:
文件名:LINUX.X64_193000_db_home.zip
(3,059,705,302 bytes) (sha256sum - ba8329c757133da313ed3b6d7f86c5ac42cd9970a28bf2e6233f3235233aa8d8)
linux客户端
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
2、官方文档
https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/index.html
3、安装前基础环境准备
3.0、准备操作系统,本文使用redhat linux 8.8 安装数据库
参考链接: vmware安装redhat 8
3.1、安装过程的便利性-root script执行的自动化
从Oracle 19c 开始,安装过程中的root script执行可以实现自动化了。
Root Scripts Automation Support for Oracle Database Installation
建议使用自动化的方式执行root script,可以方便我们的安装,否则需要中断安装过程,人工执行root script。
3.2、oracle数据库安装前的check list
本章节3.2仅做记录,无配置操作,可跳过。
以下安装环境要求,确保安装成功。
Use checklists to review system requirements, and to plan and carry out Oracle Database installation.
Oracle recommends that you use checklists as part of your installation planning process. Using checklists can help you to confirm that your server hardware and configuration meet minimum requirements for this release, and can help you to ensure you carry out a successful installation.
3.2.1、服务器硬件检查
Check | Task |
---|---|
Server Make and Architecture | Confirm that server make, model, core architecture, and host bus adaptors (HBA) or network interface controllers (NICs) are supported to run with Oracle Database and Oracle Grid Infrastructure. |
Runlevel | 3 or 5 |
Server Display Cards | At least 1024 x 768 display resolution, which Oracle Universal Installer requires. |
Minimum network connectivity | Server is connected to a network |
Minimum RAM | “At least 1 GB RAM for Oracle Database installations. 2 GB RAM recommended. At least 8 GB RAM for Oracle Grid Infrastructure installations.” |
3.2.2、操作系统版本检查
Item | Task |
---|---|
Operating system general requirements | OpenSSH installed manually, if you do not have it installed already as part of a default Linux installation. A Linux kernel in the list of supported kernels and releases listed in this guide. |
Linux x86-64 operating system requirements | The following Linux x86-64 kernels are supported: <1>Oracle Linux 8.1 with the Unbreakable Enterprise Kernel 6: 5.4.17-2011.0.7.el8uek.x86_64 or later Oracle Linux 8 with the Red Hat Compatible kernel: 4.18.0-80.el8.x86_64 or later <2>Oracle Linux 7.4 with the Unbreakable Enterprise Kernel 4: 4.1.12-124.19.2.el7uek.x86_64 or later Oracle Linux 7.4 with the Unbreakable Enterprise Kernel 5: 4.14.35-1818.1.6.el7uek.x86_64 or later Oracle Linux 7.7 with the Unbreakable Enterprise Kernel 6: 5.4.17-2011.4.4.el7uek.x86_64 or later Oracle Linux 7.5 with the Red Hat Compatible Kernel: 3.10.0-862.11.6.el7.x86_64 or later <3>Red Hat Enterprise Linux 8: 4.18.0-80.el8.x86_64 or later Red Hat Enterprise Linux 7.5: 3.10.0-862.11.6.el7.x86_64 or later <3>SUSE Linux Enterprise Server 15: 4.12.14-23-default or later SUSE Linux Enterprise Server 12 SP3: 4.4.162-94.72-default or later Review the system requirements section for a list of minimum package requirements. |
IBM: Linux on System z operating system requirements | The following IBM: Linux on System z kernels are supported: Red Hat Enterprise Linux 8.3: 4.18.0-240.el8.s390x or later Red Hat Enterprise Linux 7.4: 3.10.0-693.el7.s390x or later SUSE Linux Enterprise Server 15: 5.3.18-57-default s390x or later SUSE Linux Enterprise Server 12: 4.4.73-5-default s390x or later Review the system requirements section for a list of minimum package requirements. |
Oracle Database Preinstallation RPM for Oracle Linux | If you use Oracle Linux, then Oracle recommends that you run the Oracle Database Preinstallation RPM for your Linux release to configure your operating system for Oracle Database and Oracle Grid Infrastructure installations. |
Oracle RPM Checker utility for IBM: Linux on System z | Oracle recommends that you use the Oracle RPM Checker utility to verify that you have the required Red Hat Enterprise Linux or SUSE packages installed on your IBM: Linux on System z operating system before you start the Oracle Database or Oracle Grid Infrastructure installation. |
Disable Transparent HugePages | Oracle recommends that you disable Transparent HugePages and use standard HugePages for enhanced performance. |
3.2.3、操作系统配置检查
Check | Task |
---|---|
Disk space allocated to the /tmp directory | At least 1 GB of space in the /tmp directory. |
Swap space allocation relative to RAM (Oracle Database) | Between 1 GB and 2 GB: 1.5 times the size of the RAM Between 2 GB and 16 GB: Equal to the size of the RAM More than 16 GB: 16 GB Note: If you enable HugePages for your Linux servers, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space. |
Swap space allocation relative to RAM (Oracle Restart) | Between 8 GB and 16 GB: Equal to the size of the RAM More than 16 GB: 16 GB Note: If you enable HugePages for your Linux servers, then you should deduct the memory allocated to HugePages from the available RAM before calculating swap space. |
Oracle Inventory (oraInventory) and OINSTALL Group Requirements | For upgrades, the installer detects an existing oraInventory directory from the /etc/oraInst.loc file, and uses the existing oraInventory. For new installs, if you have not configured an oraInventory directory, then you can specify the oraInventory directory during the software installation and Oracle Universal Installer will set up the software directories for you. The Oracle inventory is one directory level up from the Oracle base for the Oracle software installation and designates the installation owner’s primary group as the Oracle inventory group. Ensure that the oraInventory path that you specify is in compliance with the Oracle Optimal Flexible Architecture recommendations. The Oracle Inventory directory is the central inventory of Oracle software installed on your system. Users who have the Oracle Inventory group as their primary group are granted the OINSTALL privilege to write to the central inventory. The OINSTALL group must be the primary group of all Oracle software installation owners on the server. It should be writable by any Oracle installation owner. |
Groups and users | Oracle recommends that you create groups and user accounts required for your security plans before starting installation. Installation owners have resource limits settings and other requirements. Group and user names must use only ASCII characters. |
Mount point paths for the software binaries | Oracle recommends that you create an Optimal Flexible Architecture configuration as described in the appendix “Optimal Flexible Architecture” in Oracle Database Installation Guide for your platform. |
Ensure that the Oracle home (the Oracle home path you select for Oracle Database) uses only ASCII characters | The ASCII character restriction includes installation owner user names, which are used as a default for some home paths, as well as other directory names you may select for paths. |
Unset Oracle software environment variables | If you have an existing Oracle software installation, and you are using the same user to install this installation, then unset the following environment variables: $ORACLE_HOME,$ORA_NLS10, and $TNS_ADMIN. If you have set $ORA_CRS_HOME as an environment variable, then unset it before starting an installation or upgrade. Do not use $ORA_CRS_HOME as a user environment variable, except as directed by Oracle Support. |
Set locale (if needed) | Specify the language and the territory, or locale, in which you want to use Oracle components. A locale is a linguistic and cultural environment in which a system or program is running. NLS (National Language Support) parameters determine the locale-specific behavior on both servers and clients. The locale setting of a component determines the language of the user interface of the component, and the globalization behavior, such as date and number formatting. |
Check Shared Memory File System Mount | By default, your operating system includes an entry in /etc/fstab to mount /dev/shm. However, if your Cluster Verification Utility (CVU) or installer checks fail, ensure that the /dev/shm mount area is of type tmpfs and is mounted with the following options: rw and exec permissions set on it Without noexec or nosuid set on it Note:These options may not be listed as they are usually set as the default permissions by your operating system. |
Symlinks | Oracle home or Oracle base cannot be symlinks, nor can any of their parent directories, all the way to up to the root directory. |
3.2.4、Oracle用户环境配置
Check | Task |
---|---|
Review Oracle Inventory (oraInventory) and OINSTALL Group Requirements | The physical group you designate as the Oracle Inventory directory is the central inventory of Oracle software installed on your system. It should be the primary group for all Oracle software installation owners. Users who have the Oracle Inventory group as their primary group are granted the OINSTALL privilege to read and write to the central inventory. If you have an existing installation, then OUI detects the existing oraInventory directory from the/etc/oraInst.loc file, and uses this location. If you are installing Oracle software for the first time, then you can specify the Oracle inventory directory and the Oracle base directory during the Oracle software installation, and Oracle Universal Installer will set up the software directories for you. Ensure that the directory paths that you specify are in compliance with the Oracle Optimal Flexible Architecture recommendations. Ensure that the group designated as the OINSTALL group is available as the primary group for all planned Oracle software installation owners. |
Create operating system groups and users for standard or role-allocated system privileges | Create operating system groups and users depending on your security requirements, as described in this install guide. Set resource limits settings and other requirements for Oracle software installation owners. Group and user names must use only ASCII characters. |
Unset Oracle Software Environment Variables | If you have had an existing installation on your system, and you are using the same user account for this installation, then unset the ORACLE_HOME, ORACLE_BASE, ORACLE_SID, TNS_ADMIN environment variables and any other environment variable set for the Oracle installation user that is connected with Oracle software homes. |
Configure the Oracle Software Owner Environment | Configure the environment of the oracle or grid user by performing the following tasks: Set the default file mode creation mask (umask) to 022 in the shell startup file. Set the DISPLAY environment variable. |
3.2.5、磁盘空间容量检查
Check | Task |
---|---|
Minimum local disk storage space for Oracle software | For Linux x86-64: At least 6.5 GB for an Oracle Grid Infrastructure for a standalone server installation. At least 7.2 GB for Oracle Database Enterprise Edition. At least 7.2 GB for Oracle Database Standard Edition 2. For IBM: Linux on System z: At least 5.5 GB for an Oracle Grid Infrastructure for a standalone server installation. At least 5.9 GB for Oracle Database Enterprise Edition. At least 5.9 GB for Oracle Database Standard Edition 2. Note:Oracle recommends that you allocate approximately 100 GB to allow additional space for applying any future patches on top of the existing Oracle home. For specific patch-related disk space requirements, please refer to your patch documentation. |
Select Database File Storage Option | Ensure that you have one of the following storage options available: 1、File system mounted on the server. Oracle recommends that the file system you select is separate from the file system used by the operating system or the Oracle software. Options include the following: A file system on a logical volume manager (LVM) volume or a RAID device A network file system (NFS) mounted on a certified network-attached storage (NAS) device 2、Oracle Automatic Storage Management (Oracle ASM). 3、Oracle ASM is installed as part of an Oracle Grid Infrastructure installation. If you plan to use Oracle ASM for storage, then you should install Oracle Grid Infrastructure before you install and create the database. |
Determine your recovery plan | If you want to enable recovery during installation, then be prepared to select one of the following options: 1、File system: Configure a fast recovery area on a file system during installation 2、Oracle Automatic Storage Management: Configure a fast recovery area disk group using Oracle ASMCA. Review the storage configuration sections of this document for more information about configuring recovery. |
3.2.5、Oracle Universal Installer Planning Checklist for Oracle Database Installation
Check | Task |
---|---|
Read the Release Notes | Review release notes for your platform, which are available for your release at the following URL: http://docs.oracle.com/en/database/database.html |
Review Oracle Support Certification Matrix | New platforms and operating system software versions may be certified after this guide is published, review the certification matrix on the My Oracle Support website for the most up-to-date list of certified hardware platforms and operating system versions: https://support.oracle.com/ You must register online before using My Oracle Support. After logging in, from the menu options, select the Certifications tab. On the Certifications page, use the Certification Search options to search by Product, Release, and Platform. You can also search using the Certification Quick Link options such as Product Delivery, and Lifetime Support. |
Review the Licensing Information | "You are permitted to use only those components in the Oracle Database media pack for which you have purchased licenses. For more information about licenses, refer to the following URL: Oracle Database Licensing Information |
Run OUI with CVU and use fixup scripts | Oracle Universal Installer is fully integrated with Cluster Verification Utility (CVU), automating many CVU prerequisite checks. Oracle Universal Installer runs all prerequisite checks and creates fixup scripts when you run the installer. You can run OUI up to the Summary screen without starting the installation. You can also run CVU commands manually to check system readiness. For more information, see: Oracle Clusterware Administration and Deployment Guide |
Update and run Oracle ORAchk for runtime and upgrade checks, or runtime health checks | Oracle recommends that you update to the latest version of Oracle ORAchk. The Oracle ORAchk utility provides system checks that can help to prevent issues before and after installation. These checks include kernel requirements, operating system resource allocations, and other system requirements. Use the Oracle ORAchk Upgrade Readiness Assessment to obtain an automated upgrade-specific system health check for upgrades to 11.2.0.3, 11.2.0.4, 12.1.0.1, 12.1.0.2, 12.2, 18c, and 19c. For example: Before you perform a fresh database installation: ./orachk -profile preinstall To upgrade your existing database to a higher version or release: ./orachk -u -o pre The Oracle ORAchk Upgrade Readiness Assessment automates many of the manual pre- and post-upgrade checks described in Oracle upgrade documentation. Check My Oracle Support Note 1268927.1 for more information about Oracle ORAchk support. https://support.oracle.com/rs?type=doc&id=1268927.2 |
Verify if Oracle Grid Infrastructure is installed | If you want to use Oracle ASM or Oracle Restart, then install Oracle Grid Infrastructure for a standalone server before you install and create the database. Otherwise, to use Oracle ASM, you must complete an Oracle Grid Infrastructure installation, and then manually register the database with Oracle Restart. For Oracle Real Application Clusters (Oracle RAC) installations, ensure that you have installed and configured Oracle Grid Infrastructure for a cluster. |
Check running Oracle processes, and shut down if necessary | On a standalone database not using Oracle ASM: You do not need to shut down the database while you install Oracle Grid Infrastructure. On a standalone database using Oracle ASM: The Oracle ASM instances are restarted during installation. On an Oracle RAC Database node: This installation requires an upgrade of Oracle Clusterware, as Oracle Clusterware is required to run Oracle RAC. As part of the upgrade, you must shut down the database one node at a time as the rolling upgrade proceeds from node to node. |
Ensure cron jobs do not run during installation | If the installer is running when daily cron jobs start, then you may encounter unexplained installation problems if your cron job is performing cleanup, and temporary files are deleted before the installation is finished. Oracle recommends that you complete installation before daily cron jobs are run, or disable daily cron jobs that perform cleanup until after the installation is completed. |
Obtain your My Oracle Support account information. | During installation, you may require a My Oracle Support user name and password to configure updates, download software updates, and other installation tasks. You can register for My Oracle Support at the following URL: https://support.oracle.com/ |
Decide Oracle Database management tool | By default, Oracle Database is managed by Oracle Enterprise Manager Database Express. If you have an existing Oracle Management Agent, and decide to use Oracle Enterprise Manager Cloud Control to centrally manage your database, then obtain the following information to enter during the database installation: OMS host OMS port EM admin username EM admin password Specify password of ASMSNMP user For more information, see: 1、Oracle Database 2 Day DBA 2、Oracle Enterprise Manager Cloud Control Administrator’s Guide |
Review memory allocation and Automatic Memory Management feature | You can enable automatic memory management either during, or after Oracle Database installation. If you enable automatic memory management after installation, then you must shut down and restart the database. If the total physical memory of your database instance is greater than 4 GB, then you cannot select the Oracle Automatic Memory Management option during database installation and creation. Instead, use automatic shared memory management. Automatic shared memory management automatically distributes the available memory among the various components as required, allowing the system to maximize the use of all available SGA memory. For more information, see: Oracle Database Administrator’s Guide |
Determine superuser (root) privilege delegation option for installation | During a database or grid infrastructure installation, you are asked to run configuration scripts as the root user. You can either run these scripts manually as root when prompted, or you can provide configuration information and passwords using a root privilege delegation option. To run root scripts automatically, select Automatically run configuration scripts during installation. Use root user credentials Provide the superuser password for cluster member node servers. Use Sudo Sudo is a UNIX and Linux utility that allows members of the sudoers list privileges to run individual commands as root. Provide the username and password of an operating system user that is a member of sudoers, and is authorized to run Sudo on each cluster member node. To enable Sudo, have a system administrator with the appropriate privileges configure a user that is a member of the sudoers list, and provide the username and password when prompted during installation. |
Oracle Database Client and Oracle Database interoperability | For information about interoperability between Oracle Database Client and Oracle Database releases, see My Oracle Support Note 207303.1: https://support.oracle.com/rs?type=doc&id=207303.1 |
3.2.6、Deployment Checklist for Oracle Database
Check | Task |
---|---|
To deploy single-instance Oracle Database software | Use one of the following deployment methods: 1、Install Oracle Database software using Oracle Universal Installer (OUI). 2、Provision Oracle Database software using Oracle Fleet Patching and Provisioning. 3、Clone Oracle Database. |
To deploy single-instance Oracle Database software and create databases | Use one of the following deployment methods: 1、Install Oracle Database software using Oracle Universal Installer (OUI). 2、Provision Oracle Database software using Oracle Fleet Patching and Provisioning. 3、Clone Oracle Database. |
To create single-instance Oracle Database in an already-installed Oracle home | 1、Use Oracle Database Configuration Assistant (Oracle DBCA). 2、Use Oracle Fleet Patching and Provisioning |
4、安装前系统配置
4.0、修改主机名-重要
永久修改-重启也能生效
cp /etc/hostname /etc/hostname.bak
修改主机名为xxx,不要是默认的localhost.localdomain或localhost等
echo xxx > /etc/hostname
比如修改为rhel
echo rhel > /etc/hostname
4.1、硬件要求
4.1.1、/dev/shm 大小要求
配置要求:一般大于1G即可。
这个值默认是机器内存的一半,意思是分配给oracle使用的内存。
查看大小
df -lh /dev/shm/
/dev/shm > MEMORY_MAX_TARGET and MEMORY_TARGET parameters for each Oracle instance on the computer.
4.1.2、文件描述符大小要求
配置要求:每个进程需要至少512个。
后续篇幅会在/etc/security/limits.conf 中设置。
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.
每个进程需要至少512个。
4.1.3、内存大小
配置要求:内存>2G
查看内存大小
grep MemTotal /proc/meminfo
4.1.4、SWAP大小
配置要求:按照此规则分配SWAP大小
查看SWAP大小
grep SwapTotal /proc/meminfo
4.1.5、/tmp大小
配置要求:/tmp > 1G
查看/tmp大小
df -lh /tmp/
4.1.6、磁盘大小
配置要求:可用磁盘空间>10G
4.1.7、显示器分辨率大小
配置要求:显示器分辨率 > 1024 x 768
这是为了oracle安装程序的图形界面使用
4.2、软件要求
4.2.1、操作系统要求
Red Hat Enterprise Linux 8: 4.18.0-80.el8.x86_64 or later
Red Hat Enterprise Linux 7.5: 3.10.0-862.11.6.el7.x86_64 or later
本文以redhat 8.8 作为安装系统
查看redhat 各版本的内核版本
参考链接: redhat 各版本的内核版本
4.2.2、依赖包安装
安装以下包的最新发布版本
bc
xdpyinfo
binutils
elfutils-libelf
elfutils-libelf-devel
fontconfig-devel
glibc
glibc-devel
ksh
libaio
libaio-devel
libXrender
libX11
libXau
libXi
libXtst
libgcc
libnsl
librdmacm
libstdc++
libstdc++-devel
libxcb
libibverbs
make
policycoreutils
policycoreutils-python-utils
smartmontools
sysstat
yum -y install bc xdpyinfo binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat
4.3、Installation Fixup Scripts
如果安装过程出现错误,会用到这个功能去自动修复,但是修复完后还是需要手动去确认确实满足了。
参考:https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/about-installation-fixup-scripts.html#GUID-B427B3F7-BFE3-4ACF-89FD-A79A5774C7AA](https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/about-installation-fixup-scripts.html#GUID-B427B3F7-BFE3-4ACF-89FD-A79A5774C7AA)
Oracle Universal Installer detects when the minimum requirements for an installation are not met, and creates shell scripts, called fixup scripts, to finish incomplete system configuration steps.
If Oracle Universal Installer detects an incomplete task, then it generates fixup scripts (runfixup.sh). You can run the fixup script and click Fix and Check Again. The fixup script modifies both persistent parameter settings and parameters in memory, so you do not have to restart the system.
The Fixup script does the following tasks:
Sets kernel parameters, if necessary, to values required for successful installation, including:
Shared memory parameters.
Open file descriptor and UDP send/receive parameters.
Creates and sets permissions on the Oracle Inventory (central inventory) directory.
Creates or reconfigures primary and secondary group memberships for the installation owner, if necessary, for the Oracle Inventory directory and the operating system privileges groups.
Sets shell limits, if necessary, to required values.
Note:Using fixup scripts does not ensure that all the
prerequisites for installing Oracle Database are met. You must
still verify that all the preinstallation requirements are met
to ensure a successful installation.
Oracle Universal Installer is fully integrated with Cluster
Verification Utility (CVU) automating many prerequisite checks
for your Oracle Grid Infrastructure or Oracle Real Application
Clusters (Oracle RAC) installation. You can also manually
perform various CVU verifications by running the cluvfy
command.
4.4、端口范围-Verifying UDP and TCP Kernel Parameters
编辑/etc/sysctl.conf
vi /etc/sysctl.conf
修改这行为: net.ipv4.ip_local_port_range = 9000 65500
如没有这行就添加一行
net.ipv4.ip_local_port_range = 9000 65500
使得修改生效
sysctl -p /etc/sysctl.conf
端口最小值大于9000 是为了防止熟知端口被使用到
最大值尽量大
检查当前端口范围
cat /proc/sys/net/ipv4/ip_local_port_range
参考:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1149
4.5、Installing the cvuqdisk Package for Linux
cluster安装才会使用到,单数据库安装忽略。
这个包在 Oracle Grid Infrastructure安装后的目录oracle_home1/cv/rpm中。
参考:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1151
4.6、配置/etc/hosts文件
确保/etc/hosts 文件中含有这一行
192.168.2.131 rhel
其中 192.168.2.131 是安装数据库机器的IP rhel 是主机名
使用如下命令查看是否含有
grep 192.168.2.131 /etc/hosts
没有的话就编辑/etc/hosts文件加入这一行
192.168.2.131 rhel
这是为了主机名可以解析到地址
参考链接: Confirming Host Name Resolution
4.7、禁用 Transparent HugePages
To check if Transparent HugePages are enabled run one of the following commands as the root user:
cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
redhat 8.8 输出是空 表示没有启用
输出如下表示启用了
[always] never
禁用方法
1、For Oracle Linux 7 and later, and Red Hat Enterprise Linux 7 and later, add or modify the transparent_hugepage=never parameter in the /etc/default/grub file:
transparent_hugepage=never
For example:
GRUB_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"
2、Run the grub2–mkconfig command to regenerate the grub.cfg file.
grub2-mkconfig -o /boot/grub2/grub.cfg
3、Restart the system to make the changes permanent.
4.8、创建用户和组
groupadd --system oinstall
groupadd --system dba
adduser -m --system -g oinstall -G dba --shell /bin/bash oracle
4.9、创建安装目录
mkdir -p /opt/oracle/product/19.3.0/dbhome_1
mkdir -p /opt/oraInventory
chown -R oracle:dba /opt/oracle/
chown -R oracle:dba /opt/oraInventory
chmod -R 755 /opt/oracle/
chmod -R 755 /opt/oraInventory/
4.10、Checking Resource Limits for the Oracle Software Installation Users
指的是oracle用户
cp /etc/security/limits.conf /etc/security/limits.conf.bak
vi /etc/security/limits.conf
添加以下内容
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock unlimited
oracle hard memlock unlimited
重启系统让配置生效
4.11、Configuring Kernel Parameters for Linux
cp /etc/sysctl.conf /etc/sysctl.conf.bak
vi /etc/sysctl.conf
插入如下内容
# ============================
# Oracle 19c
# ============================
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmni = 4096
# Replace kernel.shmmax with the half of your memory size in bytes
# if lower than 4 GB minus 1
# 6442450944 is 6 GigaBytes (12 GB of RAM / 2)
kernel.shmmax=6442450944
#
# Max number of network connections. Use sysctl -a | grep ip_local_port_range to check.
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
#
# The maximum allowed value, set to avoid overhead and input/output errors
fs.aio-max-nr = 1048576
# 512 * Processes
fs.file-max = 6815744
fs.suid_dumpable = 1
使配置生效
sysctl -p /etc/sysctl.conf
4.12、Setting the shell profile
编辑 /etc/profile
cp /etc/profile /etc/profile.bak
vi /etc/profile
添加以下
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
使生效
source /etc/profile
4.13、Configuring Oracle Software Owner Environment
指的是oracle用户
su - oracle
cp ~/.bashrc ~/.bashrc.bak
vi ~/.bashrc
插入以下内容
# Oracle 19c Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
# Enter your hostname
ORACLE_HOSTNAME=rhel; export ORACLE_HOSTNAME
ORACLE_UNQNAME=ORADB19C; export ORACLE_UNQNAME
ORACLE_BASE=/opt/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
umask 022
使生效
source ~/.bashrc
注意!!!
ORACLE_HOSTNAME变量一定需要设置成系统的主机名,否则安装会报错: [INS-20802] Oracle Net Configuration Assistant failed. 出现这个错误的根本原因是ORACLE_HOSTNAME变量和真实的主机名不同。
主机名查看命令
cat /etc/hostname
5、安装
5.1、执行安装程序
5.1.1、解压安装包
假设安装包位置 是/tmp/LINUX.X64_193000_db_home.zip
cd /opt/oracle/product/19.3.0/dbhome_1
unzip /tmp/LINUX.X64_193000_db_home.zip
chown -R oracle:dba /opt/oracle/
5.1.2、执行安装程序
直接使用oracle用户进行ssh登录
cd /opt/oracle/product/19.3.0/dbhome_1
执行安装程序
./runInstaller
终端输出如下,然后弹窗出oracle的图形化界面安装向导
选 No 退出安装程序
编辑~/.bashrc 文件
vi ~/.bashrc
添加1行
CV_ASSUME_DISTID=RHEL8; export CV_ASSUME_DISTID
使更改生效
source ~/.bashrc
再次执行安装程序
./runInstaller
开启 Enable Automativ Memory Management 后 要求不能大于4G ,因此选择关闭,然后可以分配服务器任意数量的内存。此例分配70%
本例中没有 企业管理器云控制(Enterprise Manager Cloud Control),因此不勾选
如果企业安装了企业管理器云控制(Enterprise Manager Cloud Control),选择【Register with Enterprise Manager (EM) Cloud Control】并提供EM配置信息。如果企业中没有安装企业管理器云控制,单击【Next】:
自动化执行Root Script 指定root账户密码
先决条件检查
使用root 账户安装以上的包
安装gcc-c++
yum -y install gcc-c++
安装compat-libstdc+±33-3.2.3
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
yum localinstall -y compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
确认compat-libstdc+±33已安装成功
rpm -qa | grep compat-libstdc++-33
安装compat-libcap1-1.10
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm
yum localinstall -y compat-libcap1-1.10-7.el7.x86_64.rpm
确认compat-libcap1-1.10 已安装成功
rpm -qa | grep compat-libcap1-1.10
至此确实的包已安装完成
在安装界面 点击 Check Again 直接到Summary 这一步,然后点击 Install 开始安装oracle 19c 数据库
点击Yes 同意使用之前预设置的root账户密码去执行Root Scripts
创建并启动实例
这个过程较耗时 且极其占用系统内存
正在完成数据库实例创建
至此oracle 19c 安装完成
Oracle Enterprise Manager Database Express URL: https:rhel:5500/em
点击Close 退出安装程序
查看安装日志文件
安装日志文件如下 可以了解整个安装过程
6、安装后查看数据库状态
6.1、查看监听
su - oracle
cd /opt/oracle/product/19.3.0/dbhome_1/bin/
查看监听状态
./lsnrctl status
6.2、查看数据库进程
6.2.1、 查看监听
ss -anlp|grep 1521
6.2.2、查看数据库进程
ps -elf|grep ora
至此Oracle 19c 安装完成。
6.2.3、查看Oracle Enterprise Manager Database Express 进程
访问管理界面
https:rhel:5500/em
输入用户名密码 容器名
用户名sys 密码是安装过程中设置的密码 容器名为空 登录进去
6.3、查看数据库信息
6.3.0、登录数据库
cd /opt/oracle/product/19.3.0/dbhome_1/bin
./sqlplus /nolog
conn /as sysdba
6.3.1、查看实例名
show parameter db_name;
6.3.2、查看数据库名
show parameter db_name;
6.3.3、查看数据库服务名
show parameter service;
7、使用oracle数据库
7.1、重启系统后查看数据库状态
7.1.1、数据库进程不在
su - oracle
ps -elf|grep ora
7.1.2、数据库监听不在
su - oracle
lsnrctl status
数据库端口1521不在
ss -anlp|grep 1521
7.1.3、Oracle Enterprise Manager Database Express 进程不在
ss -anlp|grep 5500
7.2、手动启动/停止数据库、开启/停止监听
7.2.1、启动数据库
su - oracle
sqlplus / as sysdba
startup
退出sql
启动前查看数据库进程
ps -elf|grep ora
启动后查看数据库进程
ps -elf|grep ora
启动数据库后但没有启动监听程序 查看数据库端口1521是不在的
7.2.2、查看监听状态
su - oracle
lsnrctl status
7.2.3、 开启监听
su - oracle
lsnrctl start
7.2.4、开启监听后再次查看监听状态
su - oracle
lsnrctl status
7.2.5、停止监听
su - oracle
lsnrctl stop
7.2.6、停止监听后再次查看监听状态
su - oracle
lsnrctl status
7.3、查看数据库信息
7.3.0、登录数据库
cd /opt/oracle/product/19.3.0/dbhome_1/bin
./sqlplus /nolog
conn /as sysdba
7.3.1、查看实例名
show parameter db_name;
7.3.2、查看数据库名
show parameter db_name;
7.3.3、查看数据库服务名
show parameter service;
7.4、手动开启/停止 Oracle Enterprise Manager Database Control
7.4.1、查看Oracle Enterprise Manager Database Control状态
su - oracle
emctl status dbconsole
查看Enterprise Manager端口 1158 不在监听
7.4.2、 手动开启Oracle Enterprise Manager Database Express
su - oracle
端口5500不在
cd $ORACLE_HOME/bin
./sqlplus /nolog
conn /as sysdba
查看Oracle Enterprise Manager Database Express 的端口是5500
SELECT dbms_xdb_config.gethttpsport FROM dual;
访问web操作台管理界面
https:rhel:5500/em
输入用户名密码 容器名
用户名sys 密码是安装过程中设置的密码 容器名为空 登录进去
7.4.3、 手动停止Oracle Enterprise Manager Database Express
su - oracle
cd $ORACLE_HOME/bin
7.5、oracle数据库组件使用的端口和协议
7.6、配置oracle数据库自启动
以下命令使用root用户执行
7.6.1、编辑/etc/oratab文件
vi /etc/oratab
把需要启动的数据库第三项改为Y,Y表示自启动,N表示不自启动,默认为N。
更改前
更改后
7.6.2、新建自启动脚本
vi /etc/init.d/dbora
#! /bin/bash
# dbora Oracle auto start-stop script.
# chkconfig: 035 10 90
# description: Automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down.
# Automating database startup and shutdown guards against incorrect database shutdown.
# And so is the Oracle Database Enterprise Manager.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
ORA_HOME=/opt/oracle/product/11.2.0.4/dbhome_1
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
echo "Starting Oracle Databases ... " >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" 2>&1 >>/var/log/oracle &
echo "Starting Oracle Databases done ..." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
# Start the Oracle Database Enterprise Manager:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
echo "Starting Oracle Databases Enterprise Manager ... " >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle Databases Enterprise Manager as part of system up." >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl start dbconsole" 2>&1 >>/var/log/oracle &
echo "Starting Oracle Databases Enterprise Manager done ..." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle Database Enterprise Manager:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
echo "Stoping Oracle Databases Enterprise Manager ... " >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Stoping Oracle Databases Enterprise Manager as part of system up." >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/emctl stop dbconsole" 2>&1 >>/var/log/oracle &
echo "Stoping Oracle Databases Enterprise Manager done ..." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
rm -f /var/lock/subsys/dbora
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
echo "Stoping Oracle Databases ... " >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Stoping Oracle Databases as part of system up." >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" 2>&1 >>/var/log/oracle &
echo "Stoping Oracle Databases done ..." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
;;
'restart')
$0 stop
$0 start
;;
'*')
echo "Please use start or stop or restart as first argument"
;;
esac
7.6.3、设置启动文件的用户组和权限
Change the group of the dbora file to the OSDBA group (typically dba), and set the permissions to 750
chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
7.6.4、添加到开机自启动
chkconfig --level 035 dbora on
查看开机启动项配置
chkconfig --list
参考链接: Automating Shutdown and Startup
8、SQL Developer 安装
8.1、下载 SQL Developer
SQL Developer 23.1 With JDK11
下载链接:https://www.oracle.com/database/sqldeveloper/technologies/download/
文件名:sqldeveloper-23.1.0.097.1607-x64.zip
MD5: 5b0fe5b6a5f53451204b26491da412f7
SHA1: 884f86c70130c109bb0cefd294eb8061ae1fd0ff
安装手册
Windows Installation Notes
Windows 64-bit with JDK 11 Included
This archive includes both SQL Developer and an embedded copy of the Java 11 Development Kit
(JDK). Simply extract the zip to a fresh directory and run the sqldeveloper.exe in the top
directory. The EXE is configured to run the embedded JDK by default.
Note: the Windows EXE requires a MSVCR100.dll to run. Most computers will already have this file
and in the Windows PATH. However, if the first copy of the file found by the EXE is a 32-bit copy
of the DLL, then SQL Developer will fail to start. You can fix this by copying a 64-bit version
of the DLL into the BIN directory or updating your OS PATH such that a 64 bit copy of the DLL is
found first.
SQL Developer 20.2 With JDK8
下载链接:链接: https://www.oracle.com/tools/downloads/sqldev-downloads-202.html#sqldev-install-windows
文件名:sqldeveloper-20.2.0.175.1842-x64.zip
MD5: c445a894c09f3b2c039e0fb64b4d41e9
SHA1: c1ea4ce7c25e6718fa9ee50df970c7d2eacd6bd8
安装手册
Windows Installation Notes
Windows 64-bit with JDK 8 Included
This archive includes both SQL Developer and an embedded copy of the Java 8 Development Kit
(JDK). Simply extract the zip to a fresh directory and run the sqldeveloper.exe in the top
directory. The EXE is configured to run the embedded JDK by default.
Note: the Windows EXE requires a MSVCR100.dll to run. Most computers will already have this file
and in the Windows PATH. However, if the first copy of the file found by the EXE is a 32-bit copy
of the DLL, then SQL Developer will fail to start. You can fix this by copying a 64-bit version
of the DLL into the BIN directory or updating your OS PATH such that a 64 bit copy of the DLL is found first.
8.2、启动 SQL Developer
安装SQL Developer 20.2 With JDK8
解压安装包,进入安装包目录,运行 sqldeveloper.exe
8.3、新建数据库连接
参考文档: https://qurosity.com/create-new-user-connection-in-sql-developer/
新建连接到Oracle数据库 点击文件->新建连接
选择连接->数据库连接
点击连接 输入密码
执行sql查询
show parameter db_name;
show parameter service;
点左上角的绿色运行图标,光标定位在哪行,就会执行这行的SQL语句,并在下方脚本输出框输出执行结果。
光标选中一个范围的SQL语句 就会执行所有选中范围的SQL语句,并在下方脚本输出框输出执行结果。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)