• Oracle 修改Varchar2类型长度限制


     

    ORA-00910: specified length too long for its datatype

    1. oracle@3deab02ec7ab:/$ sqlplus / as sysdba
    2. SQL*Plus: Release 12.1.0.2.0 Production on Wed Oct 18 08:16:41 2023
    3. Copyright (c) 1982, 2014, Oracle. All rights reserved.
    4. Connected to:
    5. Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
    6. SQL> show parameter MAX_STRING_SIZE;
    7. NAME TYPE VALUE
    8. ------------------------------------ ----------- ------------------------------
    9. max_string_size string STANDARD
    10. SQL> create table t3(blog varchar2(32727));
    11. create table t3(blog varchar2(32727))
    12. *
    13. ERROR at line 1:
    14. ORA-00910: specified length too long for its datatype
    15. SQL> shutdown immediate;
    16. Database closed.
    17. Database dismounted.
    18. ORACLE instance shut down.
    19. SQL> startup upgrade;
    20. ORACLE instance started.
    21. Total System Global Area 1610612736 bytes
    22. Fixed Size 2924928 bytes
    23. Variable Size 553651840 bytes
    24. Database Buffers 1040187392 bytes
    25. Redo Buffers 13848576 bytes
    26. Database mounted.
    27. Database opened.
    28. SQL> alter system set max_string_size=extended scope=both;
    29. System altered.
    30. SQL> @?/rdbms/admin/utl32k.sql
    31. Session altered.
    32. DOC>#######################################################################
    33. DOC>#######################################################################
    34. DOC> The following statement will cause an "ORA-01722: invalid number"
    35. DOC> error if the database has not been opened for UPGRADE.
    36. DOC>
    37. DOC> Perform a "SHUTDOWN ABORT" and
    38. DOC> restart using UPGRADE.
    39. DOC>#######################################################################
    40. DOC>#######################################################################
    41. DOC>#
    42. no rows selected
    43. DOC>#######################################################################
    44. DOC>#######################################################################
    45. DOC> The following statement will cause an "ORA-01722: invalid number"
    46. DOC> error if the database does not have compatible >= 12.0.0
    47. DOC>
    48. DOC> Set compatible >= 12.0.0 and retry.
    49. DOC>#######################################################################
    50. DOC>#######################################################################
    51. DOC>#
    52. PL/SQL procedure successfully completed.
    53. Session altered.
    54. 0 rows updated.
    55. Commit complete.
    56. System altered.
    57. PL/SQL procedure successfully completed.
    58. Commit complete.
    59. System altered.
    60. Session altered.
    61. PL/SQL procedure successfully completed.
    62. No errors.
    63. Session altered.
    64. PL/SQL procedure successfully completed.
    65. Commit complete.
    66. Package altered.
    67. Package altered.
    68. SQL> shutdown immediate;
    69. Database closed.
    70. Database dismounted.
    71. ORACLE instance shut down.
    72. SQL> startup;
    73. ORACLE instance started.
    74. Total System Global Area 1610612736 bytes
    75. Fixed Size 2924928 bytes
    76. Variable Size 553651840 bytes
    77. Database Buffers 1040187392 bytes
    78. Redo Buffers 13848576 bytes
    79. Database mounted.
    80. Database opened.
    81. SQL> @?/rdbms/admin/utlrp.sql
    82. TIMESTAMP
    83. --------------------------------------------------------------------------------
    84. COMP_TIMESTAMP UTLRP_BGN 2023-10-18 08:52:50
    85. DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
    86. DOC> objects in the database. Recompilation time is proportional to the
    87. DOC> number of invalid objects in the database, so this command may take
    88. DOC> a long time to execute on a database with a large number of invalid
    89. DOC> objects.
    90. DOC>
    91. DOC> Use the following queries to track recompilation progress:
    92. DOC>
    93. DOC> 1. Query returning the number of invalid objects remaining. This
    94. DOC> number should decrease with time.
    95. DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
    96. DOC>
    97. DOC> 2. Query returning the number of objects compiled so far. This number
    98. DOC> should increase with time.
    99. DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
    100. DOC>
    101. DOC> This script automatically chooses serial or parallel recompilation
    102. DOC> based on the number of CPUs available (parameter cpu_count) multiplied
    103. DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
    104. DOC> On RAC, this number is added across all RAC nodes.
    105. DOC>
    106. DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
    107. DOC> recompilation. Jobs are created without instance affinity so that they
    108. DOC> can migrate across RAC nodes. Use the following queries to verify
    109. DOC> whether UTL_RECOMP jobs are being created and run correctly:
    110. DOC>
    111. DOC> 1. Query showing jobs created by UTL_RECOMP
    112. DOC> SELECT job_name FROM dba_scheduler_jobs
    113. DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
    114. DOC>
    115. DOC> 2. Query showing UTL_RECOMP jobs that are running
    116. DOC> SELECT job_name FROM dba_scheduler_running_jobs
    117. DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
    118. DOC>#
    119. PL/SQL procedure successfully completed.
    120. TIMESTAMP
    121. --------------------------------------------------------------------------------
    122. COMP_TIMESTAMP UTLRP_END 2023-10-18 08:52:51
    123. DOC> The following query reports the number of objects that have compiled
    124. DOC> with errors.
    125. DOC>
    126. DOC> If the number is higher than expected, please examine the error
    127. DOC> messages reported with each object (using SHOW ERRORS) to see if they
    128. DOC> point to system misconfiguration or resource constraints that must be
    129. DOC> fixed before attempting to recompile these objects.
    130. DOC>#
    131. OBJECTS WITH ERRORS
    132. -------------------
    133. 0
    134. DOC> The following query reports the number of errors caught during
    135. DOC> recompilation. If this number is non-zero, please query the error
    136. DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
    137. DOC> are due to misconfiguration or resource constraints that must be
    138. DOC> fixed before objects can compile successfully.
    139. DOC>#
    140. ERRORS DURING RECOMPILATION
    141. ---------------------------
    142. 0
    143. Function created.
    144. PL/SQL procedure successfully completed.
    145. Function dropped.
    146. ...Database user "SYS", database schema "APEX_040200", user# "98" 08:52:58
    147. ...Compiled 0 out of 3014 objects considered, 0 failed compilation 08:52:59
    148. ...271 packages
    149. ...263 package bodies
    150. ...452 tables
    151. ...11 functions
    152. ...16 procedures
    153. ...3 sequences
    154. ...457 triggers
    155. ...1320 indexes
    156. ...211 views
    157. ...0 libraries
    158. ...6 types
    159. ...0 type bodies
    160. ...0 operators
    161. ...0 index types
    162. ...Begin key object existence check 08:52:59
    163. ...Completed key object existence check 08:52:59
    164. ...Setting DBMS Registry 08:52:59
    165. ...Setting DBMS Registry Complete 08:52:59
    166. ...Exiting validate 08:52:59
    167. PL/SQL procedure successfully completed.
    168. SQL> show parameter MAX_STRING_SIZE;
    169. NAME TYPE VALUE
    170. ------------------------------------ ----------- ------------------------------
    171. max_string_size string EXTENDED
    172. SQL> create table t3(blog varchar2(32727));
    173. Table created.
    174. SQL>

  • 相关阅读:
    人工智能-4计算机视觉和图像处理01
    【Unity3D】初学加密技巧(反破解)
    KCP协议:从TCP到UDP家族QUIC/KCP/ENET
    QMainWindow的使用
    二十、一起学习Lua 面向对象
    C++指针解读(6)-- 指针和字符串
    年龄大了转嵌入式有机会吗?
    php+微信小程序大学跳蚤市场的微信小程序设计与实现毕业设计源码261620
    双系统时间问题、虚拟机扩展空间问题
    Unity UGUI的VerticalLayoutGroup(垂直布局)组件的介绍及使用
  • 原文地址:https://blog.csdn.net/usoa/article/details/133910192