Oracle11gR2 for Linux installation--database patch installation

Download patches and opatch tools

-1) Download the patch and patch opatch tool (requires official purchase or company purchase)
p6880880_112000 Linux-86-64p24006111_112040_Linux-x86-64 these two patches for testing< /span> 2.4 Stop the database Stop emctl, which is a web-based tool used to manage and monitor Oracle database. It provides an intuitive user interface. 2.3) Stop all database services and business systems Open another command terminal (monitor lsnrctl stop, database and other related Stop business) 2.2 Stop the database Then decompress Use the mv ➕tab key to give this file another name. 2.1 Must be uploaded to the oracle user, that is, su - cd /backup/ directory under oracle
–2) Upload the patch related files to the server to decompress

Insert image description here


Insert image description here
Insert image description here


Insert image description here


Insert image description here

[oracle@itpuxhsdb52:/home/oracle]$ sqlplus  / as sysdba   
SQL> shutdown immediate;     #正常停止数据库
SQL> exit
[oracle@itpuxhsdb52:/home/oracle]$ ps  -ef|grep  ora_ (查看是否有Oracle的进程在运行)

After stopping the data, back up Oracle and cd to backup tar zcvf oracle.tar /oracle
2.5 If the production environment has data, the installation code for backing up the database must be RMAN to physically back up the database.
2.6 Install the opatch tool and apply patches
The first step is to replace the old opatch tool
Insert image description here
First check the version of opatch 11.2.0.3.4, but according to patch 11.2.0.4.160719
Insert image description here
Insert image description here
this command changes the directory (or file) name from "Opatch" to "Opatch_old". In this way, the directory (or file) originally named "Opatch" will be renamed to "Opatch_old". It is equivalent to a backup. If there is a problem, just change this back.
Next, replace the Opatch in p6880880_112000 Linux-86-64 of the upload server to here
Insert image description here
In the command, cp -r /backup/psu/Opatch . means to copy the /backup/psu/Opatch directory (or file) to the current directory (.). This command will copy the Opatch directory from the backup directory to the current working directory.
mv Opatch Opatch_,old #Rename the directory Opatch to Opatch_old

[oracle@itpuxhsd52:/oracle/app/oracle/product/11.2.0/db_1]$cd OPatch     #进到opatch里面
Coracle@itpuxhsdb52:/oracle/app/oracle/product/11.2.0/db_1/0Patch]$./opatch version
opatch version: 11.2.0.4.16
#版本已经从11.2.0.3.4改为11.2.0.4.16
[oracle@itpuxhsdb52:/oracle/app/oracle/product/11.2.0/db_1/0Patch]$ vi~/.bash_ bash_history .bash_logout .bash_profile
Toracle@itpuxhsdb52:/oracle/ app/oracle/product/11.2.0/db_1/0Patch] $ vi ~/.bash profile
将这$ORACLE_BASE/product/11.2.0/db_1/bin:/oracle/app/oracle/product/11.2.0, b_1/0Patch:放到path环境变量里面

Insert image description here
The advantage of putting it in the path environment variable is:

  1. Access them faster without having to enter the full path every time.
  2. Avoid duplication of work: If you have many executable files in different directories, adding these directories to $PATH can prevent you from constantly switching directories to run these files.
  3. Simplify scripts: If you write scripts that rely on these executables, adding these directories to $PATH can simplify the scripts and make them easier to maintain.
  4. Increased productivity: By adding frequently used directories to $PATH, these files can be accessed more quickly, thus improving productivity. Now start patching:

Patching tutorial

Enter opatch prereq CheckConflictAgainstOHWithDetail -ph ./ is the command used to pre-check for patch conflicts in the Oracle database.
Then enter opatch apply to complete the patching. Check itopatch - help (if you don’t remember the command) Enter opatch lsinventory to check and you will see the relevant patch number and then enter the databasesqlplus / as sysdbStart database

SQL> startup SQL> @catbundle.sql psu apply SQL> QUIT

•	catbundle.sql 是一个脚本文件的名称,它会在当前会话中执行。
•	psu 是第一个参数,可能是指要应用的 PSU(Patch Set Update)的类型或标识。
•	apply 是第二个参数,可能是指要对这个 PSU 进行的操作,可能是“应用”。该命令的具体作用和影响取决于 catbundle.sql 脚本的内容和所使用的参数

2.2 Then enterselect action,comments from registry$history;
Insert image description here
. This SQL query statement will retrieve the data of column from the registry$history table of the database. . Columns may contain operations performed on the database, such as installation, upgrade, patching, etc. Columns may contain additional instructions or comments related to the corresponding action. Then enter again utlrp.sql is a script in Oracle database used to recompile invalid objects. When the objects in the database become invalid for some reason (for example, related objects are modified, or the database is upgraded), you can run utlrp.sql to recompile these objects so that they becomes valid. action 和 comments
action
comments
SQL> @utlrp.sql

Start database service

After applying the patch, stop the database normally.
SQL> shutdown immediate; #关闭
SQL> exit
SQL> sqlplus / as sysdba
SQL> startup
SQL> exit

Restart monitoring lsnrctl start

(In a production environment, turn it on if it is needed, and turn it off when not in use, otherwise it will occupy resources) Turn on the controller[oracle@itpuxhsdb52:/oracle/app/oracle/product/11.2.0/db_1/rdbms/admin] $emctl start dbconsole

Testing and application scenarios

180-day password expiration problem
Turn off audit em monitoring and management warnings and logs
Turn off all database services and back up the installation code
Under root, enter oracle and cd to the backup directory cd /backuptar zcvf oracle.tar /oracle
After the backup is completed, restart the database, which requires manual operation.
Insert image description here

Configure client

The above is that the server and patches have been completed, and the next step is installation
Installation and configuration of Oracle client on Windows platform

Guess you like

Origin blog.csdn.net/weixin_43798406/article/details/133969224