oracle Install

手动升级9i-10g全步骤

October 29, 2011 migration, oracle 3 comments

某局威武,升级弄完都到凌晨6点了 居然还要搭DG ,下面记录这次的升级过程(9.2.0.7-10.2.0.4)

迁移步骤:

1 首先安装10g的数据库软件,基于当时的AIX情况,由于系统是通过OS升级重新导入到P6 570上的需要重新开启AIO,数据库版本为9.2.0.7 需要再打一个bos.cifs.**补丁

2 copy 10g ORACLE_HOME/rdbms/admin 下的脚本
ORACLE_HOME/rdbms/admin/utlu102i.sql /tmp/utlu102i.sql
ORACLE_HOME/rdbms/admin/utltzuv2.sql /tmp/utltzuv2.sql

3 收集数据库信息

SQL> spool Database_Info.log
SQL> @utlu102i.sql
SQL> spool off

检查各项参数:(Database,Logfiles,Tablespaces,Update Parameters,Deprecated Parameters,Obsolete Parameters,Components,Miscellaneous Warnings,SYSAUX Tablespace

3 检查角色

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’, ‘OLAPDBA’, ‘OLAPSVR’, ‘OLAP_USER’,
‘OLAPSYS’, ‘EXFSYS’, ‘SYSMAN’, ‘MDDATA’,
‘SI_INFORMTN_SCHEMA’, ‘XDB’, ‘ODM’);

由于9i的connect role具有如下角色:

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

10g 的connect 仅仅具有 create session 其他privilege需要手动grant

4 创建dblink 脚本 (跳过)

5 检查timestamp 数据类型

$ sqlplus ‘/as sysdba’

SQL> spool TimeZone_Info.log
SQL> @utltzuv2.sql
SQL> spool off

如果 timezone_info.log 指出timezone格式不支持 如下操作:

For example, user scott has a table tztab:

create table tztab(x number primary key, y timestamp with time zone);
insert into tztab values(1, timestamp ”);

Before upgrade, you can create a table tztab_back. Note column y here is defined as VARCHAR2 to preserve the original value.

create table tztab_back(x number primary key, y varchar2(256));
insert into tztab_back select x,
to_char(y, ‘YYYY-MM-DD HH24.MI.SSXFF TZR’) from tztab;
After upgrade, you need to update the data in the table tztab using the value in tztab_back.

update tztab t set t.y = (select to_timestamp_tz(t1.y,
‘YYYY-MM-DD HH24.MI.SSXFF TZR’) from tztab_back t1 where t.x=t1.x);

6 NLS_NCHAR_CHARACTERSET 跳过 (8i-10g 需要检查此项)

7 收集系统用户信息 (9i没有dictionary 信息收集)
sqlplus ‘/as sysdba’

SQL>spool gdict

SQL>grant analyze any to sys;

