Starts a database on the current database server.
START DATABASE database-file [ start-options ... ]
start-options : [ AS database-name ] [ ON database-server-name ] [ WITH TRUNCATE AT CHECKPOINT ] [ FOR READ ONLY ] [ AUTOSTOP { ON | OFF } ] [ KEY key ] [ WITH SERVER NAME alternative-database-server-name ] [ DIRECTORY dbspace-directory ] [ CHECKSUM { ON | OFF } ]
database-file The database-file parameter is a string. If a relative path is supplied in database-file, it is relative to the database server starting directory.
start-options clause The start-options clauses can be listed in any order:
AS clause If database-name is not specified, a default name is assigned to the database. This default name is the root of the database file. For example, a database in file C:\Database Files\demo.db would be given the default name of demo. The database-name parameter is an identifier.
ON clause This clause is supported from Interactive SQL only. In Interactive SQL, if server-name is not specified, the default server is the first started server among those currently running. The server-name parameter is an identifier.
WITH TRUNCATE AT CHECKPOINT clause Starts a database with log truncation on checkpoint enabled.
FOR READ ONLY clause Starts a database in read-only mode. When used on a database requiring recovery, the statement fails and the error message is returned.
AUTOSTOP clause The default setting for the AUTOSTOP clause is ON. With AUTOSTOP set to ON, the database is unloaded when the last connection to it is dropped. If AUTOSTOP is set to OFF, the database is not unloaded.
In Interactive SQL, you can use YES or NO as alternatives to ON and OFF.
KEY clause If the database is strongly encrypted, enter the KEY value (password) using this clause.
WITH SERVER NAME clause Use this clause to specify an alternate name for the database server when connecting to this database.
When using database mirroring, an alternate server name must be specified for client applications to be able to connect to the current primary server without knowing in advance which server is the primary server and which is the mirror server. Both partner servers must use the same name for the alternate server name. Use the CREATE MIRROR SERVER statement to create the alternate server names for the primary and mirror servers in a mirroring system.
DIRECTORY clause
Use this clause to specify the directory where the dbspace files are located for the database that is being started.
For example, if the database server is started in the same directory as the dbspaces, and you include the DIRECTORY '.'
clause, then this instructs the database server to find all dbspaces in the current directory.
CHECKSUM clause Use this clause to enable write checksums for newly written pages for databases that were not created with global checksums enabled. This clause has the same behavior as the -wc database option.
The difference between the CHECKSUM clause and creating a database with global checksums enabled is that when you specify CHECKSUM ON, database pages are checksummed only when they are written out to disk. Pages that are read from disk are only verified if a checksum value was calculated before the pages were written. If a database has global checksums enabled, checksums are calculated for all pages when they are written and checksums are verified for all pages when they are read.
If the database server detects that the database is running on Windows Mobile or a removable storage device, such as a network share or USB device, then the database server automatically enables write checksums for all database pages.
By default, databases created with version 10 and 11 of SQL Anywhere do not have global checksums enabled. If you start a database created with SQL Anywhere 10 or 11 on a version 12 or later database server, then by default the database server creates write checksums for pages when they are written to disk (CHECKSUM ON). Version 12 and later databases have global checksums enabled by default, so the database server defaults to CHECKSUM OFF for these databases because by default all database pages have checksums. You can use either the -wc option or the START DATABASE statement to change the database server's checksum behavior if you do not want to use the default checksum settings.
You can check whether a database was created with global checksums enabled by executing the following statement:
SELECT DB_PROPERTY ( 'Checksum' ); |
You can check whether write checksums are enabled by executing the following statement:
SELECT DB_PROPERTY ( 'WriteChecksum' ); |
Cloud note: This statement is not supported on tenant databases in the cloud.
Starts a specified database on the current database server.
If you are not connected to a database and you want to use the START DATABASE statement, you must first connect to a database, such as the utility database.
The START DATABASE statement does not connect the current application to the specified database: an explicit connection is still needed.
Interactive SQL supports the ON clause, which allows the database to be started on a database server other than the current.
You can only use the database name utility_db to connect to the SQL Anywhere utility database.
The required permissions are specified by the database server -gd option. This option defaults to all on the personal database server, and DBA on the network server.
None.
SQL/2008 Vendor extension.
Start the database file C:\Database Files\sample_2.db on the current server.
START DATABASE 'c:\database files\sample_2.db'; |
From Interactive SQL, start the database file c:\Database Files\sample_2.db as sam2 on the server named sample.
START DATABASE 'c:\database files\sample_2.db' AS sam2 ON sample; |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |