广州葆元健康生物科技有限公司


CENTOS Linux 下 ORACLE 19C RPM 安装详细步骤

网络编程 CENTOS Linux 下 ORACLE 19C RPM 安装详细步骤 09-20

1 基础环境准备

CentOS Linux release 7.8.2003 (Core)

oracle-database-ee-19c-1.0-1.x86_64.rpm

oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

2关闭防火墙

   sellinux 设置为 SELINUX=disabled

[root@localhost ~]# systemctl stop firewalld[root@localhost ~]# systemctl disable firewalldRemoved symlink etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@localhost ~]#[root@localhost ~]# setenforce 0[root@localhost ~]# 

3更改主机名,配置host文件

[root@localhost ~]# hostnamectl set-hostname oracle[root@localhost ~]# bashbash[root@oracle ~]# [root@oracle ~]# more etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.5.133 oracle[root@oracle ~]#

4配置yum源,DNS

[root@oracle ~]# cd etc/yum.repos.d/[root@oracle yum.repos.d]# lsCentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repoCentOS-CR.repo         CentOS-Media.repo      CentOS-x86_64-kernel.repoCentOS-Debuginfo.repo  CentOS-Sources.repo[root@oracle yum.repos.d]# rm -rf *[root@oracle yum.repos.d]# [root@oracle yum.repos.d]# wget  http://mirrors.aliyun.com/repo/Centos-7.repo--2021-02-27 11:50:39--  http://mirrors.aliyun.com/repo/Centos-7.repoResolving mirrors.aliyun.com (mirrors.aliyun.com)... 58.221.54.116, 58.221.54.115, 61.155.221.135, ...Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|58.221.54.116|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 2523 (2.5K) [application/octet-stream]Saving to: ‘Centos-7.repo’Centos-7.repo     100%[===================>]   2.46K  --.-KB/s    in 0s      2021-02-27 11:50:39 (14.5 MB/s) - ‘Centos-7.repo’ saved [2523/2523][root@oracle ~]# more etc/resolv.conf# Generated by NetworkManagersearch localdomainnameserver 192.168.5.2nameserver 1.2.4.8[root@oracle ~]# 

4 oralce preinstall

  [root@oracle ~]# yum -y install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpmLoaded plugins: fastestmirrorExamining oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: oracle-database-preinstall-19c-1.0-1.el7.x86_64Marking oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm to be installedResolving Dependencies--> Running transaction check---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed--> Processing Dependency: bc for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com--> Processing Dependency: bind-utils for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64--> Processing Dependency: compat-libcap1 for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64--> Processing Dependency: compat-libstdc++-33 for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64--> Processing Dependency: glibc-devel for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64--> Processing Dependency: ksh for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64--> Processing Dependency: libaio for package: oracle-database-preinstall-19c-1.0-1.el7.x86_64......  libverto-libevent.x86_64 0:0.2.5-4.el7                        libxcb.x86_64 0:1.13-1.el7                           lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7       mailx.x86_64 0:12.5-19.el7                           net-tools.x86_64 0:2.0-0.25.20131004git.el7                   nfs-utils.x86_64 1:1.3.0-0.68.el7                    psmisc.x86_64 0:22.20-17.el7                                  quota.x86_64 1:4.01-19.el7                           quota-nls.noarch 1:4.01-19.el7                                rpcbind.x86_64 0:0.2.0-49.el7                        smartmontools.x86_64 1:7.0-2.el7                              sysstat.x86_64 0:10.1.5-19.el7                       tcp_wrappers.x86_64 0:7.6-77.el7                              unzip.x86_64 0:6.0-21.el7                            xorg-x11-utils.x86_64 0:7.5-23.el7                            xorg-x11-xauth.x86_64 1:1.0.9-1.el7                Dependency Updated:  glibc.x86_64 0:2.17-323.el7_9      glibc-common.x86_64 0:2.17-323.el7_9      libstdc++.x86_64 0:4.8.5-44.el7     Complete![root@oracle ~]#

