ALTER DATABASE
Function
ALTER DATABASE updates the database's Connection Properties.
Syntax
ALTER DATABASE database_name [SET DBID clause | SET DATABASE NAME clause] [SET DEFAULT SERVER clause] [SET DEFAULT PORT clause]
SET DBID clause syntax:
SET DBID = db_id
SET DATABASE NAME clause syntax:
SET PHYSICALDATABASENAME = physical_database_property
SET DEFAULT SERVER clause syntax:
SET DEFAULTSERVER = default_server APPLY = ( [DEFAULTONLY | CURRENTUSER | ALLUSERS] )
SET DEFAULT PORT clause syntax:
SET DEFAULTPORT = default_port_identifier
Description
ALTER DATABASE changes the database connection attributes, including the physical database name, the port, and (for Adabas databases) the dbid. ALTER DATABASE has two formats:
Exclusive to Adabas:
ALTER DATABASE <dbname> [set dbid=<number>] | [set defaultserver=<name> apply=(allusers, currentuser, nouser)] | [set defaultport=<port#>]
For all other databases:
ALTER DATABASE <dbname> [set physicaldatabasename = <physical database property> | [set defaultserver=<name> apply=(allusers, currentuser, nouser)] | [set defaultport=<port#>]
where

dbname | Name of the Database (example localhost, Sales, ...)
set dbid (exclusive to Adabas) | Number from 1-255
set physicaldatabasename | physical database property.
set defaultserver | default server
apply | level of affected users
allusers | change applies to all users who access this database (default values)
currentuser | changes only apply to the current (logged in) user
defaultonly | no changes (only applies to future users)
set defaultport | default port

Limitations
Only administrators (members of the group CONNXCDDAdministrators) can use ALTER DATABASE.
Both the source database (dbname) and the target database (dbid or physicaldatabasename/defaultserver) must exist prior to issuing this command.
Every table mapped in the CDD in the source database must be in the target database.
Every shared source and target table mapped in the CDD must have identical structure.
defaultport cannot be the only attribute that changes.
Both the source and target databases must have the same type. You cannot use this command to change the fundamental database type (for example, no RMS to VSAM).
ANSI Specifics
The ALTER DATABASE statement is not part of the ANSI Standard.
Examples
Change the dbid to 57:
ALTER DATABASE EMPLOYEES set dbid=57
Change the default server to PRODUCTION, and change any users that are registered for EMPLOYEES to connect to the PRODUCTION server:
ALTER DATABASE EMPLOYEES set defaultserver=PRODUCTION apply=allusers
Change the default server to PRODUCTION, and change only the user that is logged in to point to PRODUCTION for their database connection to EMPLOYEES:
ALTER DATABASE EMPLOYEES set defaultserver=PRODUCTION apply=currentuser
Change the default server to PRODUCTION, but ensure this change does not affect users that are pointing to the prior default server:
ALTER DATABASE EMPLOYEES set defaultserver=PRODUCTION apply=defaultonly
Change the default port to 7505:
ALTER DATABASE EMPLOYEES set defaultport=7505
Change the physical database name to cnxdir:connx_rdb_examples:
ALTER DATABASE EMPLOYEES set physicaldatabasename = cnxdir:connx_rdb_examples