ALTER STORAGE UNIT

Description

The ALTER STORAGE UNIT syntax is used to alter storage units for the currently selected logical database.

Syntax

Grammar Railroad diagram

  1. AlterStorageUnit ::=
  2. 'ALTER' 'STORAGE' 'UNIT' storageUnitDefinition (',' storageUnitDefinition)*
  3. storageUnitDefinition ::=
  4. storageUnitName '(' ('HOST' '=' hostName ',' 'PORT' '=' port ',' 'DB' '=' dbName | 'URL' '=' url) ',' 'USER' '=' user (',' 'PASSWORD' '=' password)? (',' propertiesDefinition)?')'
  5. storageUnitName ::=
  6. identifier
  7. hostname ::=
  8. string
  9. port ::=
  10. int
  11. dbName ::=
  12. string
  13. url ::=
  14. string
  15. user ::=
  16. string
  17. password ::=
  18. string
  19. propertiesDefinition ::=
  20. 'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
  21. key ::=
  22. string
  23. value ::=
  24. literal

Supplement

  • Before altering the storage units, please confirm that a database exists in Proxy, and execute the use command to successfully select a database;
  • ALTER STORAGE UNIT is not allowed to change the real data source associated with this storageUnit;
  • ALTER STORAGE UNIT will switch the connection pool. This operation may affect the ongoing business, please use it with caution;
  • storageUnitName is case-sensitive;
  • storageUnitName needs to be unique within the current database;
  • storageUnitName name only allows letters, numbers and _, and must start with a letter;
  • poolProperty is used to customize connection pool parameters, key must be the same as the connection pool parameter name.

Example

  • Alter storage unit using standard mode
  1. ALTER STORAGE UNIT ds_0 (
  2. HOST=127.0.0.1,
  3. PORT=3306,
  4. DB=db_0,
  5. USER=root,
  6. PASSWORD=root
  7. );
  • Alter storage unit and set connection pool parameters using standard mode
  1. ALTER STORAGE UNIT ds_0 (
  2. HOST=127.0.0.1,
  3. PORT=3306,
  4. DB=db_1,
  5. USER=root,
  6. PASSWORD=root
  7. PROPERTIES("maximumPoolSize"=10)
  8. );
  • Alter storage unit and set connection pool parameters using URL patterns
  1. ALTER STORAGE UNIT ds_0 (
  2. URL="jdbc:mysql://127.0.0.1:3306/db_2?serverTimezone=UTC&useSSL=false",
  3. USER=root,
  4. PASSWORD=root,
  5. PROPERTIES("maximumPoolSize"=10,"idleTimeout"="30000")
  6. );

Reserved word

ALTER, STORAGE, UNIT, HOST, PORT, DB, USER, PASSWORD, PROPERTIES, URL