手工升级数据库步骤:
1.对要升级的数据库做完整的备份
2.复制必要文件到新的oracle_home
3.升级数据库
升级前需要用目标数据库中的utlu102i.sql脚本对原数据库进行必要的检测,以检查参数或数据文件是否设置有问题,根据检测报告进行必要的调整
具体步骤:
1.完整备份
用rman 对原数据库进行完整的备份,以防止升级不成功,可以对原数据库进行还原操作
2.复制必要文件到新的oracle_home
需要复制原数据库的密码文件(也可以重建)密码文件,init_SID.ora参数文件到目标数据库的database/dbs目录下
3.升级数据库
在设置目标数据库路径的前提下,立即关闭数据库
在windows下需要用oradim命令删除原数据库服务,然后重建此数据库服务,linux下则不需要,只要保证环境变量正确就可以了;
SQL> SHUTDOWN IMMEDIATE
-
Stop the
C:\> NET STOP OracleServiceORCLOracleService
SID
Oracle service of the database you are upgrading, whereSID
is the instance name. For example, if yourSID
isORCL
, then enter the following at a command prompt: -
Delete the Oracle service at a command prompt using ORADIM.
If your
C:\> ORADIM -DELETE -SID ORCLSID
isORCL
, then enter the following command: -
Create the new Oracle Database 10g service at a command prompt using the ORADIM command of the new Oracle Database release:
C:\> ORADIM -NEW -SID SID -INTPWD PASSWORD -MAXUSERS USERS -STARTMODE AUTO -PFILE ORACLE_HOME\DATABASE\INITSID.ORA -
Start SQL*Plus.
-
Connect to the database instance as a user with
SYSDBA
privileges. -
Start up the instance by issuing the following command:
SQL> STARTUP UPGRADE -
Set the system to spool results to a log file for later verification of success:
SQL> SPOOL upgrade.log - SQL> @catupgrd.sql
- SQL> @utlu102s.sql
10.Turn off the spooling of script results to the log file:
SQL> SPOOL OFF
11. Shut down and restart the instance to reinitialize the system parameters for normal operation.
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
olstrig.sql
to re-create DML triggers on tables with Oracle Label Security policies. This step is only necessary if Oracle Label Security is in your database.
SQL> @olstrig.sql
13.Run utlrp.sql
to recompile any remaining stored PL/SQL and Java code.
SQL> @utlrp.sql
Verify that all expected packages and classes are valid:
SQL> SELECT count(*) FROM dba_objects WHERE status='INVALID';
SQL> SELECT distinct object_name FROM dba_objects WHERE status='INVALID';