Chapter 7. SQL Remote Design for Adaptive Server Anywhere

To set the global database identification number

1.You set the identification number of a database by setting the value of the public option Global_database_id. The identification number must be a non-negative integer.

For example, the following statement sets the database identification number to 20.

SET OPTION PUBLIC.Global_database_id = 20

If the partition size for a particular column is 5000, default values for this database are selected from the range 100001–105000.

Setting unique database identification numbers when extracting databases

If you use the extraction utility to create your remote databases, you can write a stored procedure to automate the task. If you create a stored procedure named sp_hook_dbxtract_begin, it is called automatically by the extraction utility. Before the procedure is called, the extraction utility creates a temporary table named #hook_dict, with the following contents:

 

name

value

 

 

 

 

 

extracted_db_global_id

user ID being extracted

 

If you write your sp_hook_dbxtract_begin procedure to modify the value

 

column of the row, that value is used as the GLOBAL_DATABASE_ID

 

option of the extracted database, and marks the beginning of the range of

 

primary key values for GLOBAL DEFAULT AUTOINCREMENT values.

Example

Consider extracting a database for remote user user2 with a user_id of 101.

 

If you do not define an sp_hook_dbxtract_begin procedure, the extracted

 

database will have Global_database_id set to 101.

If you define a sp_hook_dbxtract_begin procedure, but it does not modify any rows in the #hook_dict then the option will still be set to 101.

If you set up the database as follows:

131

Page 149
Image 149
Sybase DC38133-01-0902-01 To set the global database identification number, Database will have Globaldatabaseid set to