一、安装全过程
yum安装很简单,但是需要先把包下载好需要先把包下载好
系统的2核4G配置尽量高,磁盘容量>60G
官网找:
oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
[root@localhost ~]# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
[root@localhost ~]# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
[root@localhost ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
RPM安装默认的数据文件路径是/opt/oracle/oradata
配置成功之后,切换orecle用户(已经自动创建)
先用root用户配置一下oracle用户的环境变量
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
切换为oracle用户,进入oracle数据库
[oracle@localhost ~]$ su - oracle
[oracle@localhost ~]$ sqlplus / as sysdba
二、Oracle19cyum安装分步
Oracle 19c,或者说是Oracle 12.2.0.3,是12c中稳定的版本,就像Oracle 11.2.0.4,是值得让客户做出升级决策,从Oracle支持的版本序列图中,就可以看出Oracle 19c所处的地位,Oracle 19c将稳定性作为此版本的核心目标,开发人员专注于修复已知问题,而不是添加新功能,这可能是让19c更加可靠以及让客户决定升级的关键因素
19c相关技术文档,
https://docs.oracle.com/en/database/oracle/oracle-database/19/index.html
19c的安装,相比11g,除了支持图形、命令行、静默安装外,最大的改进,就是支持RPM安装
19c的RPM包下载链接
https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
使用手工方式,通过RPM安装19c数据库,只需要两步操作,
步骤1:安装oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
步骤2:安装oracle-database-ee-19c-1.0-1.x86_64.rpm
[root@localhost software]# yum install oracle-database-ee-19c-1.0-1.x86_64.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Examining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution
Dependencies 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 G
Transaction Summary
================================================================================
Install 1 Package
Total size: 6.9 G
Installed size: 6.9 G
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
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
完成了软件安装,下一步就是创建数据库,指令是
/etc/init.d/oracledb_ORCLCDB-19c configure
要求使用root执行
[root@localhost ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database ORCLCDB.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.
从路径中,可以看到,相关的控制文件、日志文件、数据文件
[oracle@localhost ORCLCDB]$ pwd
/opt/oracle/oradata/ORCLCDB
[oracle@localhost ORCLCDB]$ ls
control01.ctl ORCLPDB1 redo01.log redo03.log system01.dbf undotbs01.dbf
control02.ctl pdbseed redo02.log sysaux01.dbf temp01.dbf users01.dbf
和11g相同,oracle用户的profile,需要做些配置,增加环境变量
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin
正常访问
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Sep 8 08:55:56 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
从安装步骤看,RPM确实简单,除了需要关注安装路径和数据库文件的磁盘空间,以及保证依赖包具备,需要做的,就是一个RPM指令,降低了以往Linux下的安装复杂性,和19c倡导Autonomous自治不谋而和,真正实现了一键安装
三、oracle数据库的使用
1、登录数据库
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 03:04:22 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
???:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB1 READ WRITE NO
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
2、修改密码
alter user system identified by 123456;
3、使用官方连接工具sqldeveloper连接