三思同志在测试CONVERT DATABASE数据库的时候碰到了这个错误,简单记录一下问题的解决过程。
由于环境是jusansi搭的,我只是碰到问题后来帮忙的,因此这里没有错误环境的搭建步骤,只是简单描述一下步骤。
源数据库是Windows环境下的32位10201,目标数据库是Linux环境下64位10203。在源数据库上执行了CONVERT DATABASE命令,将CONVERT后的数据文件都拷贝到目标数据库上,并生成了控制文件,随后出现了错误:
SQL> startup pfile=/data/orascript/jssconv/pfile_conv.ora
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 2071256 bytes
Variable Size 104858920 bytes
Database Buffers 54525952 bytes
Redo Buffers 6316032 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
当我看到这个问题时,已经是这种情况了:
Errors in file /opt/ora10g/admin/jssconv/udump/jssconv_ora_29606.trc:
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
在alert文件中,看到上面的错误信息,又了解到了源数据库的版本和目标数据库版本不一致,因此尝试利用STARTUP UPGRADE来解决这个问题:
SQL> startup upgrade pfile=/data/orascript/jssconv/pfile_conv.ora
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 2071256 bytes
Variable Size 104858920 bytes
Database Buffers 54525952 bytes
Redo Buffers 6316032 bytes
Database mounted.
Database opened.
SQL> spo catupgrade.txt
SQL> @?/rdbms/admin/catupgrd.sql
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the user running this script is not SYS. Disconnect
DOC> and reconnect with AS SYSDBA.
DOC>######################################################################
DOC>######################################################################
DOC>#
no rows selected
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the database server version is not correct for this script.
DOC> Shutdown ABORT and use a different script or a different server.
DOC>######################################################################
DOC>######################################################################
DOC>#
no rows selected
.
.
.
System altered.
0 rows deleted.
Commit complete.
System altered.
CREATE OR REPLACE FUNCTION version_script
*
ERROR at line 1:
ORA-06544: PL/SQL: internal error, arguments: [56319], [], [], [], [], [], [],
[]
ORA-06553: PLS-801: internal error [56319]
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
可以看到,使用STARTUP UPGRADE方式可以打开数据库,但是运行catupgrd.sql时出现了错误,还是第一次碰到运行升级包的时候出现了这种直接退出的错误。
查询了一下metalink,发现在10g上,如果数据库从32位变为64位,那么执行catupgrd.sql就可能出现ORA-6544错误,Oracle在多篇文章中描述了这个错误,比如:Bug No. 5079213和Bug No. 8551190。Oracle给出的解决方法是修改catupgrd.sql脚本,或者在调用脚本前执行utlip.sql。
SQL> @?/rdbms/admin/utlip.sql
2070 rows updated.
Commit complete.
0 rows updated.
Commit complete.
29 rows updated.
Commit complete.
System altered.
Package created.
Package body created.
Grant succeeded.
Package created.
Synonym created.
Grant succeeded.
PL/SQL procedure successfully completed.
Commit complete.
System altered.
PL/SQL procedure successfully completed.
Commit complete.
System altered.
下面再次运行catupgrd.sql,问题消失:
SQL> spo catupgrade.txt
SQL> @?/rdbms/admin/catupgrd.sql
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the user running this script is not SYS. Disconnect
DOC> and reconnect with AS SYSDBA.
DOC>######################################################################
DOC>######################################################################
DOC>#
no rows selected
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the database server version is not correct for this script.
DOC> Shutdown ABORT and use a different script or a different server.
DOC>######################################################################
DOC>######################################################################
DOC>#
no rows selected
.
.
.
SQL> DOC
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC> The above PL/SQL lists the SERVER components in the upgraded
DOC> database, along with their current version and status.
DOC>
DOC> Please review the status and version columns and look for
DOC> any errors in the spool log file. If there are errors in the spool
DOC> file, or any components are not VALID or not the current version,
DOC> consult the Oracle Database Upgrade Guide for troubleshooting
DOC> recommendations.
DOC>
DOC> Next shutdown immediate, restart for normal operation, and then
DOC> run utlrp.sql to recompile any invalid application objects.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
SQL>
SQL> Rem *********************************************************************
SQL> Rem END catupgrd.sql
SQL> Rem *********************************************************************
SQL> spo off
SQL> @?/rdbms/admin/utlrp.sql
SQL> Rem
SQL> Rem $Header: utlrp.sql 24-jul-2003.10:06:51 gviswana Exp $
SQL> Rem
SQL> Rem utlrp.sql
.
.
.
SQL> select COUNT(*) "OBJECTS WITH ERRORS" from obj$ where status = 3;
OBJECTS WITH ERRORS
-------------------
1
1 row selected.
SQL>
SQL>
SQL> DOC
DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#
SQL> select COUNT(*) "ERRORS DURING RECOMPILATION" from utl_recomp_errors;
ERRORS DURING RECOMPILATION
---------------------------
0
1 row selected.
SQL>
SQL>
SQL> Rem =====================================================================
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> SET serveroutput on
SQL> EXECUTE dbms_registry_sys.validate_components;
PL/SQL procedure successfully completed.
SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup pfile=/data/orascript/jssconv/pfile_conv.ora
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 2071256 bytes
Variable Size 104858920 bytes
Database Buffers 54525952 bytes
Redo Buffers 6316032 bytes
Database mounted.
Database opened.
至此数据库启动报错,以及执行catupgrd.sql出错的问题解决,CONVERT DATABASE操作也顺利完成。