设置主机名
[root@localhost ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.0.0.11 study1.localdomain study1 [root@localhost ~]# cat /etc/hostname study1.localdomain
安装环境准备工具
其实直接rpm安装即可,它会自动解决依赖问题包括环境准备工具,但是这样oracle用户没有home目录,所以单独先安装环境准备工具
[root@study1 /]# yum -y install oracle-database-preinstall-19c loaded plugins: langpacks, ulninfo ol7_uekr5 | 2.5 kb 00:00:00 ol7_latest | 2.7 kb 00:00:00 (1/4): ol7_uekr5/x86_64/updateinfo | 49 kb 00:00:01 (2/4): ol7_latest/x86_64/updateinfo | 1.1 mb 00:00:05 (3/4): ol7_uekr5/x86_64/primary_db | 5.7 mb 00:00:27 (4/4): ol7_latest/x86_64/primary_db | 19 mb 00:01:21 resolving dependencies (many more lines supressed) installed: oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 dependency installed: compat-libcap1.x86_64 0:1.10-7.el7 compat-libstdc++-33.x86_64 0:3.2.3-72.el7 glibc-devel.x86_64 0:2.17-292.0.1.el7 glibc-headers.x86_64 0:2.17-292.0.1.el7 kernel-headers.x86_64 0:3.10.0-1062.el7 ksh.x86_64 0:20120801-139.0.1.el7 libaio-devel.x86_64 0:0.3.109-13.el7 libstdc++-devel.x86_64 0:4.8.5-39.0.1.el7 dependency updated: glibc.x86_64 0:2.17-292.0.1.el7 glibc-common.x86_64 0:2.17-292.0.1.el7 libstdc++.x86_64 0:4.8.5-39.0.1.el7 complete! [root@study1 /]#
如果是rhel或者centos,就要手工先下载preinstall的rmp包,然后本地安装(或者添加oracle linux的yum源来yum安装)
[root@study1 /]# curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/oraclelinux/ol7/latest/x86_64/getpackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm % total % received % xferd average speed time time time current dload upload total spent left speed 100 18204 100 18204 0 0 18037 0 0:00:01 0:00:01 --:--:-- 18059 [root@study1 /]# yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
安装oracle软件
[root@study1 db]# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm loaded plugins: langpacks, ulninfo 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 downloading packages: running transaction check running transaction test transaction test succeeded running 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@study1 db]#
oracle_home目录是/opt/oracle/product/19c/dbhome_1
创建数据库
[root@study1 dbhome_1]# /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. [root@study1 dbhome_1]#
这默认创建了名为orclcdb且pdb名orclpdb1的数据库,当然可以不用这么创建,用传统的dbca方式
优缺点
实际上这个方式并没有什么用,比起来静默安装也并没有显得更容易,只能安装数据库软件,并不能升级数据库,而且不能用于rac,只能用于安装单实例数据库,整个部署没有给予定制空间比如oracle_home目录如果和你公司的磁盘规划不一致呢,不过新手可能认为这样更简单,这个方式仅试试而已体会一下,实际生产中几乎是不能用的