View or modify ApsaraDB RDS for SQL Server database attributes in the console. You can also shrink the database transaction log and update database statistics to optimize performance and query efficiency.
Prerequisites
A database is created.
View or modify database attributes
Precautions
Modifying certain database attributes causes the database to temporarily enter exclusive mode. This disconnects all current connections and rolls back existing transactions. If the database is under a high load, the modification may fail. We recommend that you perform this operation during off-peak hours.
Exclusive mode allows only one user or process to operate on the database at a time.
Procedure
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the left-side navigation pane, click Databases.
-
Find the target database. In the Actions column, click View Details to view its attribute values.
NoteFor a detailed description of each attribute, see Appendix: Database attributes or the official Microsoft documentation.
-
In the Allowed Values column, modify an attribute's value and click Submit.
For example, for the parameterization attribute, select SIMPLE or FORCED from the drop-down list, and then click Submit at the right of the corresponding row.
Shrink the database transaction log
Scenarios
If the used space of the transaction log file (LogUsedSizeInMB) is small relative to its total size (TotalLogSizeInMB) and the log_reuse_wait_desc attribute is Nothing, you can shrink the transaction log to reduce disk space usage.
Procedure
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the left-side navigation pane, click Databases.
-
In the Actions column, choose More > Shrink Database Transaction Logs.
-
Click OK.
Update database statistics
As the volume and distribution of data in a database change over time, periodically updating statistics helps maintain accurate and efficient query optimization.
Scenarios
-
During a major version upgrade, the new version may introduce new data types, storage engines, or query optimizers, which can render old statistics inaccurate. Update statistics to adapt to the new engine.
-
When you migrate a database from an on-premises deployment to the cloud, the change in environment may require re-optimized performance. Update statistics to improve query performance and optimize query plans.
-
If your business data is unevenly distributed, if you perform a large number of delete or update operations but the updated volume is less than 20%, or in other scenarios not covered by the built-in automatic statistics updates of SQL Server, update statistics to improve query performance.
NoteBy default, SQL Server automatically updates statistics. However, the frequency of automatic updates may lag behind actual data changes, which can degrade query performance. For more information about the automatic statistics update mechanism of SQL Server, see the official Microsoft documentation.
Precautions
Updating statistics can cause high I/O usage. We recommend that you perform this operation during off-peak hours.
Procedure
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
-
In the left-side navigation pane, click Databases.
-
In the Actions column, choose More > Update Database Statistics.
-
Click OK.
Appendix: Database attributes
Basic information
|
Parameter |
Description |
|
page_verify |
The verification level of database pages. The default value is CHECKSUM, which verifies each data page by its checksum. |
|
target_recovery_time_in_seconds |
The target recovery time, in seconds, for the database in the event of a failure. The default value is 60. |
|
compatibility_level |
The database compatibility level for a specific SQL Server version. Valid values:
|
|
parameterization |
How SQL Server handles parameterization. Valid values:
|
|
read_committed_snapshot |
Whether to use snapshot isolation when data is read. Valid values:
|
|
collation_name |
The collation and character encoding of the database. For more information, see Change the character set collation and time zone. |
|
auto_close |
Whether to automatically close the database connection. The default value is OFF (disabled). |
|
recovery_model_desc |
The recovery model of the database. The default value is FULL, which indicates the full recovery model. |
|
auto_update_statistics |
Whether to enable automatic statistics updates. Valid values:
|
|
auto_update_statistics_async |
Whether to update statistics asynchronously. Valid values:
|
|
allow_snapshot_isolation |
Whether to enable the snapshot isolation level. Valid values:
|
|
state_desc |
The status of the database. ONLINE indicates that the database is online. |
|
create_date |
The time when the database was created. |
|
log_reuse_wait_desc |
The reason the current transaction log cannot be reused. NOTHING indicates that no conditions are preventing log reuse. |
Runtime information
|
Parameter |
Description |
|
TotalDataSizeInMB |
The total size of the database data files, in MB. |
|
DataUsedSizeInMB |
The space used by the database data files, in MB. |
|
TotalLogSizeInMB |
The total size of the database log files, in MB. |
|
LogUsedSizeInMB |
The space used by the database log files, in MB. |
|
VLFCount |
The number of virtual log files (VLFs) in the database. |
|
LastestBackupTime |
The time of the last database backup. |
|
LastestBackupType |
The type of the last database backup. Valid values:
|
Advanced information
|
Parameter |
Description |
|
accelerated_database_recovery |
Whether to enable Accelerated Database Recovery (ADR). ADR provides fast database recovery by using versioned storage and logical rollback, significantly reducing downtime caused by restarts or failures. This feature is suitable for OLTP systems with frequent long-running transactions that require high availability. Valid values:
Note
|
|
ansi_nulls |
Whether to enable ANSI NULL behavior. When enabled, comparisons with NULL always return UNKNOWN instead of TRUE or FALSE. Valid values:
|
|
recursive_triggers |
Whether to allow triggers to fire recursively. Valid values:
|
|
delayed_durability |
Whether to enable delayed durability. Delayed durability allows transactions to write data to disk asynchronously after a commit, improving transaction throughput. Valid values:
|
|
ansi_warnings |
Whether to enable ANSI warnings. When enabled, warnings are returned for operations that cause warning conditions. Valid values:
|
|
ansi_null_default |
Whether a column accepts NULL values when you insert data and the specified value is NULL. Valid values:
|
|
ansi_padding |
Whether to enable ANSI padding. When enabled, if the inserted data is shorter than the defined column length, padding characters are added. Valid values:
|
|
db_owner |
The owner of the database. The database owner has the highest level of permissions, including deleting the database, modifying all objects, and managing user permissions. The default value is typically the account that created the database. The owner must be a valid user account in the current instance. Note
Modifying the |
|
concat_null_yields_null |
Whether concatenating a value with NULL returns NULL. When enabled, any string concatenation involving NULL produces a NULL result. Valid values:
|
Related API
You can modify the attributes of an ApsaraDB RDS for SQL Server database by calling the ModifyDatabaseConfig API.