Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - SQL Reference » Using SQL » SQL statements » SQL statements (P-Z)



Use this statement to start a database on the current database server.

START DATABASE database-file [ start-options ... ]
start-options :
[ AS database-name ]
[ ON database-server-name ]
[ KEY key ]
[ WITH SERVER NAME alternative-database-server-name ]
[ DIRECTORY dbspace-directory ]
  • 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 clauses   The start-options 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. If you are using database mirroring, the primary and mirror servers must both have the same database server name because clients do not know to which server they are connecting.

      For more information about alternate server names and database mirroring, see -sn database option and Introduction to database mirroring.

    • 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. See -ds database option.


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.

For information about the utility database, see Using 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. See Using the 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.

Side effects


See also
Standards and compatibility
  • SQL/2003   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;