
数据库环境使用CentOS7及Oracle 11G 单机单实例
***
使用```yum update```对CentOS进行升级
将Oracle数据库安装文件及安装脚本上传到服务器,最好直接安装11.2.0.4版本数据库,11.2.0.1版本存在一定问题
数据库安装完成后,对数据库进行补丁升级
```su - oracle```
# 1.关闭数据库
- 关闭监听
```lsnrctl stop```
- 关闭数据库
```
sqlplus / as sysdba
SQL> shutdown immediate;
```
# 2.备份ORACLE_HOME目录(可选)
```
cd $ORACLE_HOME/
tar -pzcvf oraclehome1.tar*
```
# 3.上传并解压补丁和OPatch
- 更改补丁目录权限:(root用户操作)
```
chown oracle:oinstall p6880880_112000_Linux-x86-64.zip
chown oracle:oinstall p31718723_112040_Linux-x86-64.zip
```
- 解压补丁
```
su - oracle
unzip p31718723_112040_Linux-x86-64.zip -d /home/oracle/software
```
- 解压OPatch(升级OPatch)
```
unzip -o p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
```
- 查看OPatch版本
```
$ORACLE_HOME/OPatch/opatch version
显示
OPatch Version: 11.2.0.3.31
OPatch succeeded.
```
# 4.安装补丁
- PSU补丁p31537677:
```
cd /home/oracle/software/31718723/31537677
$ORACLE_HOME/OPatch/opatch apply
......
Composite patch 31537677 successfully applied.
OPatch Session completed with warnings.
Log file location:***.log
OPatch completed with warnings
```
PSU补丁p31537677安装成功
- OCW补丁p29938455(可选):
```
cd /home/oracle/software/31718723/29938455
$ORACLE_HOME/OPatch/opatch napply /home/oracle/software/31718723/29938455/custom/server -local -oh $ORACLE_HOME -id 29938455
......
Patching component oracle.rdbms, 11.2.0.4.0...
Patch 29938455 successfully applied.
Log file location: ***.log
OPatch succeeded.
```
OCW补丁安装成功
# 5.升级数据字典并重新编译无效对象
```
sqlplus / as sysdba
startup
```
```sql
@?/rdbms/admin/catbundle.sql psu apply
...
@?/rdbms/admin/utlrp.sql
```
# 6.检查升级情况
使用<kbd>CTRL</kbd>+<kbd>D</kbd>退出数据库,输入
```$ORACLE_HOME/OPatch/opatch lsinventory```查看补丁及相关信息