

# Configuring advanced RDS for Oracle features
<a name="CHAP_Oracle.advanced-features"></a>

RDS for Oracle supports various advanced features, including HugePages, an instance store, and extended data types.

**Topics**
+ [Storing temporary data in an RDS for Oracle instance store](CHAP_Oracle.advanced-features.instance-store.md)
+ [Turning on HugePages for an RDS for Oracle instance](Oracle.Concepts.HugePages.md)
+ [Turning on extended data types in RDS for Oracle](Oracle.Concepts.ExtendedDataTypes.md)

# Storing temporary data in an RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store"></a>

Use an instance store for the temporary tablespaces and the Database Smart Flash Cache (the flash cache) on supported RDS for Oracle DB instance classes.

**Topics**
+ [Overview of the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview)
+ [Turning on an RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.Enable)
+ [Configuring an RDS for Oracle instance store](CHAP_Oracle.advanced-features.instance-store.configuring.md)
+ [Working with an instance store on an Oracle read replica](CHAP_Oracle.advanced-features.instance-store.replicas.md)
+ [Configuring a temporary tablespace group on an instance store and Amazon EBS](CHAP_Oracle.advanced-features.instance-store.temp-ebs.md)
+ [Removing an RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.Disable)

## Overview of the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview"></a>

An *instance store* provides temporary block-level storage for an RDS for Oracle DB instance. You can use an instance store for temporary storage of information that changes frequently.

An instance store is based on Non-Volatile Memory Express (NVMe) devices that are physically attached to the host computer. The storage is optimized for low latency, random I/O performance, and sequential read throughput.

The size of the instance store varies by DB instance type. For more information about the instance store, see [Amazon EC2 instance store](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) in the *Amazon Elastic Compute Cloud User Guide for Linux Instances*.

**Topics**
+ [Types of data in the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.uses)
+ [Benefits of the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.benefits)
+ [Supported instance classes for the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.instance-classes)
+ [Supported engine versions for the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.db-versions)
+ [Supported AWS Regions for the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.regions)
+ [Cost of the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.cost)

### Types of data in the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.uses"></a>

You can place the following types of RDS for Oracle temporary data in an instance store:

A temporary tablespace  
Oracle Database uses temporary tablespaces to store intermediate query results that don't fit in memory. Larger queries can generate large amounts of intermediate data that needs to be cached temporarily, but doesn't need to persist. In particular, a temporary tablespace is useful for sorts, hash aggregations, and joins. If your RDS for Oracle DB instance uses the Enterprise Edition or Standard Edition 2, you can place a temporary tablespace in an instance store.

The flash cache  
The flash cache improves the performance of single-block random reads in the conventional path. A best practice is to size the cache to accommodate most of your active data set. If your RDS for Oracle DB instance uses the Enterprise Edition, you can place the flash cache in an instance store.

By default, an instance store is configured for a temporary tablespace but not for the flash cache. You can't place Oracle data files and database log files in an instance store.

### Benefits of the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.benefits"></a>

You might consider using an instance store to store temporary files and caches that you can afford to lose. If you want to improve DB performance, or if an increasing workload is causing performance problems for your Amazon EBS storage, consider scaling to an instance class that supports an instance store.

By placing your temporary tablespace and flash cache on an instance store, you get the following benefits:
+ Lower read latencies
+ Higher throughput
+ Reduced load on your Amazon EBS volumes
+ Lower storage and snapshot costs because of reduced Amazon EBS load
+ Less need to provision high IOPS, possibly lowering your overall cost

 By placing your temporary tablespace on the instance store, you deliver an immediate performance boost to queries that use temporary space. When you place the flash cache on the instance store, cached block reads typically have much lower latency than Amazon EBS reads. The flash cache needs to be "warmed up" before it delivers performance benefits. The cache warms up by itself because the database writes blocks to the flash cache as they age out of the database buffer cache.

