Copying a table between Oracle databases moves data and, optionally, structure from a source DB to a target DB with a database link.
Move reference data, migrate modules, or back-fill analytics without full exports. Using a database link (DB link) avoids downtime and large dump files.
Create a DB link on the target database pointing to the source.Grant the target user CREATE TABLE, INSERT, and SELECT THROUGH DB LINK privileges.
Use CREATE TABLE AS SELECT (CTAS) with the DB link. This builds the table and loads the rows in a single statement.
CREATE TABLE products_copy AS
SELECT * FROM products@source_prod;
Issue an INSERT-SELECT referencing the DB link.Ensure column lists match to avoid order-related errors.
INSERT /*+ APPEND */ INTO orders
SELECT * FROM orders@source_prod
WHERE order_date > SYSDATE - 7;
Yes—use a WHERE clause that returns no rows, such as 1=0.This creates the table definition without data.
CREATE TABLE orderitems_tmpl AS
SELECT * FROM orderitems@source_prod WHERE 1=0;
Enable parallelism, copy during low traffic, disable triggers and indexes, and commit in batches if using INSERT.
CTAS does not copy primary keys, foreign keys, or triggers. Export metadata with DBMS_METADATA and re-apply after load.
Compare row counts with COUNT(*).For deeper checksums, use DBMS_CRYPTO.HASH over concatenated columns.
.
No. The data loads, but you must create a new sequence and trigger or identity column on the target table.
Yes for direct SQL. Without a DB link, you must use Data Pump or export/import utilities.
Enable PARALLEL on both tables, use NOLOGGING, and copy during low-usage windows.