15. Performing Backup and Recovery : Backup by Copying : Back Up Tables with Copydb Command
 
Share this page                  
Back Up Tables with Copydb Command
Before using this procedure, see the chapter “Loading and Unloading Databases” to understand how copydb works.
To back up tables with copydb
1. Create a temporary working directory for the copy.in and copy.out scripts and move to this directory. For example, you might issue the following commands at the operating system prompt:
Windows:
mkdir D:\tmp\mydir.backup
D:
cd \tmp\mydir.backup
UNIX:
mkdir /tmp/mydir.backup
cd /tmp/mydir.backup
VMS:
create/dir MYDIR.BACKUP
set default [MYDIR.BACKUP]
2. To back up specified tables, issue the following command at the operating system prompt:
copydb dbname tablename {tablename}
To back up all the tables, views, and procedures that you own in the database, issue the following command at the operating system prompt:
copydb dbname
This creates copy.out and copy.in scripts for the objects copied.
3. To copy the data out of the database, issue the following command from the operating system:
sql dbname <copy.out
This creates a copy of the objects copied from your database.You can store these files on tape or leave them on disk.
To restore data from a copydb backup, you run the copy.in script.