**Note**  
In some cases, the flash cache causes performance overhead because of cache management. Before you turn on the flash cache in a production environment, we recommend that you analyze your workload and test the cache in a test environment.

### Supported instance classes for the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.instance-classes"></a>

Amazon RDS supports the instance store for the following DB instance classes:
+ db.m5d
+ db.m6id
+ db.r5d
+ db.r6id
+ db.x2idn
+ db.x2iedn

RDS for Oracle supports the preceding DB instance classes for the BYOL licensing model only. For more information, see [Supported RDS for Oracle DB instance classes](Oracle.Concepts.InstanceClasses.md#Oracle.Concepts.InstanceClasses.Supported) and [Bring Your Own License (BYOL) for EE and SE2](Oracle.Concepts.Licensing.md#Oracle.Concepts.Licensing.BYOL).

To see the total instance storage for the supported DB instance types, run the following command in the AWS CLI. 

**Example**  

```
aws ec2 describe-instance-types \
  --filters "Name=instance-type,Values=*5d.*large*,*6id.*large*" \
  --query "InstanceTypes[?contains(InstanceType,'m5d')||contains(InstanceType,'r5d')||contains(InstanceType,'m6id')||contains(InstanceType,'r6id')][InstanceType, InstanceStorageInfo.TotalSizeInGB]" \
  --output table
```

The preceding command returns the raw device size for the instance store. RDS for Oracle uses a small portion of this space for configuration. The space in the instance store that is available for temporary tablespaces or the flash cache is slightly smaller.

### Supported engine versions for the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.db-versions"></a>

The instance store is supported for the following RDS for Oracle engine versions: 
+ 21.0.0.0.ru-2022-01.rur-2022-01.r1 or higher Oracle Database 21c versions
+ 19.0.0.0.ru-2021-10.rur-2021-10.r1 or higher Oracle Database 19c versions

### Supported AWS Regions for the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.regions"></a>

The instance store is available in all AWS Regions where one or more of these instance types are supported. For more information on the db.m5d and db.r5d instance classes, see [DB instance classes](Concepts.DBInstanceClass.md). For more information on the instance classes supported by Amazon RDS for Oracle, see [RDS for Oracle DB instance classes](Oracle.Concepts.InstanceClasses.md).

### Cost of the RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.overview.cost"></a>

The cost of the instance store is built into the cost of the instance-store turned on instances. You don't incur additional costs by enabling an instance store on an RDS for Oracle DB instance. For more information about instance-store turned on instances, see [Supported instance classes for the RDS for Oracle instance store](#CHAP_Oracle.advanced-features.instance-store.overview.instance-classes).

## Turning on an RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.Enable"></a>

To turn on the instance store for RDS for Oracle temporary data, do one of the following:
+ Create an RDS for Oracle DB instance using a supported instance class. For more information, see [Creating an Amazon RDS DB instance](USER_CreateDBInstance.md).
+ Modify an existing RDS for Oracle DB instance to use a supported instance class. For more information, see [Modifying an Amazon RDS DB instance](Overview.DBInstance.Modifying.md).

# Configuring an RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.configuring"></a>

By default, 100% of instance store space is allocated to the temporary tablespace. To configure the instance store to allocate space to the flash cache and temporary tablespace, set the following parameters in the parameter group for your instance:

**db\$1flash\$1cache\$1size=\$1DBInstanceStore\$1\$10,2,4,6,8,10\$1/10\$1**  
This parameter specifies the amount of storage space allocated for the flash cache. This parameter is valid only for Oracle Database Enterprise Edition. The default value is `{DBInstanceStore*0/10}`. If you set a nonzero value for `db_flash_cache_size`, your RDS for Oracle instance enables the flash cache after you restart the instance.

**rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$1\$10,2,4,6,8,10\$1/10\$1**  
This parameter specifies the amount of storage space allocated for the temporary tablespace. The default value is `{DBInstanceStore*10/10}`. This parameter is modifiable for Oracle Database Enterprise Edition and read-only for Standard Edition 2. If you set a nonzero value for `rds.instance_store_temp_size`, Amazon RDS allocates space in the instance store for the temporary tablespace.  
You can set the `db_flash_cache_size` and `rds.instance_store_temp_size` parameters for DB instances that don't use an instance store. In this case, both settings evaluate to `0`, which turns off the feature. In this case, you can use the same parameter group for different instance sizes and for instances that don't use an instance store. If you modify these parameters, make sure to reboot the associated instances so that the changes can take effect.  
If you allocate space for a temporary tablespace, Amazon RDS doesn't create the temporary tablespace automatically. To learn how to create the temporary tablespace on the instance store, see [Creating a temporary tablespace on the instance store](Appendix.Oracle.CommonDBATasks.TablespacesAndDatafiles.md#Appendix.Oracle.CommonDBATasks.creating-tts-instance-store).

The combined value of the preceding parameters must not exceed 10/10, or 100%. The following table illustrates valid and invalid parameter settings.


| db\$1flash\$1cache\$1size setting | rds.instance\$1store\$1temp\$1size setting | Explanation | 
| --- | --- | --- | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$10/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$110/10\$1  |  This is a valid configuration for all editions of Oracle Database. Amazon RDS allocates 100% of instance store space to the temporary tablespace. This is the default.  | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$110/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$10/10\$1  |  This is a valid configuration for Oracle Database Enterprise Edition only. Amazon RDS allocates 100% of instance store space to the flash cache.  | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$12/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$18/10\$1  |  This is a valid configuration for Oracle Database Enterprise Edition only. Amazon RDS allocates 20% of instance store space to the flash cache, and 80% of instance store space to the temporary tablespace.  | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$16/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$14/10\$1  |  This is a valid configuration for Oracle Database Enterprise Edition only. Amazon RDS allocates 60% of instance store space to the flash cache, and 40% of instance store space to the temporary tablespace.  | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$12/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$14/10\$1  | This is a valid configuration for Oracle Database Enterprise Edition only. Amazon RDS allocates 20% of instance store space to the flash cache, and 40% of instance store space to the temporary tablespace. | 
|  db\$1flash\$1cache\$1size=\$1DBInstanceStore\$18/10\$1  |  rds.instance\$1store\$1temp\$1size=\$1DBInstanceStore\$18/10\$1  |  This is an invalid configuration because the combined percentage of instance store space exceeds 100%. In such cases, Amazon RDS fails the attempt.  | 

## Considerations when changing the DB instance type
<a name="CHAP_Oracle.advanced-features.instance-store.configuring.modifying"></a>

If you change your DB instance type, it can affect the configuration of the flash cache or the temporary tablespace on the instance store. Consider the following modifications and their effects:

**You scale up or scale down the DB instance that supports the instance store.**  
The following values increase or decrease proportionally to the new size of the instance store:  
+ The new size of the flash cache.
+ The space allocated to the temporary tablespaces that reside in the instance store.
For example, the setting `db_flash_cache_size={DBInstanceStore*6/10}` on a db.m5d.4xlarge instance provides around 340 GB of flash cache space. If you scale up the instance type to db.m5d.8xlarge, the flash cache space increases to around 680 GB.

**You modify a DB instance that doesn't use an instance store to an instance that does use an instance store.**  
If `db_flash_cache_size` is set to a value larger than `0`, the flash cache is configured. If `rds.instance_store_temp_size` is set to a value larger than `0`, the instance store space is allocated for use by a temporary tablespace. RDS for Oracle doesn't move tempfiles to the instance store automatically. For information about using the allocated space, see [Creating a temporary tablespace on the instance store](Appendix.Oracle.CommonDBATasks.TablespacesAndDatafiles.md#Appendix.Oracle.CommonDBATasks.creating-tts-instance-store) or [Adding a tempfile to the instance store on a read replica](Appendix.Oracle.CommonDBATasks.using-tempfiles.md#Appendix.Oracle.CommonDBATasks.adding-tempfile-replica).

**You modify a DB instance that uses an instance store to an instance that doesn't use an instance store.**  
In this case, RDS for Oracle removes the flash cache. RDS re-creates the tempfile that is currently located on the instance store on an Amazon EBS volume. The maximum size of the new tempfile is the former size of the `rds.instance_store_temp_size` parameter.

# Working with an instance store on an Oracle read replica
<a name="CHAP_Oracle.advanced-features.instance-store.replicas"></a>

Read replicas support the flash cache and temporary tablespaces on an instance store. While the flash cache works the same way as on the primary DB instance, note the following differences for temporary tablespaces:
+ You can't create a temporary tablespace on a read replica. If you create a new temporary tablespace on the primary instance, RDS for Oracle replicates the tablespace information without tempfiles. To add a new tempfile, use either of the following techniques:
  + Use the Amazon RDS procedure `rdsadmin.rdsadmin_util.add_inst_store_tempfile`. RDS for Oracle creates a tempfile in the instance store on your read replica, and adds it to the specified temporary tablespace.
  + Run the `ALTER TABLESPACE … ADD TEMPFILE` command. RDS for Oracle places the tempfile on Amazon EBS storage.
**Note**  
The tempfile sizes and storage types can be different on the primary DB instance and the read replica.
+ You can manage the default temporary tablespace setting only on the primary DB instance. RDS for Oracle replicates the setting to all read replicas.
+ You can configure the temporary tablespace groups only on the primary DB instance. RDS for Oracle replicates the setting to all read replicas.

# Configuring a temporary tablespace group on an instance store and Amazon EBS
<a name="CHAP_Oracle.advanced-features.instance-store.temp-ebs"></a>

You can configure a temporary tablespace group to include temporary tablespaces on both an instance store and Amazon EBS. This technique is useful when you want more temporary storage than is allowed by the maximum setting of `rds.instance_store_temp_size`.

When you configure a temporary tablespace group on both an instance store and Amazon EBS, the two tablespaces have significantly different performance characteristics. Oracle Database chooses the tablespace to serve queries based on an internal algorithm. Therefore, similar queries can vary in performance.

Typically, you create a temporary tablespace in the instance store as follows:

1. Create a temporary tablespace in the instance store.

1. Set the new tablespace as the database default temporary tablespace.

If the tablespace size in the instance store is insufficient, you can create additional temporary storage as follows:

1. Assign the temporary tablespace in the instance store to a temporary tablespace group.

1. Create a new temporary tablespace in Amazon EBS if one doesn't exist.

1. Assign the temporary tablespace in Amazon EBS to the same tablespace group that includes the instance store tablespace.

1. Set the tablespace group as the default temporary tablespace.

The following example assumes that the size of the temporary tablespace in the instance store doesn't meet your application requirements. The example creates the temporary tablespace `temp_in_inst_store` in the instance store, assigns it to tablespace group `temp_group`, adds the existing Amazon EBS tablespace named `temp_in_ebs` to this group, and sets this group as the default temporary tablespace.

```
SQL> EXEC rdsadmin.rdsadmin_util.create_inst_store_tmp_tblspace('temp_in_inst_store');

PL/SQL procedure successfully completed.

SQL> ALTER TABLESPACE temp_in_inst_store TABLESPACE GROUP temp_group;

Tablespace altered.

SQL> ALTER TABLESPACE temp_in_ebs TABLESPACE GROUP temp_group;

Tablespace altered.

SQL> EXEC rdsadmin.rdsadmin_util.alter_default_temp_tablespace('temp_group');

PL/SQL procedure successfully completed.

SQL> SELECT * FROM DBA_TABLESPACE_GROUPS;

GROUP_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
TEMP_GROUP                     TEMP_IN_EBS
TEMP_GROUP                     TEMP_IN_INST_STORE

SQL> SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES WHERE PROPERTY_NAME='DEFAULT_TEMP_TABLESPACE';

PROPERTY_VALUE
--------------
TEMP_GROUP
```

## Removing an RDS for Oracle instance store
<a name="CHAP_Oracle.advanced-features.instance-store.Disable"></a>

To remove the instance store, modify your RDS for Oracle DB instance to use an instance type that doesn't support instance store, such as db.m5 or db.r5.

# Turning on HugePages for an RDS for Oracle instance
<a name="Oracle.Concepts.HugePages"></a>

Amazon RDS for Oracle supports Linux kernel HugePages for increased database scalability. HugePages results in smaller page tables and less CPU time spent on memory management, increasing the performance of large database instances. For more information, see [Overview of HugePages](https://docs.oracle.com/database/121/UNXAR/appi_vlm.htm#UNXAR400) in the Oracle documentation. 

You can use HugePages with all supported versions and editions of RDS for Oracle.

 The `use_large_pages` parameter controls whether HugePages are turned on for a DB instance. The possible settings for this parameter are `ONLY`, `FALSE`, and `{DBInstanceClassHugePagesDefault}`. The `use_large_pages` parameter is set to `{DBInstanceClassHugePagesDefault}` in the default DB parameter group for Oracle. 

To control whether HugePages are turned on for a DB instance automatically, you can use the `DBInstanceClassHugePagesDefault` formula variable in parameter groups. The value is determined as follows:
+ For the DB instance classes mentioned in the table following, `DBInstanceClassHugePagesDefault` always evaluates to `FALSE` by default, and `use_large_pages` evaluates to `FALSE`. You can turn on HugePages manually for these DB instance classes if the DB instance class has at least 14 GiB of memory.
+ For DB instance classes not mentioned in the table following, if the DB instance class has less than 14 GiB of memory, `DBInstanceClassHugePagesDefault` always evaluates to `FALSE`. Also, `use_large_pages` evaluates to `FALSE`.
+ For DB instance classes not mentioned in the table following, if the instance class has at least 14 GiB of memory and less than 100 GiB of memory, `DBInstanceClassHugePagesDefault` evaluates to `TRUE` by default. Also, `use_large_pages` evaluates to `ONLY`. You can turn off HugePages manually by setting `use_large_pages` to `FALSE`.
+ For DB instance classes not mentioned in the table following, if the instance class has at least 100 GiB of memory, `DBInstanceClassHugePagesDefault` always evaluates to `TRUE`. Also, `use_large_pages` evaluates to `ONLY` and HugePages can't be disabled.

HugePages are not turned on by default for the following DB instance classes. 


****  

| DB instance class family | DB instance classes with HugePages not turned on by default | 
| --- | --- | 
|  db.m5  |  db.m5.large  | 
|  db.m4  |  db.m4.large, db.m4.xlarge, db.m4.2xlarge, db.m4.4xlarge, db.m4.10xlarge  | 
|  db.t3  |  db.t3.micro, db.t3.small, db.t3.medium, db.t3.large  | 

For more information about DB instance classes, see [Hardware specifications for DB instance classes](Concepts.DBInstanceClass.Summary.md). 

To turn on HugePages for new or existing DB instances manually, set the `use_large_pages` parameter to `ONLY`. You can't use HugePages with Oracle Automatic Memory Management (AMM). If you set the parameter `use_large_pages` to `ONLY`, then you must also set both `memory_target` and `memory_max_target` to `0`. For more information about setting DB parameters for your DB instance, see [Parameter groups for Amazon RDS](USER_WorkingWithParamGroups.md). 

You can also set the `sga_target`, `sga_max_size`, and `pga_aggregate_target` parameters. When you set system global area (SGA) and program global area (PGA) memory parameters, add the values together. Subtract this total from your available instance memory (`DBInstanceClassMemory`) to determine the free memory beyond the HugePages allocation. You must leave free memory of at least 2 GiB, or 10 percent of the total available instance memory, whichever is smaller. 

After you configure your parameters, you must reboot your DB instance for the changes to take effect. For more information, see [Rebooting a DB instance](USER_RebootInstance.md). 

**Note**  
The Oracle DB instance defers changes to SGA-related initialization parameters until you reboot the instance without failover. In the Amazon RDS console, choose **Reboot** but *do not* choose **Reboot with failover**. In the AWS CLI, call the `reboot-db-instance` command with the `--no-force-failover` parameter. The DB instance does not process the SGA-related parameters during failover or during other maintenance operations that cause the instance to restart.

The following is a sample parameter configuration for HugePages that enables HugePages manually. You should set the values to meet your needs. 

```
1. memory_target            = 0
2. memory_max_target        = 0
3. pga_aggregate_target     = {DBInstanceClassMemory*1/8}
4. sga_target               = {DBInstanceClassMemory*3/4}
5. sga_max_size             = {DBInstanceClassMemory*3/4}
6. use_large_pages          = ONLY
```

Assume the following parameters values are set in a parameter group.

```
1. memory_target            = IF({DBInstanceClassHugePagesDefault}, 0, {DBInstanceClassMemory*3/4})
2. memory_max_target        = IF({DBInstanceClassHugePagesDefault}, 0, {DBInstanceClassMemory*3/4})
3. pga_aggregate_target     = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*1/8}, 0)
4. sga_target               = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*3/4}, 0)
5. sga_max_size             = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*3/4}, 0)
6. use_large_pages          = {DBInstanceClassHugePagesDefault}
```

The parameter group is used by a db.r4 DB instance class with less than 100 GiB of memory. With these parameter settings and `use_large_pages` set to `{DBInstanceClassHugePagesDefault}`, HugePages are turned on for the db.r4 instance.

Consider another example with following parameters values set in a parameter group.

```
1. memory_target           = IF({DBInstanceClassHugePagesDefault}, 0, {DBInstanceClassMemory*3/4})
2. memory_max_target       = IF({DBInstanceClassHugePagesDefault}, 0, {DBInstanceClassMemory*3/4})
3. pga_aggregate_target    = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*1/8}, 0)
4. sga_target              = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*3/4}, 0)
5. sga_max_size            = IF({DBInstanceClassHugePagesDefault}, {DBInstanceClassMemory*3/4}, 0)
6. use_large_pages         = FALSE
```

The parameter group is used by a db.r4 DB instance class and a db.r5 DB instance class, both with less than 100 GiB of memory. With these parameter settings, HugePages are turned off on the db.r4 and db.r5 instance.

**Note**  
If this parameter group is used by a db.r4 DB instance class or db.r5 DB instance class with at least 100 GiB of memory, the `FALSE` setting for `use_large_pages` is overridden and set to `ONLY`. In this case, a customer notification regarding the override is sent.

After HugePages are active on your DB instance, you can view HugePages information by enabling enhanced monitoring. For more information, see [Monitoring OS metrics with Enhanced Monitoring](USER_Monitoring.OS.md). 

# Turning on extended data types in RDS for Oracle
<a name="Oracle.Concepts.ExtendedDataTypes"></a>

Amazon RDS for Oracle supports extended data types. With extended data types, the maximum size is 32,767 bytes for the `VARCHAR2`, `NVARCHAR2`, and `RAW` data types. To use extended data types, set the `MAX_STRING_SIZE` parameter to `EXTENDED`. For more information, see [Extended data types](https://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF55623) in the Oracle documentation. 

If you don't want to use extended data types, keep the `MAX_STRING_SIZE` parameter set to `STANDARD` (the default). In this case, the size limits are 4,000 bytes for the `VARCHAR2` and `NVARCHAR2` data types, and 2,000 bytes for the RAW data type.

You can turn on extended data types on a new or existing DB instance. For new DB instances, DB instance creation time is typically longer when you turn on extended data types. For existing DB instances, the DB instance is unavailable during the conversion process.

## Considerations for extended data types
<a name="Oracle.Concepts.ExtendedDataTypes.considerations"></a>

Consider the following when you enable extended data types for your DB instance:
+ When you turn on extended data types for a new or existing DB instance, you must reboot the instance for the change to take effect. 
+ After you turn on extended data types, you can't change the DB instance back to use the standard size for data types. If you set the `MAX_STRING_SIZE` parameter back to `STANDARD` it results in the `incompatible-parameters` status.
+ When you restore a DB instance that uses extended data types, you must specify a parameter group with the `MAX_STRING_SIZE` parameter set to `EXTENDED`. During restore, if you specify the default parameter group or any other parameter group with `MAX_STRING_SIZE` set to `STANDARD` it results in the `incompatible-parameters` status.
+ When the DB instance status is `incompatible-parameters` because of the `MAX_STRING_SIZE` setting, the DB instance remains unavailable until you set the `MAX_STRING_SIZE` parameter to `EXTENDED` and reboot the DB instance.

## Turning on extended data types for a new DB instance
<a name="Oracle.Concepts.ExtendedDataTypes.CreateDBInstance"></a>

When you create a DB instance with `MAX_STRING_SIZE` set to `EXTENDED`, the instance shows `MAX_STRING_SIZE` set to the default `STANDARD`. Reboot the instance to enable the change.

**To turn on extended data types for a new DB instance**

1. Set the `MAX_STRING_SIZE` parameter to `EXTENDED` in a parameter group.

   To set the parameter, you can either create a new parameter group or modify an existing parameter group.

   For more information, see [Parameter groups for Amazon RDS](USER_WorkingWithParamGroups.md).

1. Create a new RDS for Oracle DB instance.

   For more information, see [Creating an Amazon RDS DB instance](USER_CreateDBInstance.md).

1. Associate the parameter group with `MAX_STRING_SIZE` set to `EXTENDED` with the DB instance.

   For more information, see [Creating an Amazon RDS DB instance](USER_CreateDBInstance.md).

1. Reboot the DB instance for the parameter change to take effect.

   For more information, see [Rebooting a DB instance](USER_RebootInstance.md).

## Turning on extended data types for an existing DB instance
<a name="Oracle.Concepts.ExtendedDataTypes.ModifyDBInstance"></a>

When you modify a DB instance to turn on extended data types, RDS converts the data in the database to use the extended sizes. The conversion and downtime occur when you next reboot the database after the parameter change. The DB instance is unavailable during the conversion. 

The amount of time it takes to convert the data depends on the DB instance class, the database size, and the time of the last DB snapshot. To reduce downtime, consider taking a snapshot immediately before rebooting. This shortens the time of the backup that occurs during the conversion workflow.

**Note**  
After you turn on extended data types, you can't perform a point-in-time restore to a time during the conversion. You can restore to the time immediately before the conversion or after the conversion.

**To turn on extended data types for an existing DB instance**

1. Take a snapshot of the database.

   If there are invalid objects in the database, Amazon RDS tries to recompile them. The conversion to extended data types can fail if Amazon RDS can't recompile an invalid object. The snapshot enables you to restore the database if there is a problem with the conversion. Always check for invalid objects before conversion and fix or drop those invalid objects. For production databases, we recommend testing the conversion process on a copy of your DB instance first.

   For more information, see [Creating a DB snapshot for a Single-AZ DB instance for Amazon RDS](USER_CreateSnapshot.md).

1. Set the `MAX_STRING_SIZE` parameter to `EXTENDED` in a parameter group.

   To set the parameter, you can either create a new parameter group or modify an existing parameter group.

   For more information, see [Parameter groups for Amazon RDS](USER_WorkingWithParamGroups.md).

1. Modify the DB instance to associate it with the parameter group with `MAX_STRING_SIZE` set to `EXTENDED`.

   For more information, see [Modifying an Amazon RDS DB instance](Overview.DBInstance.Modifying.md).

1. Reboot the DB instance for the parameter change to take effect.

   For more information, see [Rebooting a DB instance](USER_RebootInstance.md).