7 升级Oracle数据库到11gR2
7.1 先打补丁7303030_zhs,9062910,8919489,8919489_ZHS ,9868229,10163753,11071569,9738085,9852070,12686610
(貌似批量打补丁时查询麻烦,所以不用AD Merge Patch)
停应用:
1
2
3
|
su - appltest
. /u01/TEST/apps/apps_st/appl/APPSTEST_test.env
$ADMIN_SCRIPTS_HOME/adstpall.sh apps/apps
|
等待几分钟,确认相关进程已终止。
开启维护模式:
adadmin 5 1
传p7303030_R12_zhs.zip,p9062910_12.1.0_R12_GENERIC.zip,p8919489_R12.TXK.B_R12_GENERIC.zip,p8919489_R12.TXK.B_R12_zhs.zip,p9868229_R12.BOM.C_R12_GENERIC.zip,p10163753_R12.BIV.B_R12_GENERIC.zip,p11071569_R12.TXK.B_R12_GENERIC.zip,p9738085_R12.TXK.B_R12_GENERIC.zip,p9852070_R12.TXK.B_R12_GENERIC.zip,p12686610_R12.TXK.B_R12_GENERIC.zip到/stage/patch下
(用appltest用户及环境变量)
1
2
3
4
5
6
7
8
9
10
11
|
cd
/stage/patch
unzip
p7303030_R12_zhs.zip
unzip
p9062910_12.1.0_R12_GENERIC.zip
unzip
p8919489_R12.TXK.B_R12_GENERIC.zip
unzip
p8919489_R12.TXK.B_R12_zhs.zip
unzip
p9868229_R12.BOM.C_R12_GENERIC.zip
unzip
p10163753_R12.BIV.B_R12_GENERIC.zip
unzip
p11071569_R12.TXK.B_R12_GENERIC.zip
unzip
p9738085_R12.TXK.B_R12_GENERIC.zip
unzip
p9852070_R12.TXK.B_R12_GENERIC.zip
unzip
p12686610_R12.TXK.B_R12_GENERIC.zip |
一
1
2
|
cd /stage/patch/7303030_ZHS
adpatch
|
7303030_ZHS.log
manager
确认补丁目录/stage/patch/7303030_ZHS
Please enter the name of your AutoPatch driver file输入driver文件名u7303030.drv
This Patch seems to have been applied already.Would you like to continue anyway [N] ? Y回车
(安装后默认打了p7303030_R12_GENERIC补丁,7303030_ZHS似乎没打)
等待几个小时
二
1
2
|
cd
/stage/patch/9062910
adpatch
|
9062910.log
manager
确认目录/stage/patch/9062910
u9062910.drv
等待几分钟
三
1
2
|
cd /stage/patch/8919489
adpatch
|
8919489.log
manager
确认目录/stage/patch/8919489
u8919489.drv
yes
等待几分钟
四
1
2
|
cd
/stage/patch/8919489_ZHS
adpatch
|
8919489_ZHS.log
manager
确认目录/stage/patch/8919489_ZHS
u8919489.drv
等待几分钟
五
1
2
|
cd /stage/patch/9868229
adpatch
|
9868229.log
manager
确认目录/stage/patch/9868229
u9868229.drv
等待几分钟
六
1
2
|
cd
/stage/patch/10163753
adpatch
|
10163753.log
manager
确认目录/stage/patch/10163753
u10163753.drv
等待几分钟
七
1
2
|
cd /stage/patch/11071569
adpatch
|
11071569.log
manager
确认目录/stage/patch/11071569
u11071569.drv
等待几分钟
八
1
2
|
cd
/stage/patch/9738085
adpatch
|
9738085.log
manager
确认目录/stage/patch/9738085
u9738085.drv
等待几分钟
九
1
2
|
cd /stage/patch/9852070
adpatch
|
9852070.log
manager
确认目录/stage/patch/9852070
u9852070.drv
等待几分钟
十
1
2
|
cd
/stage/patch/12686610
adpatch
|
12686610.log
manager
确认目录/stage/patch/12686610
u12686610.drv
等待几分钟
关闭维护模式,启应用
adadmin 5 2
1
|
$ADMIN_SCRIPTS_HOME/adstrtal.sh apps/apps
|
7.2 Redeploy Forms
如果启应用时出现
Latest formsapp.ear has NOT been deployed
We have determined that you need to redeploy Forms (using txkChkFormsDeployment.pl).
But could not do it automatically for you, due to some issues.
则先停应用,确认没有java进程
1
2
3
4
5
|
su
- appltest</p>
<p>.
/u01/TEST/apps/apps_st/appl/APPSTEST_test.env
$ADMIN_SCRIPTS_HOME/adstpall.sh
apps/apps
ps
-ef | grep java
$FND_TOP/bin/txkrun.pl
-script=CfgOC4JApp |
forms
输入oc4jadmin用户的密码oafm或secret或welcome
no
(
如果密码错误则按下面方法改密码后再重试备份oc4j配置文件
1 cp $INST_TOP/ora/10.1.3/j2ee/forms/config/system-jazn-data.xml $INST_TOP/ora/10.1.3/j2ee/forms/config/system-jazn-data.xml.backup修改oc4jadmin密码
1 vi
$INST_TOP/ora/10.1.3/j2ee/forms/config/system-jazn-data.xml找到
oc4jadmin
OC4J Administrator
OC4J Administrator
{903}n9uT0UYwlniXTEJGXhIgZn4y9hBgt1YH将name为oc4jadmin下面的一行改为
!oc4jadmin
叹号后面是明文密码,保存退出vi。
)
(如果出现下面错误:
Command error: = 512, = /u01/TEST/apps/tech_st/10.1.3/opmn/bin/opmnctl start
STACK TRACE
TXK::Error::abort(‘TXK::Error’,’HASH(0x83b8174)’) called at /u01/TEST/ap
ps/apps_st/appl/au/12.0.0/perl/TXK/Common.pm line 299
TXK::Common::doError(‘TXK::Process=HASH(0x9282584)’,’Command error:
= 32512, = /u01/TEST/apps/tech_…’,’undef’) called at /u01/TEST/apps
/apps_st/appl/au/12.0.0/perl/TXK/Common.pm line 314
TXK::Common::setError(‘TXK::Process=HASH(0x9282584)’,’Command error: <rc
> = 32512, = /u01/TEST/apps/tech_…’) called at /u01/TEST/apps/apps_s
t/appl/au/12.0.0/perl/TXK/Process.pm line 449
TXK::Process::run(‘TXK::Process=HASH(0x9282584)’,’HASH(0x8829fcc)’) call
ed at /u01/TEST/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkCfgOC4JApp.pl line
1587
TXK::RunScript::execOPMNControl(‘HASH(0x8b493cc)’) called at /u01/TEST/a
pps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkCfgOC4JApp.pl line 599
require /u01/TEST/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/txkCfgOC4JA
pp.pl called at /u01/TEST/apps/apps_st/appl/au/12.0.0/perl/TXK/RunScript.pm line
105
TXK::RunScript::require(‘TXK::RunScript’,’/u01/TEST/apps/apps_st/appl/fn
d/12.0.0/patch/115/bin/txkCfgOC…’) called at /u01/TEST/apps/apps_st/appl/au/12
.0.0/perl/TXK/Script.pm line 177
eval {…} called at /u01/TEST/apps/apps_st/appl/au/12.0.0/perl/TXK/Scri
pt.pm line 177
TXK::Script::run(‘TXK::Script=HASH(0x8c38e74)’,’/u01/TEST/inst/apps/TEST
_test/logs/appl/rgf/TXK’,’/u01/TEST/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/t
xkCfgOC…’) called at /u01/TEST/apps/apps_st/appl/fnd/12.0.0/bin/txkrun.pl line
174可以尝试这个方法:
1 vi /u01/TEST/apps/tech_st/10.1.3/opmn/bin/opmnctl将下面三行
ORACLE_HOME=/nfs/bld/d26/PRDXBLD9/apps/tech_st/10.1.3; export ORACLE_HOME
NLS_LANG=${NLS_LANG=”AMERICAN_AMERICA.WE8MSWIN1252″}; export NLS_LANG
TNS_ADMIN=${TNS_ADMIN=”/nfs/bld/d26/PRDXBLD9/apps/tech_st/10.1.3/network/admin”}
; export TNS_ADMIN改为
ORACLE_HOME=/u01/TEST/apps/tech_st/10.1.3; export ORACLE_HOME
NLS_LANG=${NLS_LANG=”American_America.ZHS16GBK”}; export NLS_LANG
TNS_ADMIN=${TNS_ADMIN=”/u01/TEST/inst/apps/TEST_test/ora/10.1.2/network/admin”}; export TNS_ADMIN)
结束后运行应用AutoConfig
1
|
$ADMIN_SCRIPTS_HOME/adautocfg.sh
|
输入apps用户的密码apps
再启应用
1
|
$ADMIN_SCRIPTS_HOME/adstrtal.sh apps/apps
|
启动过程中可以看到
Latest formsapp.ear has been deployed
7.3 安装11gR2数据库
7.3.1 安装11gR2database
用vnc或者直接在虚拟机上操作,不要用ssh连接
1
2
|
su
- root
xhost
+ |
(如果不运行次命令,则以root用户登录后切换到oratest用户再运行图形化安装界面则会报错No protocol specified)
1
|
su - oratest
|
新建ORACLE_HOME目录
1
|
mkdir
/u01/oracle/TEST/db/tech_st/11.2.0 |
把p10404530_112030_LINUX_1of7.zip,p10404530_112030_LINUX_2of7.zip,p10404530_112030_LINUX_6of7.zip三个文件传到patch目录下
(继续用上面的oratest用户)
1
2
3
4
|
cd /stage/patch
unzip p10404530_112030_LINUX_1of7.zip
unzip p10404530_112030_LINUX_2of7.zip
unzip p10404530_112030_LINUX_6of7.zip
|
用图形界面在桌面新建一个fallback文件夹,把zysong.ttf传到此文件夹
用归档管理器打开
/stage/patch/database/stage/Components/oracle.jdk/1.5.0.30.03/1/DataFiles/filegroup2.jar
然后进入/jdk/jre/lib/fonts/
把fallback目录拖进来
设置base目录和新home的环境变量
1
|
su
- oratest |
(不加载env文件环境变量)
1
2
3
4
|
export ORACLE_BASE=/u01/oracle/TEST
export ORACLE_HOME=/u01/oracle/TEST/db/tech_st/11.2.0
cd /stage/patch/database
./runInstaller
|
在弹出的图形界面中,取消勾选接收安全更新,下一步:
是:
跳过,下一步:
是:
仅安装数据库软件,下一步:
单实例数据库安装,下一步:
简体中文,英语,下一步:
企业版,选择选项:
勾选需要安装的组件(这里保持默认),确定,下一步
确认home和base目录,下一步:
没有建统一的/etc/oraInst.loc,所以会提示指定产品清单目录:
确认osdba组,下一步:
确认信息后,安装:
等待几十分钟,可以点击详细资料看具体进度:
直到提示用root用户运行脚本:
另外打开一个终端窗口,按提示运行脚本
1
2
3
4
5
|
su
- root
cd
/u01/oracle/oraInventory
./orainstRoot.sh
cd
/u01/oracle/TEST/db/tech_st/11.2.0
./root.sh
|
回车确认linux的bin目录
在之前的提示窗口上点击确定,关闭:
安装11gR2database结束。
7.3.2 安装11gR2examples
有的文档说必装,有的说如果需要下面这些产品或功能就安装:
Oracle JDBC Development Drivers
Oracle Database Examples
Oracle Text Knowledge Base
Various Oracle product demonstrations
用归档管理器打开
/stage/patch/examples/stage/Components/oracle.jdk/1.5.0.30.03/1/DataFiles/filegroup2.jar
然后进入/jdk/jre/lib/fonts/
把之前在桌面建的fallback目录(含zysong.ttf)拖进来
如果之前oratest用户窗口没有关闭则直接到下面cd /stage/patch/examples一步
1
2
3
4
5
|
su - root
xhost +
su - oratest
export ORACLE_BASE=/u01/oracle/TEST
export ORACLE_HOME=/u01/oracle/TEST/db/tech_st/11.2.0
|
1
2
|
cd
/stage/patch/examples
./runInstaller
|
跳过软件更新,下一步:
是:
选择11gR2的软件位置(ORACLE_HOME,不要选到11.1.0),确认基目录(ORACLE_BASE),下一步:
确认信息,安装:
等待几分钟,可以点击详细资料查看具体进度:
关闭:
安装11gR2examples结束。
7.3.3 设置环境变量
1
2
3
4
5
6
|
su - oratest
export ORACLE_BASE=/u01/oracle/TEST
export ORACLE_HOME=/u01/oracle/TEST/db/tech_st/11.2.0
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PERL5LIB=$ORACLE_HOME/perl/lib/5.10.0:$ORACLE_HOME/perl/lib/site_perl/5.10.0
|
用env命令检查环境变量。
设置好之后进行下面步骤。
7.3.4 创建nls/data/9idata目录
在上面设置好环境变量后
1
2
|
perl
$ORACLE_HOME/nls/data/old/cr9idata.pl
export
ORA_NLS10=$ORACLE_HOME/nls/data/9idata |
7.3.5 打11.2.0.3数据库附加补丁
停应用和数据库:
1
2
3
|
su - appltest
. /u01/TEST/apps/apps_st/appl/APPSTEST_test.env
$ADMIN_SCRIPTS_HOME/adstpall.sh apps/apps
|
1
2
3
4
5
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
cd
/u01/oracle/TEST/db/tech_st/11.1.0/appsutil/scripts/TEST_test
./addlnctl.sh
stop TEST
./addbctl.sh
stop immediate |
打additional 11.2.0.3 RDBMS patches:
先升级opatch
把p6880880_112000_LINUX.zip传到/stage/patch目录下
继续用上面的oratest用户及11gR2环境变量(或者重新运行su – oratest和“设置环境变量”、“创建nls/data/9idata目录”两节的export命令)
1
2
|
cd /stage/patch
unzip p6880880_112000_LINUX.zip
|
用echo $ORACLE_HOME命令确认是否11gR2目录/u01/oracle/TEST/db/tech_st/11.2.0
用$ORACLE_HOME/OPatch/opatch version查看opatch版本OPatch Version: 11.2.0.1.7
1
2
|
mv
$ORACLE_HOME/OPatch $ORACLE_HOME/OPatchBackup
mv
/stage/patch/OPatch $ORACLE_HOME |
再用$ORACLE_HOME/OPatch/opatch version查看版本OPatch Version: 11.2.0.3.4
把p4247037_112030_Generic.zip,p9858539_112030_Generic.zip,p12942119_112030_LINUX.zip,p12960302_112030_LINUX.zip,p12985184_112030_LINUX.zip,p13001379_112030_Generic.zip,p13004894_112030_LINUX.zip,p13258936_112030_Generic.zip,p13366268_112030_Generic.zip传到/stage/patch目录下
1
2
3
4
5
6
7
8
9
10
|
cd /stage/patch
unzip p4247037_112030_Generic.zip
unzip p9858539_112030_Generic.zip
unzip p12942119_112030_LINUX.zip
unzip p12960302_112030_LINUX.zip
unzip p12985184_112030_LINUX.zip
unzip p13001379_112030_Generic.zip
unzip p13004894_112030_LINUX.zip
unzip p13258936_112030_Generic.zip
unzip p13366268_112030_Generic.zip
|
用echo $ORACLE_HOME命令确认是11gR2的目录/u01/oracle/TEST/db/tech_st/11.2.0
一
1
2
|
cd
/stage/patch/4247037
$ORACLE_HOME/OPatch/opatch
apply |
直接回车然后y不接受邮件
二
1
2
|
cd /stage/patch/9858539
$ORACLE_HOME/OPatch/opatch apply
|
直接回车然后y不接受邮件
三
1
2
|
cd
/stage/patch/12942119
$ORACLE_HOME/OPatch/opatch
apply |
直接回车然后y不接受邮件
y
四
1
2
|
cd /stage/patch/12960302
$ORACLE_HOME/OPatch/opatch apply
|
直接回车然后y不接受邮件
y
五
1
2
|
cd
/stage/patch/12985184
$ORACLE_HOME/OPatch/opatch
apply |
直接回车然后y不接受邮件
y
六
1
2
|
cd /stage/patch/13001379
$ORACLE_HOME/OPatch/opatch apply
|
直接回车然后y不接受邮件
七
1
2
|
cd
/stage/patch/13004894
$ORACLE_HOME/OPatch/opatch
apply |
直接回车然后y不接受邮件
y
八
1
2
|
cd /stage/patch/13258936
$ORACLE_HOME/OPatch/opatch apply
|
直接回车然后y不接受邮件
y
九
1
2
|
cd
/stage/patch/13366268
$ORACLE_HOME/OPatch/opatch
apply |
直接回车然后y不接受邮件
y
检查已经安装的补丁
1
|
$ORACLE_HOME/OPatch/opatch lsinventory
|
7.4 升级数据库
7.4.1 启11gR1数据库
只启数据库不启数据库监听
1
2
3
4
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
cd
/u01/oracle/TEST/db/tech_st/11.1.0/appsutil/scripts/TEST_test
./addbctl.sh
start TEST |
7.4.2 删除11gR1索引enabled$indexes,REPCAT$_AUDIT_COLUMN_IDX1
1
2
3
4
5
6
|
su - oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus / as sysdba
drop table sys.enabled$indexes;
drop index system.REPCAT$_AUDIT_COLUMN_IDX1;
quit
|
(略)禁用Vault
没用Vault,这一步略过
If you have Database Vault installed, perform steps 1 to 6 of Part 2 of document 1091083.1 on My Oracle Support to disable Database Vault.
https://support.oracle.com/epmos/faces/ui/km/DocContentDisplay.jspx?id=1091083.1
7.4.3 编辑oratab文件
确认oratab文件中包含老数据库home目录
格式:$ORACLE_SID:$ORACLE_HOME:
Y或N代表开机启动
1
|
vi
/etc/oratab |
找到或加入下面这行:
TEST:/u01/oracle/TEST/db/tech_st/11.1.0:N
7.4.4 用Pre-Upgrade Information Tool检查
将utlu112i_5.sql传到/stage/patch目录下
1
2
3
4
5
6
7
8
|
su - oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus / as sysdba
SPOOL upgrade_info.log
@/stage/patch/utlu112i_5.sql
SPOOL OFF
quit
less upgrade_info.log
|
查看相关信息并处理
一
WARNING: –> CTXD tablespace is not large enough for the upgrade.
WARNING: –> SYSAUX tablespace is not large enough for the upgrade.
1
2
3
4
5
6
7
8
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus
/ as sysdba
select
file_name,bytes/1024/1024 M from dba_data_files where tablespace_name='CTXD';
alter
database datafile '/u01/oracle/TEST/db/apps_st/data/ctxd01.dbf' resize 30M;
select
file_name,bytes/1024/1024 M from dba_data_files where tablespace_name='SYSAUX';
alter
database datafile '/u01/oracle/TEST/db/apps_st/data/sysaux02.dbf' resize 400M;
quit
|
二
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2 init.ora or spfile]
–> plsql_native_library_dir 11.2 OBSOLETE
–> plsql_native_library_subdir_ 11.2 OBSOLETE
1
2
3
|
su - oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
vi $ORACLE_HOME/dbs/initTEST.ora
|
注释下面两行
plsql_native_library_dir
plsql_native_library_subdir_count
三
WARNING: –> Database is using a timezone file older than version 14.
等下用DBUA处理,或者根据977512.1手动用DBMS_DST处理
四
WARNING: –> Your recycle bin contains 12 object(s).
…. It is REQUIRED that the recycle bin is empty prior to upgrading
1
2
3
4
5
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus
/ as sysdba
PURGE
DBA_RECYCLEBIN;
quit
|
五
WARNING: –> Database contains schemas with objects dependent on DBMS_LDAP package.
…. Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
…. USER APPS has dependent objects.
不用处理,略过This warning can be ignored for APPS objects.
六
Oracle recommends gathering dictionary statistics prior to upgrading the database.
1
2
3
4
5
|
su - oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus / as sysdba
EXECUTE dbms_stats.gather_dictionary_stats;
quit
|
等待一个小时左右
七
Oracle recommends removing all hidden parameters prior to upgrading.
略过,dbua升级过程中会自动处理掉。
手动处理方法:
su – oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus / as sysdba
SELECT name,description from SYS.V$PARAMETER WHERE name LIKE ‘\_%’ ESCAPE ‘\';
quit
vi $ORACLE_HOME/dbs/initTEST.ora
注释掉查询出来的行
八
Oracle recommends reviewing any defined events prior to upgrading.
1
2
3
4
5
6
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus
/ as sysdba
SELECT
(translate(value,chr(13)||chr(10),' ')) FROM sys.v$parameter2 WHERE UPPER(name) ='EVENT' AND isdefault='FALSE';
SELECT
(translate(value,chr(13)||chr(10),' ')) from sys.v$parameter2 WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE';
quit
|
九
The DMSYS schema exists in the database. Prior to performing an upgrade Oracle recommends that the DMSYS schema, and its associated objects be removed from the database.
1
2
3
4
5
|
su - oratest
. /u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus / as sysdba
DROP USER DMSYS CASCADE;
quit
|
重新运行Pre-Upgrade Information Tool
1
2
3
4
5
6
7
8
|
su
- oratest
.
/u01/oracle/TEST/db/tech_st/11.1.0/TEST_test.env
sqlplus
/ as sysdba
SPOOL
upgrade_info.log
@/stage/patch/utlu112i_5.sql;
SPOOL
OFF
quit
less
upgrade_info.log |