博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MAX_STRING_SIZE controls the maximum size of VARCHAR2, NVARCHAR2, and RAW data types in SQL.
阅读量:2042 次
发布时间:2019-04-28

本文共 9507 字,大约阅读时间需要 31 分钟。

MAX_STRING_SIZE

MAX_STRING_SIZE controls the maximum size of VARCHAR2NVARCHAR2, and RAW data types in SQL.

Property Description

Parameter type

String

Syntax

MAX_STRING_SIZE = { STANDARD | EXTENDED }

Default value

STANDARD

Modifiable

ALTER SYSTEM ... SID='*'

Modifiable in a PDB

Yes

Basic

No

Oracle RAC

Multiple instances must use the same value.

Footnote 1

Use ALTER SYSTEM only when the database is in UPGRADE mode, and run the utl32k.sql script afterward, as explained in this section.

 

STANDARD means that the length limits for Oracle Database releases prior to Oracle Database 12c apply (for example, 4000 bytes for VARCHAR2 and NVARCHAR2, and 2000 bytes for RAW).

EXTENDED means that the 32767 byte limit introduced in Oracle Database 12c applies.

The COMPATIBLE initialization parameter must be set to 12.0.0.0 or higher to set MAX_STRING_SIZE = EXTENDED.

You can change the value of MAX_STRING_SIZE from STANDARD to EXTENDED. However, you cannot change the value of MAX_STRING_SIZE from EXTENDED to STANDARD.

By setting MAX_STRING_SIZE = EXTENDED, users are taking an explicit action that could introduce application incompatibility in their database. Applications that do not want to use the expanded data types can be rewritten for compatibility with either setting; for example, these applications could use explicit CASTs to fix the length of VARCHAR2 expressions during CREATE TABLE AS SELECT.

Altering MAX_STRING_SIZE will update database objects and possibly invalidate them, as follows:

  • Tables with virtual columns will be updated with new data type metadata for virtual columns of VARCHAR2(4000), 4000-byte NVARCHAR2, or RAW(2000) type.

    • Functional indexes will become unusable if a change to their associated virtual columns causes the index key to exceed index key length limits. Attempts to rebuild such indexes will fail with ORA-01450: maximum key length exceeded.

  • Views will be invalidated if they contain VARCHAR2(4000), 4000-byte NVARCHAR2, or RAW(2000) typed expression columns.

  • Materialized views will be updated with new metadata VARCHAR2(4000), 4000-byte NVARCHAR2, and RAW(2000) typed expression columns

Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in a Non-CDB

To increase the maximum size of VARCHAR2NVARCHAR2, and RAW columns in a non-CDB:

  1. Shut down the database.

  2. Restart the database in UPGRADE mode.

  3. Change the setting of MAX_STRING_SIZE to EXTENDED.

  4. Run the rdbms/admin/utl32k.sql script. You must be connected AS SYSDBA to run the script.

  5. Restart the database in NORMAL mode.

    Note:

    The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  6. Run the rdbms/admin/utlrp.sql script to recompile invalid objects. You must be connected AS SYSDBA to run the script.

Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in a CDB

To increase the maximum size of VARCHAR2NVARCHAR2, and RAW columns in a CDB and in all the PDBs in the CDB:

  1. Connect to the CDB AS SYSDBA.

  2. In the root, change the setting of MAX_STRING_SIZE to EXTENDED:

    CopyALTER SESSION SET CONTAINER=CDB$ROOT;ALTER SYSTEM SET max_string_size=extended SCOPE=SPFILE;

    Note:

    The root continues to use STANDARD semantics even after MAX_STRING_SIZE is set to EXTENDED. The reason for setting MAX_STRING_SIZE to EXTENDED in the root is so all the PDBs in the CDB can inherit the EXTENDED setting from the root.

  3. Shut down the CDB.

  4. Restart the CDB in UPGRADE mode.

    Copystartup upgrade;
  5. Use the catcon.pl script to run the rdbms/admin/utl32k.sql script in the root and in all the PDBs in the CDB to increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns. The --force_pdb_mode ‘UPGRADE’ option is used to ensure that all PDBs, including application root clones, are opened in migrate mode. Enter the SYS password when prompted:

    Copy$ cd $ORACLE_HOME/rdbms/admin$ mkdir /scratch/mydir/utl32k_cdb_pdbs_output$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS --force_pdb_mode 'UPGRADE' -d $ORACLE_HOME/rdbms/admin -l '/scratch/mydir/utl32k_cdb_pdbs_output' -b utl32k_cdb_pdbs_output utl32k.sqlcatcon: ALL catcon-related output will be written to [/scratch/mydir/utl32k_cdb_pdbs_output/utl32k_cdb_pdbs_output_catcon_23172.lst]catcon: See [/scratch/mydir/utl32k_cdb_pdbs_output/utl32k_cdb_pdbs_output*.log] files for output generated by scriptscatcon: See [/scratch/mydir/utl32k_cdb_pdbs_output/utl32k_cdb_pdbs_output_*.lst] files for spool files, if anyEnter Password: catcon.pl: completed successfully$

    Note:

    The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  6. Connect to the CDB AS SYSDBA and shut down the database.

  7. Restart the CDB in NORMAL mode.

    Copystartup;
  8. Use the catcon.pl script to run the rdbms/admin/utlrp.sql script to recompile invalid objects in the root and in all the PDBs in the CDB. The --force_pdb_mode ‘READ WRITE’ option is used to ensure that all the PDBs (including application root clones) are opened in read write mode. Enter the SYS password when prompted:

    Copy$ cd $ORACLE_HOME/rdbms/admin$ mkdir /scratch/mydir/utlrp_cdb_pdbs_output$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS --force_pdb_mode 'READ WRITE' -d $ORACLE_HOME/rdbms/admin -l '/scratch/mydir/utlrp_cdb_pdbs_output' -b utlrp_cdb_pdbs_output utlrp.sqlcatcon: ALL catcon-related output will be written to [/scratch/mydir/utlrp_cdb_pdbs_output/utlrp_cdb_pdbs_output_catcon_24271.lst]catcon: See [/scratch/mydir/utlrp_cdb_pdbs_output/utlrp_cdb_pdbs_output*.log] files for output generated by scriptscatcon: See [/scratch/mydir/utlrp_cdb_pdbs_output/utlrp_cdb_pdbs_output_*.lst] files for spool files, if anyEnter Password: catcon.pl: completed successfully$

