关于数据库的升级,我们已经了解到了数据库各个版本的升级路线,见此文(或Note 730365.1 Oracle Database Upgrade Path Reference List)。
下面我们介绍配合EBS升级的2个版本的数据库手工升级的步骤。
(一)8.1.7.3升级至9.2.0.8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
(1)安装9.2.0.8数据库软件 注:升级之前与之后检查sys.MON_MODS_ALL$和sys.MON_MODS$里是否有重复行。这关系到11gR2升级里 一个BUG (1.1)安装9.2.0.1 RDBMS 安装9.2.0.1 RDBMS代码并配置TNS,步骤如下: (1.1.1)分别解压9201的4张CD到/u03/oracle/orasup/9iR2/9201下的4个目录中。 (1.1.2)检查表空间SYSTEM和RBS的剩余空间,SYSTEM至少要500MB,RBS至少要750MB。 alter tablespace rbs add datafile '/u05/oracle/PROD/proddata/rbs08.dbf' size 1000m; alter table argument$ storage(maxextents unlimited); alter tablespace SYSTEM default storage(maxextents unlimited); (1.1.3)关闭所有应用和数据库、监听。 (1.1.4)运行/usr/sbin/slibclean (1.1.5)运行rootpre.sh脚本。 (1.1.6)运行runInstaller.sh安装英文版本。 (1.1.7)重新运行runInstaller.sh安装ZHS语言包。 (1.2)安装9.2.0.8补丁 (1.2.1)运行/usr/sbin/slibclean(否则会报告libjox9.a无法被替换的错误) (1.2.2)安装9208补丁集 4547809 注:补丁包仅有英文版本,无需选择语言。 (1.2.3)安装opatch补丁6880880(即最新的opatch) (1.2.4)安装附加的9208补丁:5391326 、2858130 注:和EBS相关,使用opatch apply安装 (1.2.5)安装9208 CPU补丁:8534403。补丁后续步骤暂不执行。 注:直接使用opatch apply安装, Post步骤不执行。 (2)升级8.1.7.3 数据库至9.2.0.8(64bit) 注 :如果数据库有归档,升级前将归档和log_archive_dest等归档参数注释,并取消数据库归档 (2.1)升级9.2.0.8前的准备 执行以下步骤,准备将数据库8.1.7.3升级到9.2.0.8: (2.1.1)创建$ORACLE_HOME/admin目录 $mkdir –p /u12/oracle/prod9iRDBMS/admin $cd /u12/oracle/prod9iRDBMS/admin $cp -rp /u01/oracle/proddb/8.1.7/admin . (2.1.2)准备9i ORACLE HOME里的initPROD.ora文件 a. 替换ORACLE_HOME对应的路径 b. COMPATIBLE = 8.1.7 c. _system_trig_enabled = FALSE, CLUSTER_DATABASE =FALSE, d. 注释掉以下几个参数: event="10932 trace name context level 32768" event="10933 trace name context level 512" event="10943 trace name context level 16384" optimizer_features_enable = 9.2.0 #MP job_queue_interval # Obsoleted optimizer_percent_paralle l# Obsoleted always_anti_join # Obsoleted always_semi_join # Obsoleted aq_tm_processes job_queue_processes e. 不要使用undo_参数 f. 检查control_file, rollback, utl_file_dir,db_files, log_archive_start参数。 g. SGA参数最小值: Shared_pool_size: > 50MB => 150MB(最少) => 6G(推荐) PGA_AGGREGATE_TARGET > 25M => 60MB(最少) => 2G(推荐) LARGE_POOL_SIZE > 10M => 50MB (最少) => 100M(推荐) Log_buffer => 10M(最少) =>50M(推荐) Lock_sga = true Db_cache_size=> 6GB => 24GB(推荐) Parallel_max_servers=>8(最少) =>32(推荐) h. 关闭执行程序的RAC选项: cd $ORACLE_HOME/rdbms/lib make -f ins_rdbms.mk rac_off make -f ins_rdbms.mk ioracle (2.1.3)备份oraInventory (2.1.4)检查数据库用户没有crontab命令或确认crontab无影响 (2.1.5)检查ulimit设置 $ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) 4194304 memory(kbytes) unlimited coredump(blocks) unlimited nofiles(descriptors) unlimited ulimit -c unlimited ulimit -n unlimited ulimit -m unlimited (2.2)升级数据库到9.2.0.8 执行以下步骤,将数据库从8.1.7.3升级到9.2.0.8: (2.2.1)确认以下环境变量设置正确: export ORACLE_HOME=xxxxxx export SHLIB_PATH=$ORACLE_HOME/lib:/usr/dt/lib:/usr/openwin/lib export PATH=$ORACLE_HOME/Apache/perl/bin:$ORACLE_HOME/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oraprod/bin:/usr/bin/X11:/sbin:.:/home/oraprod:/usr/java131/bin:. export ADPERLPRG=$ORACLE_HOME/Apache/perl/bin/perl export ORA_TZFILE=$ORACLE_HOME/oracore/zoneinfo/timezlrg.dat export TNS_ADMIN=$ORACLE_HOME/network/admin/PROD export CONTEXT_FILE=$ORACLE_HOME/appsutil/PROD.xml export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/dt/lib:/usr/openwin/lib:$ORACLE_HOME/ctx/lib export PERL5LIB=$ORACLE_HOME/Apache/perl/lib/5.00503:$ORACLE_HOME/Apache/perl/lib/site_perl/5.005:$ORACLE_HOME/appsutil/perl export ADJVAPRG=$ORACLE_HOME/jdk/bin/java export LIBPATH=$ORACLE_HOME/lib:/usr/dt/lib:/usr/openwin/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib (2.2.2)在9i ORACLE HOME下,以migrate模式启动数据库 SQL> STARTUP MIGRATE (2.2.3)运行9208升级脚本 $ cd $ORACLE_HOME/rdbms/admin;sqlplus ‘/as sysdba’ SQL> SPOOL U0801070.LOG SQL> @u0801070.sql (约运行1小时) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION ----------------------------------- ----------- -------------------- Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine LOADED 8.1.7 Java Packages LOADED 8.1.7 Oracle XDK for Java LOADED 8.1.7 Oracle interMedia Text LOADED 8.1.7 Real Application Clusters LOADED Oracle interMedia LOADED 8.1.6.0.0 Oracle Spatial LOADED 8.1.6.0.0 运行以下脚本继续9208升级(components upgraded): SQL> @cmpdbmig.sql (运行20分钟) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION ----------------------------------- ----------- ------------------------------ Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java UPGRADED 9.2.0.2.0 Oracle interMedia Text LOADED 8.1.7 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia LOADED 8.1.6.0.0 Oracle Spatial LOADED 8.1.6.0.0 DEVELOPMENT (2.3.4)升级TEXT组件 $cd $ORACLE_HOME/ctx/admin $sqlplus "/as sysdba" SQL> @s0900010.sql (运行1分钟) SQL> conn ctxsys/ctxsys SQL> @u0900010.sql (运行1分钟) 在运行以上升级脚本的时候报告错误ORA-01562: failed to extend rollback segment number。 发生错误的语句是修改dr$waiting表,为它添加一个字段wtg_pid:alter table dr$waiting add (wtg_pid number default 0)。手工执行如下脚本进行修复: SQL> alter table dr$waiting add (wtg_pid number ); SQL> alter table CTXSYS.DR$WAITING modify WTG_PID default 0; SQL> alter table dr$waiting nologging; SQL> update /*+ parallel(4) */dr$waiting set wtg_pid = 0; 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION ---------------------------------------- ----------- ------------------------------ Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java UPGRADED 9.2.0.2.0 Oracle interMedia Text LOADED 8.1.7 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia LOADED 8.1.6.0.0 Oracle Spatial LOADED 8.1.6.0.0 DEVELOPMENT SQL> connect / as sysdba SQL> @?/ctx/admin/s0902000.sql(运行1分钟) SQL> connect ctxsys/ctxsys SQL> @?/ctx/admin/u0902000.sql (运行10分钟) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION -------------------------------------------------- ----------- ------------------------------ Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java UPGRADED 9.2.0.2.0 Oracle Text VALID 9.2.0.8.0 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia LOADED 8.1.6.0.0 Oracle Spatial LOADED 8.1.6.0.0 DEVELOPMENT SQL> spool off (2.3.5)升级数据库Spatial组件 $cd $ORACLE_HOME/javavm/install $sqlplus '/as sysdba' SQL >spool jvm_upg_20101126.log SQL >@jvmsec3.sql(运行1分钟) SQL >@jvmsec5.sql (运行时有错误,错误参考spatial.log,忽略.运行1分钟) SQL> SHUTDOWN IMMEDIATE 修改参数compatible=9.2.0 SQL > STARTUP SQL>SPOOL ?/md/admin/mdprivs.log SQL>@?/md/admin/mdprivs.sql(运行1分钟) SQL>connect mdsys/mdsys SQL>@?/md/admin/c81Xu9X.sql(运行1分钟) (运行时有错误,错误参考日志) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION -------------------------------------------------- ----------- ------------------------------ Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java UPGRADED 9.2.0.2.0 Oracle Text VALID 9.2.0.8.0 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia LOADED 8.1.6.0.0 Spatial VALID 9.2.0.8.0 (2.3.6)升级数据库Intermedia组件 SQL> spool ?/ord/im/admin/imdbma.log SQL> CONNECT /AS SYSDBA SQL> @?/ord/im/admin/imdbma.sql(运行1分钟) SQL>@?/ord/im/admin/u0801070.sql(运行5分钟) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION -------------------------------------------------- ----------- ------------------------------ Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java UPGRADED 9.2.0.2.0 Oracle Text VALID 9.2.0.8.0 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia VALID 9.2.0.8.0 Spatial VALID 9.2.0.8.0 (2.3.7)运行9208补丁的后续步骤 SQL> startup migrate SQL> spool ?/rdbms/admin/catpatch.log SQL> @?/rdbms/admin/catpatch.sql (运行30分钟) 多次报告ORA-01031: insufficient privileges错误,可以直接忽略(NOTE:287356.1) 运行完之后,检查dba_register的内容如下: SQL> select comp_name,status,version from dba_registry; COMP_NAME STATUS VERSION ----------------------------------- ----------- -------------------- Oracle9i Catalog Views VALID 9.2.0.8.0 Oracle9i Packages and Types VALID 9.2.0.8.0 JServer JAVA Virtual Machine VALID 9.2.0.8.0 Oracle9i Java Packages VALID 9.2.0.8.0 Oracle XDK for Java VALID 9.2.0.10.0 Oracle Text VALID 9.2.0.8.0 Oracle9i Real Application Clusters INVALID 9.2.0.8.0 Oracle interMedia VALID 9.2.0.8.0 (2.3.8)数据库升级之后会有如下的SYS用户无效对象,忽略(Note 361757.1) x_$bh; x_$kcbwbpd; x_$kcbwds; (2.4)执行CPU补丁的后续步骤 执行以下数据库从8.1.7.3升级到9.2.0.8的后续步骤: (2.4.1)运行9208 CPU补丁的后续步骤。 cd $ORACLE_HOME/cpu/CPUJul2009 sqlplus '/as sysdba' SQL> startup SQL> spool catcpu.log sql> @catcpu.sql (运行3分钟) sql> commit; 运行完之后有61837个无效对象 (2.4.2)运行nchar转换脚本 SQL> shutdown immediate sql> startup restrict; sql> @?/rdbms/admin/utlnchar.sql(运行1分钟) sql> @?/rdbms/admin/n_switch.sql(运行3分钟) (2.5)转换数据库到64位(可选,如有需要的话) (2.5.1)转换数据库到64位 cd $ORACLE_HOME/rdbms/admin sqlplus "/ as sysdba" SQL> shutdown immediate SQL> STARTUP MIGRATE SQL> SPOOL wordsize.log SQL> select * from v$version; SQL> @utlirp.sql (运行210分钟) 由于以上脚本会将所有的对象失效并重新以单进程进行编译,这样效率很慢,在以上脚本执行的同时,建议执行以下脚本来并行编译: @?/rdbms/admin/utlrcmp.sql begin sys.utl_recomp.recomp_parallel(threads => 80,schema => 'APPS'); end; 注:该步骤时间长 注意执行的是utlirp.sql, 不是utlrp.sql 检查wordsize.log是否有错误 检查数据库是否为64bit: SQL> select * from v$version (3)升级9.2.0.8后续步骤 (3.1)在9i ORACLE HOME里配置listener.ora (3.2)进行SMU转换(运行10分钟) (3.2.1)检查当前的rollback segment SQL> select segment_name, tablespace_name from dba_rollback_segs; SEGMENT_NAME TABLESPACE_NAME ------------------------------ ------------------------------ SYSTEM SYSTEM RBS01 RBS RBS02 RBS RBS03 RBS ... RBS30 RBS (3.2.2)检查当前的rollback表空间 SQL > select distinct tablespace_name from dba_rollback_segs; TABLESPACE_NAME ------------------------------ RBS SYSTEM SQL> select file_name, tablespace_name, bytes from dba_data_files where tablespace_name = 'RBS'; FILE_NAME TABLESPACE_NAME BYTES ------------------------------ ------------------------------ ---------- /u05/oracle/proddata/rbs01.dbf RBS 1572864000 /u05/oracle/proddata/rbs02.dbf RBS 1572864000 ... /u05/oracle/proddata/rbs18.dbf RBS 1572864000 (3.2.3)将当前的rollback segment offline(system rollback segment除外)。 Set pagesize 0 Set linesize 130 select 'alter rollback segment '||segment_name||' offline;' from dba_rollback_segs a where a.tablespace_name = 'RBS'; 利用以上脚本生成的SQL进行 rollback segment offline操作。生成的SQL如下: alter rollback segment RBS01 offline; alter rollback segment RBS02 offline; ... alter rollback segment RBS30 offline; (3.2.4)删除当前的rollback segment(system rollback segment除外) 利用以下SQL生成drop rollback segment的SQL: select 'drop rollback segment '||segment_name||';' from dba_rollback_segs a where a.tablespace_name = 'RBS'; 生成出来的SQL如下: drop rollback segment RBS01; drop rollback segment RBS02; ... drop rollback segment RBS30; 验证已经全部drop了; select 'drop rollback segment '||segment_name||';' from dba_rollback_segs a where a.tablespace_name = 'RBS'; (3.2.5)删除当前的rollback表空间 SQL>Alter tablespace RBS offline; SQL>select owner,segment_name,segment_type,bytes from dba_segments where tablespace_name = 'RBS' OWNER SEGMENT_NAME ------------------------------ --------------------------------------------------------------------------------- SEGMENT_TYPE BYTES ------------------ ---------- SYS 6.36532 SPACE HEADER 81920 SQL>drop tablespace rbs; (3.2.6)创建SMU的表空间APPS_UNDOTS(运行5分钟) create undo tablespace APPS_UNDOTS1 datafile '/u05/oracle/PROD/proddata/rbs01.dbf' size 1500M reuse extent management local; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs02.dbf' size 1500M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs03.dbf' size 1500M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs04.dbf' size 1500M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs05.dbf' size 1500M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs06.dbf' size 1500M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs07.dbf' size 2000M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs08.dbf' size 2000M reuse; alter tablespace APPS_UNDOTS1 add datafile '/u05/oracle/PROD/proddata/rbs09.dbf' size 2000M reuse; (3.2.7)修改数据库初始化参数文件: 添加: undo_management = AUTO undo_retention = 1800 undo_suppress_errors = FALSE undo_tablespace = APPS_UNDOTS1 event="10932 trace name context level 32768" event="10943 trace name context level 16384" event="10933 trace name context level 512" 修改: log_buffer = xxxx(可选) 删除: rollback_segments = ... (3.2.8)重新启动数据库(运行10分钟). 需要断开所有SQLPLUS连接 (3.3)执行升级到9.2.0.8的后续步骤 (本步骤的补丁放在/u03/oracle/orasup/9iR2/9208Patches下) (3.3.1)搜集数据字典统计量(运行10分钟) SQL> execute dbms_stats.gather_schema_stats('SYS',cascade=>TRUE,degree=>20); (3.3.2)启动9i RDBMS Listener。 (3.3.3)检查owapatch.sql已经成功运行,否则需要参考390993.1重新运行。在8.1.7.3下,owa版本是3.0.0.0.4。 SQL> select owa_util.get_version from dual; GET_VERSION -------------------------------------------------------------------------------- 3.0.9.8.7 |
(二)9.2.0.8升级11.2.0.3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
(1)数据库软件环境准备 (1.1)11.2.0.3安装介质和补丁准备 (1.1.1)准备11.2.0.3 for HP-UX安装介质p10404530_112030_HPUX-IA64。(7个安装包,其实安装数据库的只有第一个和第二个包) (1.1.2)下载database upgrade for EBS相关补丁。 (1.2)运行runInstaller安装11.2.0.3软件 在数据库服务器上以orcl11g新用户安装oracle database 11.2.0.3: (1.2.1)复用原来9i用户(orcl9i)的环境变量,将/paic/dev/oracle/11g/orcl9i/prof_myst拷贝至/paic/dev/oracle/11g/orcl11g,将里面关于9i路径换成11g的路径。改变其权限为755。 运行. prof_myst加载环境变量。 (1.2.2)备份并修改oracle inventory目录的指向。备份/var/opt/oracle/oraInst.loc文件之后,修改其里面的内容,将 invenroty_loc=/paic/dev/oracle/11g/orcl9i/app/oracle/oraInventory 改成 invenroty_loc=/paic/dev/oracle/11g/orcl11g/app/oracle/oraInventory (1.2.3)解压安装介质。 (1.3.4)登录堡垒机进行图形化安装。在堡垒机(terminalkf4 10.11.77.77),在堡垒机运行ReflectionX,点击settings->window->display number,记下端口号。 (1.3.5)启动SSH Secure Shell client,export DISPLAY=<堡垒机IP>:port(注: 此端口号即为在上一步记下的端口号) (1.3.6)检查环境变量之后,运行./runInstaller -jreLoc /opt/java1.5/jre (安装耗时约2小时) (1.3.7)用root权限用户运行root.sh脚本完成11.2.0.3数据库软件的安装。 (1.3.8)安装example(EBS要求强制安装,安装耗时约30分钟): cd examples ./runInstaller -jreLoc /opt/java1.5/jre (1.3.9)创建$ORACLE_HOME/nls/data/9idata目录,由于需要运行perl脚本,因此要先加载perl的环境变量 export environment: export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export PATH=$ORACLE_HOME/perl/bin:$PATH export PERL5LIB=$ORACLE_HOME/perl/lib/5.10.0:$ORACLE_HOME/perl/lib/site_perl/5.10.0 运行 cd $ORACLE_HOME/nls/data/old/ perl cr9idata.pl 修改环境变量的文件/paic/dev/oracle/11g/orcl11g/prof_myst,添加如下一行: export ORA_NLS10=$ORACLE_HOME/nls/data/9idata (1.4)运行EBS相关的patch脚本 (1.4.1)需要安装EBS相关patch为: 9858539 12942119 12960302 12985184 13001379 13004894 13258936 13366268 注: (a)上述补丁为for 11.2.0.3的补丁,请在11.2.0.3的环境变量下执行上述补丁。 (b)用opatch apply安装上述patch之后,先不需要执行post install的脚本。等数据库完成升级之后再执行。 (1.4.2)解压上述patch包 (1.4.3)进入各个目录之后,用opatch apply安装上述补丁。 (1.4.3)运行完成后,检查上述补丁是否已经安装:opatch lsinventory (2)原数据库升级前的准备工作 (2.1)9i环境升级前准备 (2.1.1)备份数据库,数据库主目录(ORACLE_HOME),和orInventory目录。测试环境为clone所得,因此暂不做上述备份。 (2.1.2)关闭application server和数据库侦听,关闭时,记下是否用了侦听的默认名LISTENER,在本环境中,侦听名为myst。 ps –ef |grep tns lsnrctl stop myst (2.1.3)删除SYS.ENABLED$INDEXES: SQL> drop table sys.enabled$indexes (2.1.4)取消db vault(该环境无db vault,无需执行) (2.1.5)消除数据库SYSTEM和SYS中的重复对象: set pause off set heading off set pagesize 0 set feedback off set verify off spool dropsys.sql select 'DROP ' || object_type || ' SYSTEM.' || object_name || ';' from dba_objects where object_name||object_type in (select object_name||object_type from dba_objects where owner = 'SYS') and owner = 'SYSTEM'; spool off exit 在该环境中,上述语句的输出结果为: 'DROP'||OBJECT_TYPE||'SYSTEM.'||OBJECT_NAME||';' -------------------------------------------------------------------------------- DROP TABLE SYSTEM.AQ$_SCHEDULES; DROP INDEX SYSTEM.AQ$_SCHEDULES_PRIMARY; DROP PACKAGE SYSTEM.DBMS_REPCAT_AUTH; DROP PACKAGE BODY SYSTEM.DBMS_REPCAT_AUTH; DROP TABLE SYSTEM.PLAN_TABLE; 注:以下对象可以重复: OBJECT_NAME OBJECT_TYPE ------------------------------ ------------------- AQ$_SCHEDULES TABLE AQ$_SCHEDULES_PRIMARY INDEX DBMS_REPCAT_AUTH PACKAGE DBMS_REPCAT_AUTH PACKAGE BODY 因此,我们只需执行DROP TABLE SYSTEM.PLAN_TABLE; (2.1.6)确认数据库已经升级到9.2.0.8。根据oracle的升级路线,oracle database 可以从9.2.0.8 升级至11gR2. (2.1.7)将oracle 11gR2主目录下,rdbms/admin/utlu112i.sql拷贝至/tmp目录,使得9i的数据库可以运行该脚本。在9i数据库中运行: $ sqlplus '/ as sysdba' SQL> spool upgrade_info.log SQL> @<script_path>/utlu112i.sql SQL> spool off SQL> (2.1.9)查看upgrade_info.log中关于升级需要修改的问题。包括Logfiles,Tablespaces,Update Parameters,Deprecated Parameters,Obsolete Parameters,Components等问题。根据列出的情况做修正。 如在该环境中system用户的默认表空间为tools,需要将其改回至system: WARNING: --> SYSTEM schema default tablespace has been altered. .... The SYSTEM schema default tablespace is currently set to TOOLS. .... Prior to upgrading your database please reset the .... SYSTEM schema default tablespace to SYSTEM using the command: .... ALTER USER SYSTEM DEFAULT TABLESPACE SYSTEM SQL> ALTER USER SYSTEM DEFAULT TABLESPACE SYSTEM; SQL> SELECT username, default_tablespace 2 FROM dba_users 3* WHERE username in ('SYS','SYSTEM') SQL> / SYS SYSTEM SYSTEM SYSTEM 2 rows selected. SQL> 如在该环境中存在分布式事务悬挂的问题,需要purge local transaction: WARNING: --> There are outstanding unresolved distributed transactions. .... Resolve outstanding distributed transactions prior to upgrade. SQL> select LOCAL_TRAN_ID from dba_2pc_pending; LOCAL_TRAN_ID ------------------------------ 132.31.43459 32.73.366087 2 rows selected. SQL> 注:分布式事务的清理,将在下面第19步详细介绍。 (2.1.9)运行dbupgdiag.sql脚本。显示失效对象。 (2.1.10)根据所显示的失效对象,运行utlrp脚本编译9i数据库中失效的对象,直到数量不再减少。 (2.1.11)升级到11.2.0.3之后,数据库用原来赋予connect权限的用户只拥有create session权限,找出这些用户和connect权限所拥有的其他权限: SELECT grantee FROM dba_role_privs WHERE granted_role = 'CONNECT' and grantee NOT IN ( 'SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP', 'LOGSTDBY_ADMINISTRATOR', 'ORDSYS', 'ORDPLUGINS', 'OEM_MONITOR', 'WKSYS', 'WKPROXY', 'WK_TEST', 'WKUSER', 'MDSYS', 'LBACSYS', 'DMSYS', 'WMSYS', 'EXFSYS', 'SYSMAN', 'MDDATA', 'SI_INFORMTN_SCHEMA', 'XDB', 'ODM'); 在该环境中,执行结果为: GRANTEE ------------------------------ APPS .... SPOTLIGHT SQL> SELECT GRANTEE,PRIVILEGE FROM DBA_SYS_PRIVS WHERE GRANTEE ='CONNECT' 在该环境中,执行结果为: GRANTEE PRIVILEGE ------------------------------ ---------------------------------------- CONNECT CREATE VIEW CONNECT CREATE TABLE CONNECT ALTER SESSION CONNECT CREATE CLUSTER CONNECT CREATE SESSION CONNECT CREATE SYNONYM CONNECT CREATE SEQUENCE CONNECT CREATE DATABASE LINK 8 rows selected. SQL> 将这些权限显式的授权给对应用户: grant create view,create table,alter session,create CLUSTER,CREATE SYNONYM,CREATE SEQUENCE,CREATE DATABASE LINK to APPS ; .... SQL> grant create view,create table,alter session,create CLUSTER,CREATE SYNONYM,CREATE SEQUENCE,CREATE DATABASE LINK to SPOTLIGHT ; (2.1.12)在9i中,dblink的密码以明文保存在数据库中,而11.2.0.3不以明文保存。记下dblink的创建语句,以防重建dblink。 SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10) ||DECODE(U.NAME,'PUBLIC',Null, 'SYS','',U.NAME||'.')|| L.NAME||chr(10) ||'CONNECT TO ' || L.USERID || ' IDENTIFIED BY "'||L.PASSWORD||'" USING '''||L.HOST||'''' ||chr(10)||';' TEXT FROM SYS.LINK$ L, SYS.USER$ U WHERE L.OWNER# = U.USER#; (2.1.13)记下当前的time zone: select TZ_VERSION from registry$database; 在该环境中,执行结果为: SQL> select TZ_VERSION from registry$database; TZ_VERSION ---------- 1 SQL> (2.1.14)记下当前的字符集: select value from NLS_DATABASE_PARAMETERS where parameter = 'NLS_NCHAR_CHARACTERSET'; 在该环境中,执行结果为: VALUE -------------------------------------------------------------------------------- AL16UTF16 SQL> (2.1.15)按照upgrade_info.log的要求,收集相关schema的统计信息 SQL> exec dbms_stats.create_stat_table('SYSTEM','STAT_BAK20120913'); PL/SQL procedure successfully completed. EXECUTE dbms_stats.EXPORT_SCHEMA_STATS('CTXSYS','STAT_BAK20120913',NULL,'SYSTEM'); ... EXECUTE dbms_stats.EXPORT_SCHEMA_STATS('SYSTEM','STAT_BAK20120913',NULL,'SYSTEM'); SQL> SQL> EXECUTE dbms_stats.gather_schema_stats('CTXSYS',options=>'GATHER' - ,estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE - ,method_opt=>'FOR ALL COLUMNS SIZE AUTO' - ,cascade=>TRUE); ... SQL> SQL> EXECUTE dbms_stats.gather_schema_stats('SYSTEM',options=>'GATHER' - ,estimate_percent=>DBMS_STATS.AUTO_SAMPLE_SIZE - ,method_opt=>'FOR ALL COLUMNS SIZE AUTO' - ,cascade=>TRUE); (2.1.16)检查数据字典是否有不可用的对象,生成并运行analyze脚本:(耗时1小时) Set verify off Set space 0 Set line 120 Set heading off Set feedback off Set pages 1000 Spool analyze.sql SELECT 'Analyze cluster "'||cluster_name||'" validate structure cascade;' FROM dba_clusters WHERE owner='SYS' UNION SELECT 'Analyze table "'||table_name||'" validate structure cascade;' FROM dba_tables WHERE owner='SYS' AND partitioned='NO' AND (iot_type='IOT' OR iot_type is NULL) UNION SELECT 'Analyze table "'||table_name||'" validate structure cascade into invalid_rows;' FROM dba_tables WHERE owner='SYS' AND partitioned='YES'; spool off $ sqlplus "/ as sysdba" SQL> @$ORACLE_HOME/rdbms/admin/utlvalid.sql SQL> @analyze.sql (2.1.17)检查最近一次的snapshot是否执行成功: SELECT DISTINCT(TRUNC(last_refresh)) FROM dba_snapshot_refresh_times; (2.1.18)检查所以数据文件不是处于backup模式: SELECT * FROM v$recover_file; SELECT * FROM v$backup WHERE status != 'NOT ACTIVE'; (2.1.19)检查数据库中是否还存在分布式事务悬挂: SQL> select * from dba_2pc_pending; 如存在记录,且状态在collecting状态,可用以下方面清除: SQL> EXECUTE dbms_transaction.purge_lost_db_entry(''); SQL> COMMIT; 在该环境中,上述语句的执行结果为: SQL> select LOCAL_TRAN_ID from dba_2pc_pending; LOCAL_TRAN_ID ------------------------------ 132.31.43459 32.73.366087 2 rows selected. SQL> 在进行purge的时候遭遇ora-30019报错: SQL> exec dbms_transaction.PURGE_LOST_DB_ENTRY('132.31.43459'); BEGIN dbms_transaction.PURGE_LOST_DB_ENTRY('132.31.43459'); END; * ERROR at line 1: ORA-30019: Illegal rollback Segment operation in Automatic Undo mode ORA-06512: at "SYS.DBMS_TRANSACTION", line 65 ORA-06512: at "SYS.DBMS_TRANSACTION", line 85 ORA-06512: at line 1 SQL> exec dbms_transaction.PURGE_LOST_DB_ENTRY('32.73.366087'); BEGIN dbms_transaction.PURGE_LOST_DB_ENTRY('32.73.366087'); END; * ERROR at line 1: ORA-30019: Illegal rollback Segment operation in Automatic Undo mode ORA-06512: at "SYS.DBMS_TRANSACTION", line 65 ORA-06512: at "SYS.DBMS_TRANSACTION", line 85 ORA-06512: at line 1 此时,需要执行alter session set "_smu_debug_mode"=4;之后在执行: SQL> alter session set "_smu_debug_mode"=4; SQL> SQL> SQL> commit; SQL> exec dbms_transaction.PURGE_LOST_DB_ENTRY('132.31.43459'); SQL> commit; SQL> SQL> exec dbms_transaction.PURGE_LOST_DB_ENTRY('32.73.366087'); SQL> commit; SQL> SQL> SQL> SQL> select * from dba_2pc_pending; no rows selected SQL> (2.1.20)将job broken。 (2.1.21)检查audit对象是否属于sys用户,是否表空间为system: SQL> SELECT owner,tablespace_name FROM dba_tables WHERE table_name='AUD$'; 在该环境中,aud$表及其索引所在的表空间不在system中,需要将其移至system: SQL> l 1 SELECT owner,tablespace_name 2 FROM dba_tables 3* WHERE table_name='AUD$' SQL> SQL> SQL> / SYS AUDDATA 1 row selected. SQL> SQL> c/index_name/index_name,tablespace_name; 1* select index_name,tablespace_name from dba_indexes where table_name='AUD$' SQL> / I_AUD1 AUDDATA 1 row selected. SQL> SQL> alter table sys."AUD$" move tablespace system; Table altered. SQL> SQL> alter index I_AUD1 rebuild tablespace system; Index altered. SQL> 注:AUD$表的数据量大会影响升级时间,如有可能,请清理AUD$表,参考文档ID 73408.1 (2.1.22)拷贝9i路径下的listener.ora文件到11g目录,修改文件里面的ORACLE_HOME目录,保留其原理的侦听名和端口号。 (2.1.23)确认在11g的初始化文件中,已经将过期的参数清除,已经用DIAGNOSTIC_DEST 替换了USER_DUMP_DEST, BACKGROUND_DUMP_DEST. COMPATIBLE参数至少设置成10.0.0以上。 (3)升级9.2.0.8数据库至11.2.0.3 (3.1)升级前环境检查 (3.1.1)export环境变量: $ export ORACLE_HOME=<location of Oracle 11.2> $ export PATH=$ORACLE_HOME/bin:$PATH $ export ORACLE_BASE=<Oracle_Base set during installation> (3.1.2)修改/etc/oratab文件: /etc/oratab 注释掉原来9i的ORACLE_HOME和instance的项目,添加11g的ORACLE_HOME #*:<9i_ORACLE_HOME>:N #<instance_name>:<9i_ORACLE_HOME>:N *:<11g_ORACLE_HOME>:N (3.1.3)记下9i数据库的数据文件,临时文件,日志文件,控制文件的路径,关闭9i数据库,将其属主从orcl9i:dba改为orcl11g:dba Select file_name from dba_data_files; Select file_name from dba_temp_files; Select member from v$logfile; Select * from v$controlfile; (3.2)升级数据库 (3.2.1)创建SYSAUX表空间 $ cd $ORACLE_HOME/rdbms/admin $ sqlplus "/ as sysdba" SQL> startup UPGRADE SQL> CREATE TABLESPACE SYSAUX DATAFILE '<location>/sysaux01.dbf' SIZE 500M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ONLINE; (3.2.2)升级数据字典(约耗时2.5小时): SQL> set echo on SQL> SPOOL upgrade.log SQL> @catupgrd.sql SQL> spool off (3.2.3)运行utlu112s脚本 $ sqlplus "/as sysdba" SQL> STARTUP SQL> @utlu112s.sql (3.2.4)运行catuppst.sql脚本 @catuppst.sql (3.2.5)再次运行utlrp脚本,编译失效对象。(升级完后第一次运行utlrp脚本,约耗时2.5小时) (3.2.6)运行dbupgdiag.sql脚本,检查失效对象。针对失效对象,多次运行utlrp脚本进行编译,直至失效对象数量不再减少。 SQL> @?/rdbms/admin/utlrp.sql (3.2.7)启动11g的数据库侦听。注意用原来的侦听名启动。 (3.2.8)修改/etc/oratab文件,加上11g的instance,使其随系统启动: 在/etc/oratab添加如下行: <SID>:<11g_ORACLE_HOME>:Y 修改原来 *:<11g_ORACLE_HOME>:N 为 *:<11g_ORACLE_HOME>:Y (3.2.9)检查timezone是否有原来一致: SELECT version FROM v$timezone_file; (3.2.10)再次检查数据字典结构:(约耗时1小时) Set verify off Set space 0 Set line 120 Set heading off Set feedback off Set pages 1000 Spool analyze.sql SELECT 'Analyze cluster "'||cluster_name||'" validate structure cascade;' FROM dba_clusters WHERE owner='SYS' UNION SELECT 'Analyze table "'||table_name||'" validate structure cascade;' FROM dba_tables WHERE owner='SYS' AND partitioned='NO' AND (iot_type='IOT' OR iot_type is NULL) UNION SELECT 'Analyze table "'||table_name||'" validate structure cascade into invalid_rows;' FROM dba_tables WHERE owner='SYS' AND partitioned='YES'; spool off This creates a script called analyze.sql. Now execute the following steps: $ sqlplus "/ as sysdba" SQL> @$ORACLE_HOME/rdbms/admin/utlvalid.sql SQL> @analyze.sql (3.3)升级后脚本执行 (3.3.1)执行EBS相关的patch脚本。 在之前用opatch apply对11.2.0.3 的数据库打了以下关于EBS的patch: 9858539 12942119 12960302 12985184 13001379 13004894 13258936 13366268 上述patch进行opatch apply之后,按照要求,需要在升级完成之后在执行post install操作。进patch的相关目录,运行脚本。 注:13001379 和13366268两个补丁不需要运行post install脚本,因为在升级数据库的过程中,被调用执行了。 For 9858539 post install: cd $ORACLE_HOME/rdbms/admin sqlplus '/ as sysdba' @@catnomtt.sql @@catnomta.sql @@dbmsmeta.sql @@dbmsmeti.sql @@dbmsmetu.sql @@dbmsmetb.sql @@dbmsmetd.sql @@dbmsmet2.sql @@catmeta.sql @@prvtmeta.plb @@prvtmeti.plb @@prvtmetu.plb @@prvtmetb.plb @@prvtmetd.plb @@prvtmet2.plb @@catmet2.sql For 13258936 post install: cd $ORACLE_HOME/ctx/admin/ctxpatch/ sqlplus / as sysdba @ctxpatch11203.sql (3.3.2)运行EBS相关的patch 4247037。该patch需要在数据库升级完成之后执行。 cd 4247037 opatch apply For 4247037 post install: sqlplus / as sysdba @catmgdidcode (3.3.3)安装olap(约耗时20分钟) 查看是否返回记录: select comp_id from dba_registry where comp_id='AMD'; 如果返回0行记录,说明没有安装olap,需要安装olap @?/olap/admin/olap.sql SYSAUX TEMP (3.3.4)运行adgrants脚本 脚本从EBS处获得,路径为$APPL_TOP/admin/adgrants.sql,拷贝至数据库服务器后运行: @adgrants.sql 提示输入APPS schema name。 (3.3.5)为CTXSYS授权。 脚本从EBS处获得,路径为$AD_TOP/patch/115/sql/adctxprv.sql,拷贝至数据库服务器后运行: sqlplus apps/[APPS password] @adctxprv.sq [SYSTEM password] CTXSYS (3.3.6)设置CTXSYS变量: $ sqlplus "/ as sysdba" SQL> exec ctxsys.ctx_adm.set_parameter('file_access_role', 'public'); (3.3.7)运行autoconfig(有EBS端执行) (3.3.8)执行adstats.sql脚本: $ sqlplus "/ as sysdba" SQL> shutdown normal; SQL> startup restrict; SQL> @adstats.sql SQL> shutdown normal; SQL> startup; SQL> exit; (3.3.9)根据EBS要求,根据数据库主机的负载情况,酌情修改初始化文件,重启数据库。 #Parameter for EBS: db_file_multiblock_read_count=8 job_queue_processes= 32 parallel_max_servers = 32 pga_aggregate_target = 4G db_file_optimizer_read_count set to NULL java_pool_size=51300000 recyclebin=OFF _disable_fast_validate=TRUE shared_pool_size = 5G shared_pool_reserved_size = 500M utl_file_dir = /volume/r06/tmp_hrvs processes = 1500 sga_target = 12g sessions = 3000 event = "44951 trace name context forever, level 1024" #(avoid enq: HW contention) db_writer_processes = 6 log_buffer = 102400000 lock_sga = TRUE |
参考文档:
主文档:
1 2 |
Note 1152016.1 Master Note For Oracle Database Upgrades and Migrations Note 421191.1 Complete checklist for manual upgrades of Oracle databases from any version to any version on any platform (documents only from 7.3.x>>8.0.x>>8.1.x>>9.0.x>>9.2.x>>10.1.x>>10.2.x>>11.1.x>>11.2.x) |
手工升级文档:
1 2 3 4 5 6 |
Note 837570.1 Complete Checklist for Manual Upgrades to 11gR2 Note.1276368.1 Complete checklist for out-of-place manual upgrade from 11.2.0.1 to 11.2.0.2 Note 429825.1 Complete Checklist for Manual Upgrades to 11gR1 Note 316889.1 Complete Checklist for Manual Upgrades to 10gR2 Note 263809.1 Complete checklist for manual upgrades to 10gR1 (10.1.0.x) Note 159657.1 Complete Upgrade Checklist for Manual Upgrades from 8.X / 9.0.1 to Oracle9iR2 (9.2.0) |
EBS升级(连带数据库升级)文档:
1 2 |
Note 881505.1 Interoperability Notes Oracle EBS 11i with Oracle Database 11gR2 (11.2.0) Note 1058763.1 Interoperability Notes EBS R12 with Database 11gR2 |