Previous Topic

Next Topic

copydb Command—Copy and Restore a Database

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]

Previous Topic

Next Topic

copydb Example on Windows

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

Previous Topic

Next Topic

copydb Example on UNIX

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

Previous Topic

Next Topic

copydb Example on VMS

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


© 2007 Ingres Corporation. All rights reserved.