Linux 下Oracle 9i 升级
升级: Oracle 10.2.0.1
升级步骤:
1、首先安装Oracle 10g (只安装软件,不建库)
环境变量:
[oracle@ora9i ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
unset USERNAME
export LD_ASSUME_KERNEL=2.4.19
export ORACLE_SID=ora9
export ORACLE_BASE=/u01/app/oracle
#export ORACLE_HOME=$ORACLE_BASE/product/9.2.0/db_1
export ORACLE_HOME=$ORACLE_BASE/ora10g
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
#export NLS_LANG=AMERICAN_AMERICA.zhs16gbk
#export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
[oracle@ora9i ~]$
2、将Oracle 10g 和 9i 安装到不同的目录下
3、升级9i
[oracle@ora9i ~]$/u01/app/oracle/ora10g/bin/dbua
在oracle user的主目录下编辑.java.policy文件,内容:
[ora92@mddbstandby ~]$ cat .java.policy
grant {
permission java.security.AllPermission;
};
否则直接执行dbua的话,系统会提示下列错误:
Exception in thread "main" java.security.AccessControlException: access denied (java.lang.RuntimePermission setIO)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.System.checkIO(System.java:175)
at java.lang.System.setErr(System.java:169)
at oracle.ops.mgmt.trace.Trace.enableLogging(Trace.java:751)
at oracle.ops.mgmt.trace.Trace.enableLogging(Trace.java:720)
at oracle.sysman.assistants.dbma.backend.CompManager.setLoggings(CompManager.java:3390)
at oracle.sysman.assistants.dbma.backend.CompManager.initialize(CompManager.java:297)
at oracle.sysman.assistants.dbma.ui.UICompManager.initialize(UICompManager.java:141)
at oracle.sysman.assistants.dbma.Dbma.execute(Dbma.java:90)
at oracle.sysman.assistants.dbma.Dbma.statusMain(Dbma.java:177)
at oracle.sysman.assistants.dbma.Dbma.main(Dbma.java:158)
如图所示:
4、升级结束:
[oracle@ora9i ~]$ env |grep HOME
HOME=/home/oracle
ORACLE_HOME=/u01/app/oracle/ora10g
[oracle@ora9i ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 30 12:35:14 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> exit
Disconnected
[oracle@ora9i ~]$ !sql
sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 30 12:35:39 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 373293056 bytes
Fixed Size 1219496 bytes
Variable Size 335545432 bytes
Database Buffers 33554432 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database open;
Database altered.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> r
1* select file_id ,file_name ,tablespace_name,bytes/1024/1024 from dba_data_files
FILE_ID FILE_NAME TABLESPACE_NAME BYTES/1024/1024
---------- -------------------------------------------------- ------------------------------ ---------------
10 /u01/app/oracle/oradata/ora9/xdb01.dbf XDB 48.125
9 /u01/app/oracle/oradata/ora9/users01.dbf USERS 25
2 /u01/app/oracle/oradata/ora9/undotbs01.dbf UNDOTBS1 740
8 /u01/app/oracle/oradata/ora9/tools01.dbf TOOLS 10
1 /u01/app/oracle/oradata/ora9/system01.dbf SYSTEM 600
7 /u01/app/oracle/oradata/ora9/odm01.dbf ODM 20
6 /u01/app/oracle/oradata/ora9/indx01.dbf INDX 25
5 /u01/app/oracle/oradata/ora9/example01.dbf EXAMPLE 150.625
4 /u01/app/oracle/oradata/ora9/drsys01.dbf DRSYS 20
3 /u01/app/oracle/oradata/ora9/cwmlite01.dbf CWMLITE 20
11 /u01/app/oracle/oradata/ora9/sysaux01.dbf SYSAUX 300
11 rows selected.
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 356M
sga_target big integer 0
SQL> alter system set sga_target=356m;
System altered.
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 356M
sga_target big integer 356M
SQL>