Difference between revisions of "COPY DATABASE"

From Recital Documentation Wiki
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
 
==Purpose==
 
==Purpose==
 
Copies the specified database to a new database
 
Copies the specified database to a new database
Line 5: Line 4:
  
 
==Syntax==
 
==Syntax==
COPY DATABASE <database name1> TO <database name2>[IF [NOT] EXISTS]  
+
COPY DATABASE <database name1> TO <database name2> [IF [NOT] EXISTS]  
  
  
 
==See Also==
 
==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]]
+
[[ADATABASES()]], [[ADD TABLE]], [[ALTER INDEX]], [[ALTER TABLE]], [[BACKUP DATABASE]], [[CLOSE DATABASES]], [[CLOSE TABLES]], [[COMPILE DATABASE]], [[CREATE DATABASE]], [[CREATE INDEX]], [[CREATE TABLE]], [[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]]
  
  
Line 15: Line 14:
 
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.
 
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.
+
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 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==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
copy database southwind to temp if exists;
+
copy database southwind to temp if exists
 
</code>
 
</code>
  

Latest revision as of 17:32, 22 December 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 INDEX, CREATE TABLE, 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 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