The copydb command creates command files containing the SQL statements required to copy and restore a database. The command creates the following two command files in the current directory:
To copy the database, you must execute the SQL commands in the copy.in and copy.out command files.
The name of a file created by copy.out consists of the name of the table followed by an extension made up of the first three letters of the owner's login name. If file names collide, a unique digit replaces the last character of the table name segment.
Note: It is important that the database be recreated with copy.in before doing any work (for example, creating tables, forms, applications, or reports) in the new database. After recreating a database, be sure to run sysmod to optimize storage structures.
System catalogs cannot be copied using copydb. Use unloaddb to copy a complete database, including system catalogs.
Copydb can be used to change ownership of tables. For details, see the Database Administrator Guide.
Note: When copydb is run from an Ingres 2006 Release 2 installation against an older version of Ingres, the copy.in script generated will contain the data type INGRESDATE instead of DATE for any date columns in create table statements.
The copydb command has the following format:
copydb [-param_file=filename] | [dbname|vnode::dbname[/server_class] [-c]
[-row_labels] [-uusername] [-Ggroupid] [-parallel]] [-journal] [-P]
[-source=dirname] [-dest=dirname] [-ddirname] [-with_tables] [-with_modify]
[-with_data] [-all] [-order_ccm] [-with_index] [-with_constr] [-with_views]
[-with_synonyms] [-with_events] [-with_proc] [-with_reg] [-with_rules]
[-with_alarms] [-with_comments] [-with_roles] [-with_sequences] [-add_drop]
[-infile=filename] [-outfile=filename] [-with_permits] [-relpath] [-no_loc]
[-no_perm] [-noint] [-no_persist] [-no_repmod] [-no_seq] [-nodependency_check]
[-online] {tablename|viewname}] [-help]
Reads filename for all other command line flags, database names, and any other command line arguments. This file must contain only one flag per line (see the examples that follow this table). If this flag is specified, no other flags or arguments can appear on the command line; they must, however, appear in the specified file.
Specifies the name of the database and, if required, the vnode and server_class, as described in Standard Flags and Parameters.
Creates a printable data file. This is useful for transporting databases between computer systems whose internal representations of non-ASCII data differ. (When you restore a database from a file created using the –c flag, the copy command automatically converts data stored in this format back to the appropriate type.)
Copydb cannot represent the following types of data using printable characters: (1) binary data stored in varchar columns, and (2) user-maintained logical keys.
Copies the row labels.
Specifies the effective user for the session, as described in Standard Flags and Parameters and Schema Qualifier.
Specifies a group identifier, as described in Standard Flags and Parameters. You must enclose this parameter in double quotation marks ("-Ggroupid").
Creates indexes using the parallel index creation syntax (to build multiple indexes concurrently).
Replaces the "set nojournaling" statement in the copy.in scripts with the "set journaling" statement, and disables specifying the "with nojournaling" option on each create table statement in copy.in script. When using the –journal flag, fastload is not possible when loading the tables.
Prompts for password if the session requires one.
Specifies the directory that contains the data files and from which copy.in will be run. An empty dirname specification ("") denotes the current directory. The –source specification overrides a –d specification for the copy in file.
If a source is specified without a destination (no –d or –dest), the default copy out directory is used.
The source directory specification is not checked for validity or existence. This allows the scripts to be moved to another machine.
Specifies the directory where the data files created by copy.out will be stored. An empty dirname specification (".") denotes the current directory. The –dest specification overrides a –d specification for the copy out file.
If a destination is specified without a source (no –source) then the default copy in directory is used.
The destination directory specification is not checked for validity or existence. This allows the scripts to be moved to another machine. The destination directory must be different from the database directory, $II_DATABASE/ingres/data/default/dbname, because the files have the same names as the table files.
Stores the copy.in and copy.out files in the specified directory instead of the default current directory. The file name must be fully specified.
Prints only the create statements.
Prints only the modify statements.
Prints only the copy statements.
Prints all the statements related to the database.
Determines the order in which the copy and modify statements are written for the table. The default is to modify and then copy. If –CCM is specified, the order is to copy and then modify.
Prints statements only related to index.
Prints statements only related to constraints, such as alter table statements.
Prints statements only related to views.
Prints statements only related to synonyms.
Prints statements only related to event.
Prints statements only related to procedure.
Print statements only related to registration.
Prints statements only related to rules.
Prints statements only related to security alarms.
Prints statements only related to comments.
Prints statements only related to roles.
Prints statements only related to sequences.
Does not print sequence related statements.
Writes a drop statement also, before writing the create statements. This is useful when the scripts are run repeatedly in case of errors, and tables are already created.
Specifies an input file name for the copy.in file, so user can run copydb with different options and give different names for infile.
Specifies an output file name for the copy.out file.
Prints statements only related to permits.
Removes the paths from the file names; the files will thus be created and copied from the current directory.
Runs the copydb statement uninterrupted for all the tables.
Does not write the location clause for create table, create index, or modify statements.
Does not print grant statements.
Does not write create index statements for indexes that have been created with the "with persistence" clause.
Does not write modify table statements for Ingres Replicator system tables of a replicated database.
Adds the WITH NODEPENDENCY_CHECK option to any MODIFY commands generated. This option forces a table modify operation and destroys indexes needed for constraints.
Important! If you use this option, you must preserve or recreate the table structure necessary to enforce the constraints.
Adds the "with concurrent_updates" option to the modify statement, if a modify is specified.
Specifies the tables to be copied. If omitted, all tables are copied. This could also be a list of views; in that case only the given views are copied.
The table name can be qualified with a valid schema name in the format schema.tablename, as described in Schema Qualifier.
Note: No more than 100 objects can be specified. This limit can be raised by modifying the utexe.def file. For more information, see the Database Administrator Guide.
Displays command syntax online.
The following commands make a copy of olddb. In this example, replace the named directory (\mydir\backup) with your own:
cd \mydir\backup
copydb olddb
sql olddb<copy.out
The following example creates a new database newdb:
createdb newdb
sqlnewdb<copy.in
sysmod newdb
The following command runs copydb with parameters supplied in a file called flagfile:
copydb -param_file=flagfile
where flagfile can contain the following entries:
dbname
-order_ccm
-relpath
-no_loc
-all
This is equivalent to the command:
copydb dbname -order_ccm -relpath -no_loc -all
These commands copy mydb to tape. In this example, replace the named directory (/usr/mydir/backup) with your own:
cd /usr/mydir/backup
copydb mydb /usr/mydir/backup
sql mydb <copy.out
tar c
rm *
The following commands copy a tape to mydb. In this example, replace the named directory (/usr/mydir/backup) with your own:
cd /usr/mydir/backup
tar xvpf /dev/rmt0
sql mydb <copy.in
sysmod mydb
These commands make a static copy of olddb. In this example, replace the named default directory (mydir.backup) with your own:
createdb newdb
set default [mydir.backup]
copydb olddb
sql olddb <copy.out
Next, the following commands make a copy backup of olddb into newdb. In this example, replace the named default directory (mydir.backup) with your own:
set default [mydir.backup]
sql newdb <copy.in
sysmod newdb