Starts a database on the current database server.
START DATABASE database-file [ start-options ... ]
start-options : [ AS database-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 } ] [ DISKSANDBOX { ON | OFF | DEFAULT } ] [ MIRROR ON ]
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.
If disk sandboxing is enabled, then the database's operations are limited to the directory where the main database file is located. See Disk sandboxing.
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.
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.
If disk sandboxing is enabled, then the database's operations are limited to the directory where the main database file is located. See Disk sandboxing.
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' ); |
DISKSANDBOX clause Set DISKSANDBOX to ON to restrict read-write file operations on the database to the directory where the main database file is located. Set DISKSANDBOX to OFF to allow access to all directories. If DISKSANDBOX is set to DEFAULT, the disk sandbox settings specified by the -sbx database server option are used. See -sbx database server option.
If you start a database server with the -sbx database server option, then you must provide the secure feature key for the manage_disk_sandbox secure feature to start a database with DISKSANDBOX OFF.
MIRROR ON clause Use the MIRROR ON clause to add an additional mirrored database to database servers that are already running and possibly hosting a mirrored database. You must specify the AUTOSTOP OFF clause when using this clause.
Starts a specified database on the current database server.
The START DATABASE statement does not connect the current application to the specified database: an explicit connection is still needed.
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.
You can only use the database name utility_db to connect to the SQL Anywhere utility database.
Anyone can start a database on the personal server (dbeng16).
The required privileges to start a database on a network server are specified by the database server -gd option. By default, the SERVER OPERATOR system privilege is required to start a database on the network server.
None.
SQL/2008 Vendor extension.
This example starts a fictitious database file C:\temp\sample_2.db on the current server:
START DATABASE 'c:\\temp\\sample_2.db'; |
This example starts same database but as sam2:
START DATABASE 'c:\\temp\\sample_2.db' AS sam2; |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |