一、 RPM安裝
准备的rpm包
oracle-database-preinstall-19c-1.0-1.el8.x86_64.rpm
oracle-database-ee-19c-1.0-1.x86_64.rpm
安裝preinstall
yum localinstall oracle-database-preinstall-19c-1.0-1.el8.x86_64.rpm
會自動安裝很多依賴包
Installed:
bc-1.07.1-5.el8.x86_64 bind-libs-32:9.11.13-3.el8.x86_64 bind-libs-lite-32:9.11.13-3.el8.x86_64
bind-license-32:9.11.13-3.el8.noarch bind-utils-32:9.11.13-3.el8.x86_64 binutils-2.30-73.el8.x86_64
glibc-devel-2.28-101.el8.x86_64 glibc-headers-2.28-101.el8.x86_64 gssproxy-0.8.0-15.el8.x86_64
kernel-headers-4.18.0-193.el8.x86_64 keyutils-1.5.10-6.el8.x86_64 ksh-20120801-254.el8.x86_64
libICE-1.0.9-15.el8.x86_64 libSM-1.2.3-1.el8.x86_64 libX11-1.6.8-3.el8.x86_64
libX11-common-1.6.8-3.el8.noarch libX11-xcb-1.6.8-3.el8.x86_64 libXau-1.0.8-13.el8.x86_64
libXcomposite-0.4.4-14.el8.x86_64 libXext-1.3.3-9.el8.x86_64 libXi-1.7.9-7.el8.x86_64
libXinerama-1.1.4-1.el8.x86_64 libXmu-1.1.2-12.el8.x86_64 libXrandr-1.5.1-7.el8.x86_64
libXrender-0.9.10-7.el8.x86_64 libXt-1.1.5-12.el8.x86_64 libXtst-1.2.3-7.el8.x86_64
libXv-1.0.11-7.el8.x86_64 libXxf86dga-1.1.4-12.el8.x86_64 libXxf86misc-1.0.4-1.el8.x86_64
libXxf86vm-1.1.4-9.el8.x86_64 libaio-devel-0.3.112-1.el8.x86_64 libdmx-1.1.4-3.el8.x86_64
libnsl-2.28-101.el8.x86_64 libpkgconf-1.4.2-1.el8.x86_64 libstdc++-devel-8.3.1-5.el8.0.2.x86_64
libverto-libevent-0.3.0-5.el8.x86_64 libxcb-1.13.1-1.el8.x86_64 libxcrypt-devel-4.1.1-4.el8.x86_64
lm_sensors-libs-3.4.0-21.20180522git70f7e08.el8.x86_64 make-1:4.2.1-10.el8.x86_64 net-tools-2.0-0.51.20160912git.el8.x86_64
nfs-utils-1:2.3.3-31.el8.x86_64 oracle-database-preinstall-19c-1.0-1.el8.x86_64 pkgconf-1.4.2-1.el8.x86_64
pkgconf-m4-1.4.2-1.el8.noarch pkgconf-pkg-config-1.4.2-1.el8.x86_64 psmisc-23.1-4.el8.x86_64
python3-bind-32:9.11.13-3.el8.noarch quota-1:4.04-10.el8.x86_64 quota-nls-1:4.04-10.el8.noarch
rpcbind-1.2.5-7.el8.x86_64 smartmontools-1:6.6-3.el8.x86_64 sysstat-11.7.3-2.el8.x86_64
tar-2:1.30-4.el8.x86_64 unzip-6.0-43.el8.x86_64 xorg-x11-utils-7.5-28.el8.x86_64
xorg-x11-xauth-1:1.0.9-12.el8.x86_64
Complete!
#yum localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm
Installed:
oracle-database-ee-19c-1.0-1.x86_64
Complete!
初始化数据库:
[root@Centos8 ~]# cp /etc/init.d/oracledb_ORCLCDB-19c /etc/init.d/oracledb_testdb
[root@Centos8 ~]# chmod 755 /etc/init.d/oracledb_testdb
**修改如下內容:**
# Setting the required environment variables
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_VERSION=19c
export ORACLE_SID=testdb
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=pdb1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true
# General exports and vars
export PATH=$ORACLE_HOME/bin:$PATH
LSNR=$ORACLE_HOME/bin/lsnrctl
SQLPLUS=$ORACLE_HOME/bin/sqlplus
DBCA=$ORACLE_HOME/bin/dbca
NETCA=$ORACLE_HOME/bin/netca
ORACLE_OWNER=oracle
RETVAL=0
CONFIG_NAME="oracledb_$ORACLE_SID.conf"
CONFIGURATION="/etc/sysconfig/$CONFIG_NAME"
[root@Centos8 ~]# chmod 555 /etc/init.d/oracledb_testdb
由于定制了service name,重新复制一个配置文件
[root@Centos8 ~]# scp /etc/sysconfig/oracledb_ORCLCDB-19c.conf /etc/sysconfig/oracledb_testdb.conf
执行初始化脚本
/etc/init.d/oracledb_testdb configure
Configuring Oracle Database testdb.
Prepare for db operation
8% complete
Copying database files
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
[WARNING] ORA-04031: unable to allocate 1048848 bytes of shared memory ("shared pool","unknown object","PDB Dynamic He","alls-ktimcem")
40% complete
43% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/testdb.
Database Information:
Global Database Name:testdb
System Identifier(SID):testdb
Look at the log file "/opt/oracle/cfgtoollogs/dbca/testdb/testdb.log" for further details.
Database configuration failed.
内存配置过小,初始化失败
卸載
[root@Centos8 ~]# /etc/init.d/oracledb_testdb delete
Detecting existing Listeners...
No Listener configuration file found. Proceeding with Database removal
Detecting existing Oracle Databases...
Deleting Oracle Database testdb.
WARNING] [DBT-11503] The instance (testdb) is not running on the local node. This may result in partial delete of Oracle database.
CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
testdb
[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
35% complete
39% complete
42% complete
45% complete
48% complete
52% complete
65% complete
Updating network configuration files
68% complete
Deleting instance and datafiles
84% complete
100% complete
Database deletion completed.
Look at the log file "/opt/oracle/cfgtoollogs/dbca/testdb/testdb0.log" for further details.
--重新执行初始化
[root@Centos8 ~]# /etc/init.d/oracledb_testdb configure
Configuring Oracle Database testdb.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/testdb.
Database Information:
Global Database Name:testdb
System Identifier(SID):testdb
Look at the log file "/opt/oracle/cfgtoollogs/dbca/testdb/testdb1.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用戶下.bash_profile
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=testdb
export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
登錄sqlplus
[oracle@Centos8 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Feb 15 09:50:16 2023
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> alter user system identified by Foxconn123;
User altered.
SQL> alter user sys identified by Foxconn123;
User altered.
自动打开pdb触发器:
SQL> CREATE TRIGGER open_all_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'alter pluggable database all open';
END open_all_pdbs;
/
开机自启动设置:
[oracle@centos8min ~]$ vi /etc/oratab
testdb:/opt/oracle/product/19c/dbhome_1:**Y**
[root@centos8min ~]# vi /usr/bin/oracle.sh
--添加內容如下
#! /bin/bash
# script For oracle19c.service
/opt/oracle/product/19c/dbhome_1/bin/lsnrctl start
/opt/oracle/product/19c/dbhome_1/bin/dbstart /opt/oracle/product/19c/dbhome_1
[root@centos8min ~]# chmod 755 /usr/bin/oracle.sh
[root@centos8min ~]# vi /etc/systemd/system/oracle19c.service
# 添加如下內容
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/opt/oracle/product/19c/dbhome_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
设置systemd管理:
[root@centos8min ~]# systemctl enable oracle19c
[root@centos8min ~]# systemctl start oracle19c
[root@centos8min ~]# systemctl status oracle19c
● oracle19c.service – Oracle19c
Loaded: loaded (/etc/systemd/system/oracle19c.service; enabled; vendor preset: disabled)
Active: active (exited) since Mon 2023-02-06 02:12:58 EST; 15s ago
Process: 6272 ExecStart=/usr/bin/oracle.sh (code=exited, status=0/SUCCESS)
Main PID: 6272 (code=exited, status=0/SUCCESS)
Tasks: 63 (limit: 11145)
Memory: 1.1G
CGroup: /system.slice/oracle19c.service
├─6383 ora_pmon_testdb
├─6387 ora_clmn_testdb
├─6391 ora_psp0_testdb
├─6395 ora_vktm_testdb
├─6401 ora_gen0_testdb
├─6405 ora_mman_testdb
├─6411 ora_gen1_testdb
├─6413 ora_gen2_testdb
├─6416 ora_vosd_testdb
├─6420 ora_diag_testdb
├─6423 ora_ofsd_testdb
├─6425 ora_dbrm_testdb
├─6428 ora_vkrm_testdb
├─6431 ora_svcb_testdb
├─6435 ora_pman_testdb
├─6438 ora_dia0_testdb
├─6441 ora_dbw0_testdb
├─6443 ora_lgwr_testdb
├─6448 ora_ckpt_testdb
├─6453 ora_smon_testdb
├─6458 ora_smco_testdb
├─6461 ora_reco_testdb
├─6463 ora_lreg_testdb
├─6466 ora_pxmn_testdb
├─6472 ora_mmon_testdb
├─6475 ora_mmnl_testdb
├─6477 ora_bg00_testdb
├─6480 ora_d000_testdb
├─6483 ora_w000_testdb
├─6486 ora_bg01_testdb
├─6489 ora_s000_testdb
├─6492 ora_w001_testdb
├─6495 ora_tmon_testdb
├─6499 ora_tt00_testdb
├─6501 ora_tt01_testdb
├─6503 ora_tt02_testdb
├─6505 ora_m000_testdb
├─6507 ora_w002_testdb
├─6511 ora_rcbg_testdb
├─6513 ora_aqpc_testdb
├─6515 ora_qm02_testdb
├─6517 ora_qm03_testdb
├─6519 ora_q002_testdb
├─6523 ora_p000_testdb
├─6525 ora_p001_testdb
├─6527 ora_w003_testdb
├─6529 ora_w004_testdb
├─6531 ora_s001_testdb
├─6707 ora_q003_testdb
├─6709 ora_cjq0_testdb
├─6790 ora_m001_testdb
├─6792 ora_m002_testdb
├─6794 ora_m003_testdb
├─6816 ora_m004_testdb
└─6819 ora_q004_testdb
Feb 06 02:12:35 centos8min.localdomain systemd[1]: Starting Oracle19c...
Feb 06 02:12:35 centos8min.localdomain oracle.sh[6273]: LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 06-FEB-2023 02:12>
Feb 06 02:12:35 centos8min.localdomain oracle.sh[6273]: Copyright (c) 1991, 2021, Oracle. All rights reserved.
Feb 06 02:12:35 centos8min.localdomain oracle.sh[6273]: TNS-01106: Listener using listener name LISTENER has already been start>
Feb 06 02:12:35 centos8min.localdomain oracle.sh[6320]: Processing Database instance "testdb": log file /opt/oracle/homes/OraDB>
Feb 06 02:12:58 centos8min.localdomain systemd[1]: Started Oracle19c.
最后修改时间:2023-02-15 14:43:10
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




