6. Loading and Unloading Databases : Copying Individual Database Objects : Copy Tables : Example: Move a Table to Another Database
 
Share this page                  
Example: Move a Table to Another Database
In this example, the DBA moves the customers table, owned by John, from the accounts database to the orders database:
1. Enter the following command at the operating system prompt:
copydb ‑ujohn accounts customers
The copy.in and copy.out scripts are generated.
2. Enter the following commands in sequence:
sql ‑ujohn accounts <copy.out
sql ‑ujohn orders <copy.in
There are now two copies of the customers table: one in the accounts database and one in the orders database.
3. The DBA removes the old table by logging into the Terminal Monitor (sql) as ‑ujohn and issues the following statement:
DROP TABLE customers