第一次安装rpm包
[root@rac192 oracle]# yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm Warning: RPMDB altered outside of yum. Installing : oracle-database-ee-19c-1.0-1.x86_64 1/1 'DetachHome' failed. 'AttachHome' failed. [SEVERE] An error occurred while registering the Oracle home. Verify logs in /var/log/oracle-database-ee-19c/results/oraInstall.log and for more details and try again. warning: %post(oracle-database-ee-19c-1.0-1.x86_64) scriptlet failed, exit status 1 Non-fatal POSTIN scriptlet failure in rpm package oracle-database-ee-19c-1.0-1.x86_64 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@rac192 oracle]# [oracle@rac192 /]$ cd opt/oracle/product/19c/dbhome_1/ [oracle@rac192 ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 15 15:37:33 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to an idle instance. SQL> [oracle@rac192 ~]$ /opt/oracle/product/19c/dbhome_1/OPatch/opatch version OPatch Version: 12.2.0.1.17 OPatch succeeded. [oracle@rac192 ~]$
再次安装rpm包
这个文件不对:/etc/oraInst.loc,OPatch不能用,再次强制重新安装
[oracle@rac192 31219897]$ /opt/oracle/product/19c/dbhome_1/OPatch/opatch lsinventory -invPtrLoc /etc/oraInst.loc ....... LsInventorySession failed: OPatch failed to locate Central Inventory. Possible causes are: The Central Inventory is corrupted The oraInst.loc file specified is not valid.
[root@rac192 oracle]# rpm -ivh --force oracle-database-ee-19c-1.0-1.x86_64.rpm warning: oracle-database-ee-19c-1.0-1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY Preparing... ################################# [100%] Updating / installing... 1:oracle-database-ee-19c-1.0-1 ################################# [100%] [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
安装后再检查
[root@rac192 ~]# cat /etc/oraInst.loc inventory_loc=/opt/oracle/oraInventory inst_group=oinstall
opatch终于可以用了!
创建数据库
修改数据库文件目录 /etc/sysconfig/oracledb_ORCLCDB-19c.conf
ORACLE_DATA_LOCATION=/ofsdata/app/oracle/oradata 1 [root@rac192 ~]# /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@rac192 ~]#
通过补丁升级到19.8
[oracle@rac192 31281355]$/opt/oracle/product/19c/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /opt/oracle/product/19c/dbhome_1 Central Inventory : /opt/oracle/oraInventory from : /opt/oracle/product/19c/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.21 OUI version : 12.2.0.7.0 Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2020-09-15_17-35-09PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
关闭数据库后再升级
[oracle@rac192 31281355]$ /opt/oracle/product/19c/dbhome_1/OPatch/opatch apply [oracle@rac192 ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 15 17:52:27 2020 Version 19.8.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.8.0.0.0 SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- BANNER_FULL -------------------------------------------------------------------------------- BANNER_LEGACY -------------------------------------------------------------------------------- CON_ID ---------- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.8.0.0.0 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 0 BANNER -------------------------------------------------------------------------------- BANNER_FULL -------------------------------------------------------------------------------- BANNER_LEGACY -------------------------------------------------------------------------------- CON_ID ----------
Patch Post-Installation
别忘了: Load Modified SQL Files into the Database
把数据库打开,包括所有的pdb: alter pluggable database all open;
% cd $ORACLE_HOME/OPatch % ./datapatch -verbose
修复无效的对象
cd $ORACLE_HOME/rdbms/admin sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> @utlrp.sql
修改归档路径
SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /ofsdata/app/oracle/oradata/archive Oldest online log sequence 164 Next log sequence to archive 166 Current log sequence 166 alter system set log_archive_dest_1='location=/ofsdata/app/oracle/oradata/archive';