See Also:

 for information about using the catcon.pl script to run Oracle-supplied scripts in a CDB and PDBs.

Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in a PDB

To increase the maximum size of VARCHAR2NVARCHAR2, and RAW columns in a PDB:

  1. Shut down the PDB.

  2. Reopen the PDB in migrate mode.

    Note:

    The following SQL statement can be used to reopen a PDB in migrate mode when the current container is the PDB:

    ALTER PLUGGABLE DATABASE pdb-name OPEN UPGRADE;

  3. Change the setting of MAX_STRING_SIZE in the PDB to EXTENDED.

  4. Run the rdbms/admin/utl32k.sql script in the PDB. You must be connected AS SYSDBA to run the utl32k.sql script.

  5. Reopen the PDB in NORMAL mode.

    Note:

    The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  6. Run the rdbms/admin/utlrp.sql script in the PDB to recompile invalid objects. You must be connected AS SYSDBA to run the script.

See Also:

 for more information about modifying the open mode of PDBs.

Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in an Oracle RAC Database

To increase the maximum size of VARCHAR2NVARCHAR2, and RAW columns in an Oracle RAC database:

  1. Shut down all of the Oracle RAC database instances, except one.

  2. Restart the Oracle RAC database instance in UPGRADE mode.

  3. Change the setting of MAX_STRING_SIZE to EXTENDED.

  4. Run the rdbms/admin/utl32k.sql script in the Oracle RAC database instance. You must be connected AS SYSDBA to run the script.

  5. Restart all Oracle RAC database instances in NORMAL mode.

    Note:

    The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  6. Run the rdbms/admin/utlrp.sql script to recompile invalid objects. You must be connected AS SYSDBA to run the script.

Increasing the Maximum Size of VARCHAR2, NVARCHAR2, and RAW Columns in an Oracle Data Guard Logical Standby Database

To increase the maximum size of VARCHAR2NVARCHAR2, and RAW columns in an Oracle Data Guard logical standby database:

  1. Shut down the Oracle Data Guard primary database and logical standby database.

  2. Restart the primary database and logical standby database in UPGRADE mode.

  3. Change the setting of MAX_STRING_SIZE to EXTENDED on the primary database and logical standby database.

  4. Run the rdbms/admin/utl32k.sql script on both the primary database and the logical standby database. You must be connected AS SYSDBA to run the script.

  5. Restart the primary database and logical standby database in NORMAL mode.

    Note:

    The utl32k.sql script increases the maximum size of the VARCHAR2NVARCHAR2, and RAW columns for the views where this is required. The script does not increase the maximum size of the VARCHAR2NVARCHAR2, and RAW columns in some views because of the way the SQL for those views is written.

  6. Run the rdbms/admin/utlrp.sql script on the primary database and logical standby database to recompile invalid objects. You must be connected AS SYSDBA to run the script.

  7. Restart SQL Apply.

See Also:

 for more information about the MAX_STRING_SIZE parameter

转载地址:http://sisof.baihongyu.com/

你可能感兴趣的文章
How will the new iPhone screen sizes affect iOS developers?
查看>>
在xcode5中修改整个项目名
查看>>
漫谈选人与培训
查看>>
【移动开发】Ken Burns特效的幻灯片
查看>>
iOS 8中CLLocationManager及MKMapView showUserLocation失败的解决办法
查看>>
Cocos2d-x 地图行走的实现1:图论与Dijkstra算法
查看>>
GPUImage
查看>>
Android View系统解析(下)
查看>>
Windows7中IIS简单安装与配置(详细图解)
查看>>
linux基本命令
查看>>
BlockQueue 生产消费 不需要判断阻塞唤醒条件
查看>>
ExecutorService 线程池 newFixedThreadPool newSingleThreadExecutor newCachedThreadPool
查看>>
强引用 软引用 弱引用 虚引用
查看>>
java去除字符串中的空格\t、回车\n、换行符\r、制表符\t
查看>>
数据类型 java转换
查看>>
常用的正则表达式
查看>>
"NetworkError: 400 Bad Request - http://172.16.47.117:8088/rhip/**/####t/approval?date=976
查看>>
ie8 加载不到js 报SCRIPT1028: 缺少标识符、字符串或数字 ;SCRIPT5009: “anorectaSearch”未定义
查看>>
mybatis 根据 数据库表 自动生成 实体
查看>>
win10将IE11兼容ie10
查看>>