As you noticed, my posts run around my daily problems, and this isn't an exception. Past week I needed to copy large amount of data between production and development database to perform some tests. After some research I've found SQL*Plus COPY command, that fits like a glove in my needs.
So here's the syntax:
COPY FROM database TO database action
destination_table (column_name, column_name...) USING query
where action stands for:
- create - if destination table doesn't exist yet;
- replace - if destination table exists and we wish to drop and create it again;
- append - Inserts data if table exist, otherwise it will be created;
- insert - Insert data into an existing table.
An example could be :
SQL>copy from user/pass@DB1Enjoy!
to user2/pass2@DB2
append new_emp
using select * from emp;