ALTER DATABASE

 

Function

ALTER DATABASE updates the database's Connection Properties.

 

Syntax

 

alter_database.bmp

 

SET DBID clause:

set_dbid_clause.bmp

 

SET DATABASE NAME clause:

set_database_name_clause.bmp

 

SET DEFAULT SERVER clause:

set_default_server_clause.bmp

 

SET DEFAULT PORT clause:

set_default_port_clause.bmp

 

 

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:

 

  • For Adabas only:

ALTER DATABASE <dbname> [set 
 dbid=<number>]  | [set defaultserver=<name> apply=(allusers, 
 currentuser, nouser)] | [set defaultport=<port#>]

where

dbname = Name of the Database (example localhost, Sales, ...)  

set dbid = Number from 1-255

set defaultserver = default server

apply = level of affected users

allusers = change apply to all 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

 

  • 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 physicaldatabasename = physical database property

set defaultserver = default server

apply = level of affected users

allusers = change apply to all 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

  1. Change the dbid to 57

Alter Database EMPLOYEES set 
 dbid=57  
  1. 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
  1. 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
  1. 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
  1. Change the default port to 7505

Alter 
 Database EMPLOYEES set defaultport=7505
  1. Change the physical database name to cnxdir:connx_rdb_examples

Alter Database EMPLOYEES set 
 physicaldatabasename = cnxdir:connx_rdb_examples