5 安装数据库软件

[root@oracle ~]# yum -y install oracle-database-ee-19c-1.0-1.x86_64.rpmLoaded plugins: fastestmirrorExamining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installedResolving Dependencies--> Running transaction check---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed--> Finished Dependency ResolutionDependencies Resolved==================================================================================================================== Package                         Arch            Version        Repository                                     Size====================================================================================================================Installing: oracle-database-ee-19c          x86_64          1.0-1          oracle-database-ee-19c-1.0-1.x86_64          6.9 GTransaction Summary====================================================================================================================Install  1 PackageTotal size: 6.9 GInstalled size: 6.9 GDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : oracle-database-ee-19c-1.0-1.x86_64                                                              1/1 [INFO] Executing post installation scripts...[INFO] Oracle home installed successfully and ready to be configured.To configure a sample Oracle Database you can execute the following service configuration script as root: etc/init.d/oracledb_ORCLCDB-19c configure  Verifying  : oracle-database-ee-19c-1.0-1.x86_64                                                              1/1 Installed:  oracle-database-ee-19c.x86_64 0:1.0-1      Complete![root@oracle ~]#                                                                         

6安装数据库

oracle19c的修改配置文件为:

/etc/init.d/oracledb_ORCLCDB-19c,可自行修改

[root@oracle ~]# /etc/init.d/oracledb_ORCLCDB-19c configureConfiguring Oralce Database ORCLCDBPrepare for db operation8% completeCopying database files31% completeCreating and staring Oracle instance32% complete36% complete...

7切换oracle用户,.bash_profile添加环境变量

# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then        . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHexport ORACLE_BASE=/opt/oracleexport ORACLE_HOME=/opt/oracle/product/19c/dbhome_1export ORACLE_SID=ORCLCDBexport PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin

8 创建用户,表空间

[oracle@localhost ~]$ sqlplus  as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sat Feb 27 22:28:59 2021Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle.  All rights reserved.Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0SQL> select name ,con_id from v$services;NAME                     CON_ID---------------------------------------------------------------- ----------ORCLCDBXDB                  1SYS$BACKGROUND                  1SYS$USERS                  1ORCLCDB                   1orclpdb1                  3Elapsed: 00:00:00.01SQL> alter session set container=orclpdb1;Session altered.SQL>SQL> startup;Pluggable Database opened.SQL> create tablespace carl datafile '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/carl.dbf' size 100m autoextend on next 100m;Tablespace created.Elapsed: 00:00:01.43SQL> create user carl identified by oracle default tablespace carl;User created.Elapsed: 00:00:00.46SQL> grant connect,resource,dba to carl;                         Grant succeeded.Elapsed: 00:00:00.02SQL> 

9 19c连接数据库分为两种方式

 一种为 alter session set container=orclpdb1;

[oracle@localhost ~]$ sqlplus  as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Sat Feb 27 22:42:07 2021Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle.  All rights reserved.Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0SQL> show pdbs;    CON_ID CON_NAME        OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------   2 PDB$SEED        READ ONLY  NO   3 ORCLPDB1        READ WRITE NOSQL> alter session set container=ORCLPDB1;Session altered.Elapsed: 00:00:00.00SQL> show pdbs;    CON_ID CON_NAME        OPEN MODE  RESTRICTED---------- ------------------------------ ---------- ----------   3 ORCLPDB1        READ WRITE NOSQL> 

另一种更改 $ORACLE_HOME/network/admin/tnsnames.ora

[oracle@localhost ~]$ sqlplus carl/oracle@orclpdb1SQL*Plus: Release 19.0.0.0.0 - Production on Sat Feb 27 22:47:18 2021Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle.  All rights reserved.Last Successful login time: Sat Feb 27 2021 22:45:03 +08:00Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0SQL>    


编辑:广州葆元健康生物科技有限公司

标签:数据库,用户,两种,设置为,配置文件