Difference between revisions of "COPY DATABASE"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
{{YLM to do}}
+
 
 +
==Purpose==
 +
Copies the specified database to a new database
 +
 
 +
 
 +
==Syntax==
 +
COPY DATABASE <database name1> TO <database name2>[IF [NOT] EXISTS]
 +
 
 +
 
 +
==See Also==
 +
[[ADATABASES()]], [[ADD TABLE]], [[ALTER INDEX]], [[ALTER TABLE]], [[BACKUP DATABASE]], [[CLOSE DATABASES]], [[CLOSE TABLES]], [[COMPILE DATABASE]], [[CREATE DATABASE]], [[CREATE TABLE]], [[CREATE INDEX]], [[CREATE VIEW]], [[DATABASE()]], [[DB_DATADIR]], [[DBUSED()]], [[DISPLAY DATABASE]], [[DISPLAY INDEXES]], [[DISPLAY SCHEMAS]], [[DISPLAY TABLES]], [[DROP DATABASE]], [[DROP INDEX]], [[DROP TABLE]], [[GETENV()]], [[LIST DATABASE]], [[LIST INDEXES]], [[LIST SCHEMAS]], [[LIST TABLES]], [[OPEN DATABASE]], [[PACK DATABASE]], [[REBUILD DATABASE]], [[REINDEX DATABASE]], [[RESTORE DATABASE]], [[SET AUTOCATALOG]], [[SET EXCLUSIVE]], [[SQL USE|USE]]
 +
 
 +
 
 +
==Description==
 +
The COPY DATABASE command is used to copy an existing database to a new database.  By default an error will be returned if the target database already exists.  Specifying the optional IF NOT EXISTS keywords no error will be returned if the target database already exists.  If the optional IF EXISTS keywords are specified and the target database already exists, then it will be removed before the copy.  Both the databases must be closed before they can be copied.
 +
 
 +
Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database.  Operating System file protection can be applied individually to the files for added security.  The directories are sub-directories of the Recital data directory.  The environment variable / symbol DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function.  Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality.
 +
 
 +
 
 +
==Example==
 +
<code lang="recital">
 +
copy database southwind to temp if exists;
 +
</code>
 +
 
 +
 
 +
==Products==
 +
Recital, Recital Server
 +
[[Category:Documentation]]
 +
[[Category:SQL]]
 +
[[Category:Commands]]
 +
[[Category:Databases]]
 +
[[Category:Databases Commands]]

Revision as of 14:53, 30 October 2009

Purpose

Copies the specified database to a new database


Syntax

COPY DATABASE <database name1> TO <database name2>[IF [NOT] EXISTS]


See Also

ADATABASES(), ADD TABLE, ALTER INDEX, ALTER TABLE, BACKUP DATABASE, CLOSE DATABASES, CLOSE TABLES, COMPILE DATABASE, CREATE DATABASE, CREATE TABLE, CREATE INDEX, CREATE VIEW, DATABASE(), DB_DATADIR, DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY SCHEMAS, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), LIST DATABASE, LIST INDEXES, LIST SCHEMAS, LIST TABLES, OPEN DATABASE, PACK DATABASE, REBUILD DATABASE, REINDEX DATABASE, RESTORE DATABASE, SET AUTOCATALOG, SET EXCLUSIVE, USE


Description

The COPY DATABASE command is used to copy an existing database to a new database. By default an error will be returned if the target database already exists. Specifying the optional IF NOT EXISTS keywords no error will be returned if the target database already exists. If the optional IF EXISTS keywords are specified and the target database already exists, then it will be removed before the copy. Both the databases must be closed before they can be copied.

Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directories are sub-directories of the Recital data directory. The environment variable / symbol DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function. Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality.


Example

copy database southwind to temp if exists;


Products

Recital, Recital Server