Increases the amount of space allocated to a database. Synchronizes proxy table metadata with tables at remote location.
alter database database_name [on {default | database_device } [= size] [, database_device [= size]]...] [log on { default | database_device } [ = size ] [ , database_device [= size]]...] [with override] [for load] [for proxy_update]]
If a database has been created with the optional clause with default_location = pathname, then alter database, with the for proxy_update clause, resynchronizes the proxy tables in the named database with tables and views found in the path name to the remote location.
The default location may also have been specified with sp_defaultloc. The for proxy_update clause of alter database works the same way in this case.
This is a convenient, one-step procedure for keeping the proxy table definition in sync with the definition of actual tables and views in a remote database.
If for proxy_update is specified with no size or device name, then the size is not altered; only proxy table synchronization is performed.
In some cases, a database may not be large enough to contain all proxy table definitions; therefore, it may be necessary to change the size as well when the for proxy_update clause is used.
When for proxy_update is used, the names of remote tables and views are obtained from the server specified in the default location for the database (master.dbo.sysdatabases.default_loc) using the RPC named sp_tables. For each user table and view, column attributes are then obtained, using the RPC named sp_columns. Once all metadata has been obtained for a table (or view), an internal command is executed which is equivalent to create existing table, causing the proxy table to be created within the named database.
If the proxy table already exists, it is automatically dropped before the internal create existing table command is executed.
After the proxy table is created, index metadata is obtained from the remote location so that indexes on the proxy table can also be created. Index metadata is obtained from the remote server using the RPC sp_statistics.
This command behaves the same way for all server classes; interaction with the remote server associated with the database default location is limited to the RPCs sp_tables, sp_columns and sp_statistics (to import index information).
alter database for proxy update drops all proxy tables in the proxy database.
create database in the Reference Manual.