exec dbms_stats.gather_schema_stats(‘WMSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘MDSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec 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>exec dbms_stats.gather_schema_stats(‘XDB’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘WKSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘LBACSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘OLAPSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘DMSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘ODM’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘ORDSYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘ORDPLUGINS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘SI_INFORMTN_SCHEMA’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘OUTLN’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘DBSNMP’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘SYSTEM’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);
SQL>exec dbms_stats.gather_schema_stats(‘SYS’,options=>’GATHER’,
estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

SQL>spool off

8 检查数据库对象状态

spool invalid_pre.lst
select substr(owner,1,12) owner,
substr(object_name,1,30) object,
substr(object_type,1,30) type, status from
dba_objects where status <> ‘VALID’;
spool off

重新编辑invalid objects
$ sqlplus ‘/as sysdba’
SQL> @?/rdbms/admin/utlrp.sql

If you are upgrading from Oracle9iR2 (9.2), verify that the view dba_registry contains data. If the view is empty, run the following scripts from the 9.2 home:

$ sqlplus ‘/as sysdba’
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/rdbms/admin/utlrp.sql

9 Check for corruption in the dictionary useing the following commands in SQL*Plus connected as sys:

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

analyze.sql 不应该返回任何错误

10 确保所有物化视图刷新完毕,并且所有刷新停止

$ sqlplus ‘/ as sysdba’
SQL> select distinct(trunc(last_refresh)) from dba_snapshot_refresh_times;

11 停止监听

$ lsnrctl
LSNRCTL> stop

确保没有datafile 需要recover

$ sqlplus ‘/ as sysdba’
SQL> select * from v$recover_file;

12 确保数据库没有datafile在backup状态

SQL> select * from v$backup where status!=’NOT ACTIVE’;

13 查看是否存在分布式事务

SQL> select * from dba_2pc_pending;

14 关闭所有jobs

15 确保system sys用户的默认表空间为system

SQL> select username, default_tablespace from dba_users
where username in (‘SYS’,’SYSTEM’);
To modify use:

SQL> alter user sys default tablespace SYSTEM;
SQL> alter user system default tablespace SYSTEM;

16 查看aud$是否启用

SQL> select tablespace_name from dba_tables where table_name=’AUD$’;
If the AUD$ table exists, and is in use, upgrade performance can be effected depending on the number of records in the table.

Note.979942.1 Ext/Pub Database upgrade appears to have halted at SYS.AUD$ Table

这次升级直接select count (*) from aud$ 返回值为0 直接 继续下一步

17 Note down where all control files are located.

SQL> select * from v$controlfile;

18 If table XDB.MIGR9202STATUS exists in the database, drop it before upgrading the database
(to avoid the issue described in Note:356082.1)

19 Shutdown the database.

$ sqlplus ‘/as sysdba’
SQL> shutdown immediate;

20 备份数据库

21 copy pfile from 9i $ORACLE_HOME to 10g $ORACLE_HOME

Make sure the PGA_AGGREGATE_TARGET initialization parameter is set to
at least 24 MB.

Ensure that the SHARED_POOL_SIZE and the LARGE_POOL_SIZE are at least 150Mb

Make sure the JAVA_POOL_SIZE initialization parameter is set to at least 150 MB.

AQ_TM_PROCESSES=0 and JOB_QUEUE_PROCESSES=0 for the duration of the upgrade

If you have defined an UNDO tablespace, set the parameter UNDO_MANAGEMENT=AUTO

虽然在10g上通过startup upgarde oracle会自动禁止这些参数,但是这里还是提前设置
并且可以参照上面的database_info信息进行调整

22 检查剩余空间是否充足,确保archive归档空间

23 检查nls_lang-> database nls_characterset

24 cp listener* tnsnames* to 10g $ORACLE_HOME

25 创建密码文件

26 Update the oratab entry, to set the new ORACLE_HOME and disable automatic startup:

SID:ORACLE_HOME:N

27 确定环境变量 注意unset TNS_ADMIN ORA_NLS33 chang to ORA_NLS10

export ORA_NLS10= /u01/finprod/finproddb/10.2/db_1/nls/data/9idata

/u01/finprod/finproddb/10.2/db_1/perl/bin/perl

oraprod(DATABASE)@nbrbwdev5:perl $ORACLE_HOME/nls/data/old/cr9idata.pl
Creating directory /u01/finprod/finproddb/10.2/db_1/nls/data/9idata …
Copying files to /u01/finprod/finproddb/10.2/db_1/nls/data/9idata…
Copy finished.

28 建立sysaux 表空间 (注意 本地管理 自动段空间管理 不然后面跑脚本会报错)
CREATE TABLESPACE sysaux DATAFILE ‘xxxx sysaux01.dbf’
SIZE 500M REUSE
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO
ONLINE;

29 开始升级
SQL> spool upgrade.log
SQL> @catupgrd.sql

30 查看组件状态

SQL> @utlu102s.sql TEXT

SQL> select comp_name, status, version from dba_registry;

31 Restart the database:

SQL> shutdown immediate (DO NOT use “shutdown abort” !!!)
SQL> startup restrict

32 如果开启Oracle Label Security policies

SQL> @olstrig.sql

此库没有采用跳过

33 Run utlrp.sql to recompile any remaining stored PL/SQL and Java code.

SQL> @utlrp.sql

If there are still objects which are not valid after running the script run the following:

spool invalid_post.lst
Select substr(owner,1,12) owner,
substr(object_name,1,30) object,
substr(object_type,1,30) type, status
from
dba_objects where status <>‘VALID’;
spool off
Now compare the invalid objects in the file ‘invalid_post.lst’ with the invalid objects in the file ‘invalid_pre.lst’ you created in step 9.

NOTE: If you have upgraded from version 9.2 to version 10.2 and find that the following views are invalid, the views can be safely ignored (or dropped):

SYS.V_$KQRPD
SYS.V_$KQRSD
SYS.GV_$KQRPD
SYS.GV_$KQRSD

Invalid x_$ Objects After Upgrade [ID 361757.1]

ERROR IN CATUPGRD: ORA-00904 IN DBMS_SQLPA [ID 565600.1]

34 开启数据库 ,开启lsnrctl ,启用rbo 使用dbms_stats.gather_database_stats收集信息,开启rbo 修改compatible ,观察数据库性能35 修改数据库字符集由于csscan扫描转换成zhs16gbk某些lob字段可能产生乱码 所以放弃csalter转换字符集方案,并且不存在超集,子集关系 所以采用强制转换方式:
SQL>STARTUP MOUNT;
SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL>ALTER DATABASE OPEN;
SQL>ALTER DATABASE CHARACTER SET INTERNAL_USE zhs16gbk;
SQL>shutdown immediate;
SQL>startup

Related posts:

Invalid x_$ Objects After Upgrade [ID 361757.1]
ERROR IN CATUPGRD: ORA-00904 IN DBMS_SQLPA [ID 565600.1]
lock-held-by-in-doubt-distributed-transaction

ORACLE – 9i to 10g database Upgrade using DBUA.

October 17, 2011 migration, oracle No comments

Purpose of this document is to show a complete 9i to 10g upgrade of an Oracle database on

AIX 5L using DBUA ( Database Uprgrade Assistant)
3.2 TECHNICAL SOLUTION
10g upgrade from 9.2.06 to 10.2.0.3 for any database -:
Check the init.ora parameter file in the 9I ORACLE_HOME/dbs
Make sure there is no “If event=”30084 trace name context forever, level1”
defined in pfile of spfile.
LOGIN TO NEW PSERIES MACHINE AS oraprod user.

Important : Issue unix command unset TNS_ADMIN

export ORACLE_HOME=/u01/finprod/finproddb/10.2/db_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin:/usr/sbin:/usr/bin/
export PERL5LIB=$ORACLE_HOME/perl/lib/5.8.3:$ORACLE_HOME/perl/lib/site_pearl/5.8.3
export LIBPATH=$ORACLE_HOME/lib:/usr/dt/lib:/usr/openwin/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/dt/lib:/usr/openwin/lib:$ORACLE_HOME/ctx/lib
export ORA_NLS10=/u01/finprod/finproddb/10.2/db_1/nls/data/9idata
unset TNS_ADMIN

To make sure run the following to ascertain correct paths below.
echo $ORACLE_HOME
echo $PATH
echo $PERL5LIB
echo $LIBPATH
echo $LD_LIBRARY_PATH
echo $NLS_010

Firstly create the /NLS/DATA/9i data directory.

# DESCRIPTION
The script copies every nlb files under $ORACLE_HOME/nls/data and
for customer needs to revert back to 9i locale behavior.

Make sure perl utility being used points to the 10g oracle environment.

Make sure there is no reference to the old 9i environment in the $PATH or this command will
fail as the old version of perl is picked up.

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin:/usr/sbin:/usr/bin/

$ which perl
/u01/finprod/finproddb/10.2/db_1/perl/bin/perl
$
oraprod(DATABASE)@nbrbwdev5:perl $ORACLE_HOME/nls/data/old/cr9idata.pl
Creating directory /u01/finprod/finproddb/10.2/db_1/nls/data/9idata …
Copying files to /u01/finprod/finproddb/10.2/db_1/nls/data/9idata…
Copy finished.

Please reset environment variable ORA_NLS10 to /u01/finprod/finproddb/10.2/db_1/nls/data/9idata

export ORA_NLS10=/u01/finprod/finproddb/10.2/db_1/nls/data/9idata

oraprod(DATABASE)@nbrbwdev5:echo $ORA_NLS10
/u01/finprod/finproddb/10.2/db_1/nls/data/9idata

Now configure listener for 10g home

First unset TNS_ADMIN so that the old 9i environment is unset.

unset TNS_ADMIN

oraprod(DATABASE)@nbrbwdev5:cd $ORACLE_HOME/bin (10g ORACLE_HOME)

oraprod(DATABASE)@nbrbwdev5:export DISPLAY=10.254.101.25:0.0

oraprod(DATABASE)@nbrbwdev5:ls netca
netca
oraprod(DATABASE)@nbrbwdev5:./netca

Oracle Net Services Configuration:
$ORACLE_HOME/nls/data/old to directory $ORACLE_HOME/nls/data/9idata




Use same listener name as in old machine….FINPROD was used here and not LISTENER as above.



Message on screen :

Oracle Net Services Configuration:
Configuring Listener:FINPROD
Default local naming configuration complete.
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/finprod/finproddb/10.2/db_1/bin/lsnrctl start FINPROD
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0

SHUTDOWN LISTENER

lsnrctl stop FINPROD ( Database name )

Now start the PRE-UPGRADE STEPS:

Important : START THE DATABASE in the 9i environment and not from the new 10g environment.

If you haven’t changed your .profile and are still using the 9i .profile , just log into a new session so that the old 9i environment is picked up.

oraprod(DATABASE)@nbrbwdev5:sqlplus “sys as sysdba”

SQL*Plus: Release 9.2.0.6.0 – Production on Thu Feb 21 11:57:55 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter password:
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 2149552280 bytes
Fixed Size 745624 bytes
Variable Size 1879048192 bytes
Database Buffers 268435456 bytes
Redo Buffers 1323008 bytes
Database mounted.
Database opened.
SQL>

STEPS FOR UPGRADING THE DATABASE TO 10G RELEASE 2
=================================================

Preparing to Upgrade
——————–

In this section all the steps need to be performed to the previous version of Oracle.

Please note that the database must be running in normal mode in the old release- i.e 9i environment.

PRE UPGRADE DATABASE HEALTH CHECK:

Log in to the system as the owner of the new 10gR2 ORACLE_HOME and copy the following files from the 10gR2 ORACLE_HOME/rdbms/admin directory to a directory outside of the Oracle home, such as the /tmp directory on your system:

cp $ORACLE_HOME/rdbms/admin/utlu102i.sql /tmp—have to be in the 10g environment to do this.

Make a note of the new location of these files.

Change to the temporary directory that you copied files to in Step 1.

cd /tmp

Start SQL*Plus and connect to the database instance as a user with SYSDBA privileges.

Then run and spool the utlu102i.sql file.

sqlplus ‘/as sysdba’ —In 9i environment.

SQL> spool Database_Info.log
SQL> @utlu102i.sql
SQL> spool off

Then, check the spool file and examine the output of the upgrade information tool. The sections which follow, describe the output of the Upgrade Information Tool (utlu102i.sql).

Database:

This section displays global database information about the current database such
as the database name, release number, and compatibility level. A warning is displayed
if the COMPATIBLE initialization parameter needs to be adjusted before the database is
upgraded.

Logfiles:

This section displays a list of redo log files in the current database whose size is less than 4 MB. For each log file, the file name, group number, and recommended size is displayed.
New files of at least 4 MB (preferably 10 MB) need to be created in the current database. Any redo log files less than 4 MB must be dropped before the database is upgraded.

Tablespaces:

This section displays a list of tablespaces in the current database. For each tablespace,the tablespace name and minimum required size is displayed. In addition, a message is displayed if the tablespace is adequate for the upgrade.
If the tablespace does not have enough free space, then space must be added to the tablespace in the current database.
Tablespace adjustments need to be made before the database is upgraded.

Update Parameters:

This section displays a list of initialization parameters in the parameter file of the current database that must be adjusted before the database is upgraded. The adjustments need to be made to the parameter file after it is copied to the new Oracle Database 10g
release.

Deprecated Parameters:

This section displays a list of initialization parameters in the parameter file of the current database that are deprecated in the new Oracle Database 10g release.

Obsolete Parameters:

This section displays a list of initialization parameters in the parameter file of the
current database that are obsolete in the new Oracle Database 10g release. Obsolete
initialization parameters need to be removed from the parameter file before the database is upgraded.

Components:

This section displays a list of database components in the new Oracle Database 10g release that will be upgraded or installed when the current database is upgraded.

Miscellaneous Warnings:

This section provides warnings about specific situations that may require attention before
and/or after the upgrade.

SYSAUX Tablespace:

This section displays the minimum required size for the SYSAUX tablespace, which is required in Oracle Database 10g.
The SYSAUX tablespace must be created after the new Oracle Database 10g release is started and BEFORE the upgrade scripts are invoked.

However since we are using DBUA to upgrade, the assistant will prompt you for the creation of the SYSAUX tablespace so there is no need to create it manually.

2. CHECK FOR CONNECT ROLE PRIVILEGE CHANGES

The CONNECT role in 10g Release 2 has only create session privilege.

Therefore create a new role with the usual privileges which CONNECT role had in 9i and grant it to the users who are not generic database users.

CREATE ROLE CONNECT1;

Grant all privs usually associated with the CONNECT role in previous versions.

grant create view to connect1;
grant create table to connect1;
grant create cluster to connect1;
grant create session to connect1;
grant create synonym to connect1;
grant create sequence to connect1;
grant create database link to connect1;
grant alter session to connect1;

spool grant_connect1.sql

Select ‘grant connect1 to ‘ || 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’, ‘OLAPDBA’, ‘OLAPSVR’, ‘OLAP_USER’,
‘OLAPSYS’, ‘EXFSYS’, ‘SYSMAN’, ‘MDDATA’,
‘SI_INFORMTN_SCHEMA’, ‘XDB’, ‘ODM’);

spool off

Run @grant_connect1.sql and make sure any bb staff I’d are in quotes.

Ex grant connect1 to “bb16872.1”;

Scripts for the above already in place :

Just run create_connect1.sql and grant_connect1.sql from /u02/oradata/software

3. GATHER SCRIPT TO RECREATE DATABASE LINKS IN CASE OF DOWNGRADE:

During the upgrade to 10gR2, any passwords in database links will be encrypted. To downgrade back to the original release, all of the database links with encrypted passwords must be dropped prior to the downgrade.
Consequently, the database links will not exist in the downgraded database.
If you anticipate a requirement to be able to downgrade back to your original release, then save the information about affected database links from the SYS.LINK$ table, so that you can recreate the database links after the downgrade.

Following script can be used to construct the dblink.

Spool db_links.txt

Set head off

SELECT
‘create ‘||DECODE(U.NAME,’PUBLIC’,’public ‘)||’database link ‘||CHR(10)||DECODE(U.NAME,’PUBLIC’,Null, 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# ;

Spool off

Spool file above already in place in /u02/oradata/software

4. GATHER STATISTICS BEFORE UPGRADE:

To run this script, connect to the database AS SYSDBA using SQL*Plus.
spool gdict

grant analyze any to sys;

exec dbms_stats.gather_schema_stats(‘WMSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘MDSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘CTXSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘XDB’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘WKSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘LBACSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘OLAPSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘DMSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘ODM’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘ORDSYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘ORDPLUGINS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘SI_INFORMTN_SCHEMA’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘OUTLN’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘DBSNMP’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘SYSTEM’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

exec dbms_stats.gather_schema_stats(‘SYS’,options=>’GATHER’, estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE, method_opt => ‘FOR ALL COLUMNS SIZE AUTO’, cascade => TRUE);

spool off

The above steps take 1.5 hours max.

Run /u02/oradata/software/analyze.sql

Get a count of all INVALID OBJECTS PRIOR TO UPGRADE:

spool invalid_pre.lst

select substr(owner,1,12) owner,
substr(object_name,1,30) object,
substr(object_type,1,30) type, status from
dba_objects where status <>’VALID’;

select count(*),object_type,owner from dba_objects where status <>’VALID’
group by object_type, owner;
spool off;

LOGOFF FROM MACHINE.

LOGIN AGAIN AND INVOKE 10g ENVIRONMENT

UPGRADE STEPS

Make sure environment in 10g and all env variables defined –

export ORACLE_HOME=/u01/finprod/finproddb/10.2/db_1

$export PERL5LIB=/u01/finprod/finproddb/10.2/db_1/perl/lib/5.8.3:/u01/finprod/finproddb/10.2/db_1/perl/lib/site_pearl/5.8.3
$export LD_LIBRARY_PATH=/u01/finprod/finproddb/10.2/db_1/lib:/usr/dt/lib:/usr/openwin/lib:/u01/finprod/finproddb/10.2/db_1/ctx/lib
$export LIBPATH=/u01/finprod/finproddb/10.2/db_1/lib:/usr/dt/lib:/usr/openwin/lib:/u01/finprod/finproddb/10.2/db_1/lib32:/u01/finprod/finproddb/10.2/db_1/ctx/lib
$export PATH=/u01/finprod/finproddb/10.2/db_1/Apache/perl/bin:/u01/finprod/finproddb/10.2/db_1/Apache/perl/bin:/usr/bin:/u01/finprod/finprodora/iAS/Apache/perl/bin:/u01/finprod/finproddb/10.2/db_1/bin:/usr/ccs/bin:/usr/sbin:/bin:/u01/finprod/finproddb/10.2/db_1/Apache/perl/bin:/usr/bin:/usr/bin:/u01/finprod/finproddb/10.2/db_1/bin:/usr/ccs/bin:/usr/sbin:/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/x11:/sbin:/u01/oraprod:/u01/oraprod/bin:/bin:/u01/oraprod/scripts:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/x11:/sbin:/u01/oraprod:/u01/oraprod/bin:/bin:/usr/local/bin:/u01/oracle/prod/scripts:/u01/local/bwa/prod/scripts:/u01/local/bwa/prod/c/bin:/u01/local/pvcs:/usr/ccs/bin:/usr/openwin/bin:.:/u01/local/bwa/prod/scripts:/u01/local/sas8:/u01/finprod/finproddb/10.2/db_1/OPatch
$export ORA_NLS10=/u01/finprod/finproddb/10.2/db_1/nls/data/9idata
export DISPLAY=10.254.101.25:0.0

unset TNS_ADMIN

unset ORACLE_BASE

echo all the env variables above and then proceed.

To avoid a local_listener error after launching DBUA since port 1521 is in use, copy the following files from the 9i ORACLE_HOME/network/admin/finprod_frmbwds03 to ORACLE_HOME/network/admin

Refer note 431437.1 in metalink…..synopsis below
Cause
Apparently if there are no sqlnet config files in the default location of the 9.2 ORACLE_HOME/network/admin directory then DBUA fails.? The sqlnet config files are:
listener.ora
tnsnames.ora
sqlnet.ora
The TNS_ADMIN environment variable is not set in 10g. “Installation Guide for Solaris Operating System (SPARC 64-Bit)” wants it to be unset during software installation/database upgrade. During DBUA’s “Pre Upgrade” check, it runs database from 9.2 home. But?in an?Oracle E-business Suite environment?the sqlnet config files?are not in the default location of $ORACLE_HOME?/network/admin, therefore?DBUA cannot resolve the local_listener.
Solution
1. Make sure that the sqlnet config files listener.ora, tnsnames.ora, sqlnet.ora are in the default location of $ORACLE_HOME/network/admin.?
This should be the 9.2 ORACLE_HOME????2. If they are not there then find out where the TNS_ADMIN variable points to.????3. Copy the sqlnet config files from TNS_ADMIN location to $ORACLE_HOME/network/admin.
This?should be the 9.2 ORACLE_HOME
4. Rerun DBUA
Steps below :

cd /u01/finprod/finproddb/92/network/admin/finprod_frmbwds03

cp listener.ora /u01/finprod/finproddb/92/network/admin
cp tnsnames.ora /u01/finprod/finproddb/92/network/admin
cp sqlnet_ifile.ora /u01/finprod/finproddb/92/network/admin

cd /u01/finprod/finproddb/92/network/admin
$ ls -lrt
-rw-r–r– 1 oraprod dba 1315 Apr 24 11:26 listener.ora
-rw-r–r– 1 oraprod dba 2292 Apr 24 11:26 tnsnames.ora
-rw-r–r– 1 oraprod dba 627 Apr 24 11:26 sqlnet_ifile.ora
$

Before upgrading to 10.2.0.3 apply the following patches using opatch to avoid the upgrade failing half way.

The upgrade will fail if the following PATCHES are not applied.

The patch numbers for AIX5L are

5755471
5892355
5871314

Download the patches and transfer to any directory.

Unzip the files and go to directory created on unzip

For example patch number 5755471

Go to /5755471 directory

opatch lsinventory –invPtrLoc $ORACLE_HOME/oraInst.loc

Make sure right inventory is picked up – the new 10g patched environment.

opatch apply –invPtrLoc $ORACLE_HOME/oraInst.loc

For two of the patches you will see a few relinking errors which can be ignored…

Error similar to this…

ld: 0711-783 WARNING: TOC overflow. TOC size: 67040 Maximum size: 65536Extra instructions are being generated for each reference to a TOCsymbol if the symbol is in the TOC overflow area.ld: 0711-783 WARNING: TOC overflow. TOC size: 67040 Maximum size: 65536Extra instructions are being generated for each reference to a TOCsymbol if the symbol is in the TOC overflow area.

Now proceed with UPGRADE of database.

Now launch DBUA from the 10g ORACLE_HOME/bin

cd $ORACLE_HOME/bin

export DISPLAY=10.254.101.25:0.0- This is the I.P. address of your machine/laptop.

Should be in the 10g HOME.

./dbua

 











Takes a long time to go from 11 percent to 13 percent.

From 32 percent the JServer JAVA Virtual Machine upgrade starts.
Post upgrade starts at 58 percent.
Takes a long time at 33,39,73 percent.

Takes about 7 hours at 82 percent -running the compilation job of all objects as part of the POST UPGRADE…as screenshot above shows.
To find out how much has completed run this command:

SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;

The count should increase .
To find out how many objects remain to be compiled run this command:

SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);

The count should reduce.