Oracle-12c

在升級模式下執行 utl32k.sql 後啟動失敗並出現 ORA-14694

  • September 5, 2019

以下是步驟

  1. 在 Oracle 12c (12.2.0.1.0) 上創建數據庫
  2. 創建管理視圖和表
  3. 以升級模式啟動數據庫並執行 utlk32.sql
  4. 啟動失敗並顯示這些錯誤程式碼和消息
 ORA-00603: ORACLE server session terminated by fatal error
 ORA-01092: ORACLE instance terminated. Disconnection forced
 ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration

有人可以幫我解決這個問題

以下是命令的詳細步驟:

orapwd file=$ORACLE_HOME/dbs/pwdorclpdb1.ora password=mypwd entries=5
sqlplus /nolog
CONNECT / AS SYSDBA
startup nomount
SET SQLBLANKLINES ON

創建數據庫

CREATE DATABASE mydb
USER SYS IDENTIFIED BY mypwd 
USER SYSTEM IDENTIFIED BY mypwd 
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/mydb/redo01.log') SIZE 100M, 
       GROUP 2  ('/u01/app/oracle/oradata/mydb/redo02.log') SIZE 100M, 
       GROUP 3 ('/u01/app/oracle/oradata/mydb/redo03.log') SIZE 100M 
MAXLOGFILES 5 
MAXLOGMEMBERS 5 
MAXLOGHISTORY 1 
MAXDATAFILES 100 
MAXINSTANCES 1 
CHARACTER SET AL32UTF8 
DATAFILE '/u01/app/oracle/oradata/mydb/system01.dbf' SIZE 325M REUSE
        AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED,
       '/u01/app/oracle/oradata/mydb/system02.dbf' SIZE 325M REUSE
        AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED, 
       '/u01/app/oracle/oradata/mydb/system03.dbf' SIZE 325M REUSE 
        AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED 
SYSAUX DATAFILE '/u01/app/oracle/oradata/mydb/sysaux01.dbf' SIZE 325M REUSE 
AUTOEXTEND ON 
EXTENT MANAGEMENT LOCAL  
DEFAULT TABLESPACE def_t DATAFILE '/u01/app/oracle/oradata/mydb/def_t.dbf' 
 SIZE 100M REUSE AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED 
DEFAULT TEMPORARY TABLESPACE temp_t 
  TEMPFILE '/u01/app/oracle/oradata/mall/temp_t.dbf' SIZE 100M REUSE 
  AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED 
UNDO TABLESPACE wcs_undo_t 
  DATAFILE '/u01/app/oracle/oradata/mydb/undo_t.dbf' SIZE 200M REUSE 
  AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;

創建字典表和視圖

@$ORACLE_HOME/rdbms/admin/catalog.sql 
@$ORACLE_HOME/rdbms/admin/catproc.sql 
@$ORACLE_HOME/sqlplus/admin/pupbld.sql 

創建使用者

shutdown immediate
startup
alter session set "_ORACLE_SCRIPT"=true; 
CREATE USER user1 IDENTIFIED BY mypwd DEFAULT TABLESPACE def_t TEMPORARY TABLESPACE temp_t QUOTA UNLIMITED ON def_t;
GRANT CREATE PROCEDURE, CREATE SEQUENCE, CREATE SESSION, CREATE SYNONYM, 
CREATE TABLE, CREATE TRIGGER, CREATE VIEW, CREATE MATERIALIZED VIEW TO user1;

應用Oracle12c擴展類型

PURGE DBA_RECYCLEBIN;
SHUTDOWN IMMEDIATE;
STARTUP UPGRADE;
ALTER SYSTEM SET MAX_STRING_SIZE=EXTENDED;
@?/rdbms/admin/utl32k.sql 
show parameter MAX_STRING_SIZE
NAME               TYPE        VALUE
------------------ ----------- --------------
max_string_size    string      EXTENDED

SHUTDOWN IMMEDIATE;

問題 - 所有先前的命令都成功。

STARTUP;
ORACLE instance started. 
Total System Global Area 3221225472 bytes
Fixed Size                  8625856 bytes
Variable Size            2365587776 bytes
Database Buffers          838860800 bytes
Redo Buffers                8151040 bytes
Database mounted.
ORA-00603: ORACLE server session terminated by fatal error
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-14694: database must in UPGRADE mode to begin MAX_STRING_SIZE migration
Process ID: 20774
Session ID: 2 Serial number: 387

我想通了

——PURGE DBA_RECYCLEBIN;

  • 從 PFILE = ‘$ORACLE_HOME/dbs/initorcl.ora’ 創建 SPFILE;

  • 立即關機;

  • 啟動掛載;

  • ALTER SYSTEM SET MAX_STRING_SIZE=擴展範圍=SPFILE;

  • 關閉;

  • 啟動升級;

  • @?/rdbms/admin/utl32k.sql -顯示

參數MAX_STRING_SIZE

NAME TYPE VALUE


max_string_size string EXTENDED

  • SHUTDOWN IMMEDIATE;

  • 啟動;

現在啟動成功並且 max_string_size = EXTENDED

版本 12.1的Oracle 錯誤應該已修復但可能適用。當您使用 DBCA 或數據庫創建工具時,可能會發生這種情況。

錯誤 15845247 如果在使用包含數據文件的模板使用 DBCA 創建數據庫時更改 MAX_STRING_SIZE 初始化參數,則數據庫創建失敗並出現以下錯誤:

ORA-14694: 數據庫必須處於 UPGRADE 模式才能開始 MAX_STRING_SIZE 遷移

解決方法是將 MAX_STRING_SIZE 保留為預設值,並在升級成功後更改它。

引用自:https://dba.stackexchange.com/questions/247084