To duplicate a table in Oracle, you can use SQL commands like CREATE TABLE AS SELECT or specialized tools such as dbForge Studio for Oracle. Whether you want to create an exact replica with data, copy only the structure, or clone a table across schemas, Oracle provides several options.
In this guide, you'll learn the most common methods to perform Oracle copy table operations, including how to:
Create an exact copy of a table within the same schema.
Clone a table in Oracle without copying data.
Insert duplicate data into an existing table.
Copy a table between different database schemas.
Use a GUI tool to simplify and speed up table duplication.
Copy a table with data within the same Oracle database
Duplicating a table in Oracle is helpful in many scenarios. For example, you might want to:
Create a backup before running updates or deletions.
Test queries on a safe copy without affecting production data.
Migrate data between environments.
Build reporting tables that mirror existing structures.
All these cases require you to know how to perform table duplication. Now, let's explore how you can do it.
How to copy a table with data using SQL
To copy a table with data in Oracle, use the following SQL syntax:
CREATE TABLE new_table_name
AS
SELECT *
FROM original_table;
This command creates a new table that fully replicates the structure and data of the existing one. It is the most common way to make Oracle copy a table with data using the CREATE TABLE AS SELECT statement.
If you need to copy only specific columns instead of the entire dataset, specify them in the query:
CREATE TABLE new_table AS
SELECT column_name1,column_name2
FROM original_table;
In cases where the target table already exists, and you only want to duplicate the data, run the following command:
INSERT INTO new_table
SELECT *
FROM original_table;
This way, you can clone a table in Oracle either with the entire dataset or just the necessary parts, depending on your requirements.
Copy a table to another schema in Oracle
Sometimes you need to duplicate a table into a different schema. For example, when consolidating data, sharing tables with another team, or preparing a separate environment for testing. Oracle allows you to achieve this using SQL commands while ensuring data integrity.
A SQL example with INSERT INTO schema.table
To copy data from a table in your current schema to a table in another schema, use the following syntax:
INSERT INTO target_schema.new_table
SELECT *
FROM source_schema.existing_table;
This approach assumes that the destination table already exists in the target schema. It efficiently transfers all data while keeping the source table intact.
Required user privileges and permissions
The INSERT privilege on the target table or schema.
The SELECT privilege on the source table.
The CREATE TABLE privilege if creating the new table in the target schema.
Without these permissions, Oracle will prevent the operation, ensuring secure and controlled data access across schemas.
By combining these commands with the appropriate privileges, you can reliably perform Oracle copy table operations across schemas, enabling safe data sharing and testing without affecting production tables.
Copy a table without data within the same Oracle database
To copy a table without data in Oracle, use this SQL pattern:
CREATE TABLE new_table_name
AS
SELECT *
FROM existing_table_name WHERE 1=0;
This command creates a new table that replicates only the structure of the original table—including columns, data types, and default values—without copying any of the existing data. It is the most straightforward way to copy an Oracle table without data and is commonly used when you need an empty template for testing, staging, or building new tables based on existing designs.
Using this approach, you can efficiently copy an Oracle table's structure only, ensuring the new table matches the original layout while remaining empty and ready for fresh data.
Copy a table from one Oracle database to another
Copying tables between databases or schemas in Oracle can be essential for testing, reporting, or data migration. Below are the main approaches, divided into practical scenarios.
Copy a table between schemas on the same server
To copy a table from one schema to another within the same Oracle database, use the following SQL syntax:
INSERT INTO new_schema.table
SELECT *
FROM old_schema.table;
Note
Ensure the target table exists and that you have the necessary privileges to perform the copy table operation.
This command duplicates all data from the source table into a table in the target schema. It is a simple and effective method when both schemas reside on the same database server.
Copying a table between remote Oracle databases
When copying an Oracle database table to a database located on another server, you can use database links or tools such as SQL*Plus or dbForge Studio for Oracle. A database link allows you to reference the remote database directly in your SQL query, enabling seamless data transfer. For example:
INSERT INTO remote_table@remote_db_link
SELECT *
FROM local_table;
Before performing this operation, ensure:
You have valid credentials for both databases.
Appropriate privileges (SELECT on the source table and INSERT on the destination table).
Network access between the servers.
By following these instructions, you can efficiently copy an Oracle table to another schema or across databases while preserving data integrity and minimizing downtime.
Create a duplicate table with dbForge Studio for Oracle
Running queries manually requires significant time, that's why if you strive to be
efficient, you will probably want to use an Oracle IDE
that will help you achieve your goals
within a convenient graphical user interface and boost your flexibility with an opportunity
to adjust the process to your requirements.
Step 1. Open dbForge Studio for Oracle
First of all, you should start dbForge Studio for Oracle and connect to your database, just as shown in the screenshot.
Choose a connection type
and enter the valid credentials for your Oracle database instance. Test the connection if necessary.
Step 2. Create a new table
In the Database Explorer, expand the connection node and find the Tables folder.
Right-click the Tables folder and select New Table.
Step 3. Create a table structure
Specify the table name and define the columns to match the structure of the original table. In dbForge Studio for Oracle, this process is streamlined, since the Table Editor allows you to quickly build a create table structure Oracle script by adding columns, setting data types, and adjusting properties.
Note
Make sure the table columns and column properties are the same as the columns of the existing table.
It is important to mention that when performing an Oracle clone table structure operation, the system can automatically map the columns, ensuring that the new table mirrors the original one without requiring manual column setup. Once the structure is ready, click Apply Changes and verify the new table in Database Explorer.
Step 4. Open the Data Comparison Wizard
Use the Data Comparison Wizard to identify differences between the source and target tables. This step ensures accuracy by letting you preview which rows will be copied or updated before any changes are made. You can also filter and select specific tables, making the process more flexible and efficient.
To do that, go to the Comparison tab on the menu and open the Data Comparison Wizard. Specify the connection and select the schema.
Configure the rest of the comparison options if required.
By running an Oracle data comparison, you minimize the risk of duplicating or overwriting unnecessary data. Once the comparison is complete, you can proceed to dbForge Studio table synchronization, ensuring the target table is fully aligned with the source.
Step 5. Configure data comparison options
Choose the comparison mode: by key fields, all rows, or customized filters. This step defines how dbForge Studio for Oracle evaluates differences between the source and target tables. For greater accuracy, you can exclude system fields that should not be compared, apply row filters to narrow the dataset, and select only the columns that matter for synchronization.
To do it, go to the Mapping page and select the tables for
mapping.
Here, you can map tables with different names and structures.
Click the Map Objects button on the toolbar to open the Objects Mapping dialog.
There, you need to specify the source and target tables and click Map. The objects will then
appear in the grid of the Mapping tab. You can skip the table mapping if you want to compare
the data between different schemas. Now, click Compare to start the comparison.
These Oracle compare table options allow you to fine-tune the process and avoid unnecessary data transfers. Once configured, proceed with the table sync configuration to ensure the comparison results reflect exactly what you want to copy or update.
Step 6. Analyze the comparison results
View the comparison results
in the Data Comparison document. Here, you can select the necessary objects for
synchronization and initiate the synchronization by clicking the green arrow.
Step 7. Define synchronization options
In the Data Synchronization Wizard
that opens, you can decide on your further actions as to the synchronization script.
You can open the script in the internal editor, save it for later use, or execute it directly
against the target.
Step 8. Continue configuring the data synchronization
Review the synchronization summary, preview the synchronization script, and check all mappings before executing the operation. dbForge Studio for Oracle provides a detailed action plan showing which rows will be inserted, updated, or deleted, helping you avoid mistakes when you synchronize Oracle tables.
You can also save your synchronization settings for future use, schedule execution at specific times, or even integrate the process into CI/CD pipelines for automated deployments. By using the preview synchronization script, you can take full control over the changes and ensure that only the intended updates are applied. You can configure the data synchronization options as well as check the action plan and the list of warnings on the Summary tab.
Once verified, click Synchronize to complete the process.
Step 9. Make sure the tables are equal
Once the synchronization is complete, validate the table copy in Oracle using comparison reports or the built-in dbForge Data Viewer. This step ensures that every row and column matches between the source and target tables. For a reliable check, you can:
Re-run the Data Comparison Wizard to compare Oracle tables side by side.
Review the synchronization script log to ensure that the table copy is successful.
By following this checklist, you can make sure that the cloned table is identical to the original and ready for use in production, testing, or development environments.
Congratulations! You have cloned your Oracle table!
dbForge Studio vs SQL Developer for duplicating Oracle tables
When it comes to duplicating Oracle tables, both dbForge Studio and SQL Developer provide the necessary functionality, but the user experience and level of automation differ significantly. The table below highlights how each tool handles structure cloning, data copying, and synchronization.
Features
dbForge Studio
SQL Developer
Interface simplicity
A modern GUI with intuitive wizards
Less streamlined, requires a manual setup
Copy structure and data
Built-in Data Compare Wizard
Requires an INSERT script or export/import
Triggers, grants, and sequences
Can be included in a synchronization operation
Must be extracted manually
Cross-schema copy support
Yes, supported via the UI
Requires manual script adjustments
Preview before executing
Preview the synchronization script and view differences
Limited, mostly post-execution analysis
Data filtering
Supports filtering by column or row conditions
Requires WHERE clauses manually
Rollback support
Optional transactional synchronization
Manual only
Ease of use for non-developers
A beginner-friendly interface
Steeper learning curve
Overall, dbForge Studio for Oracle provides a faster and more intuitive way to duplicate Oracle tables, especially for users who need automation, preview options, and cross-schema support. SQL Developer remains a capable choice but often requires more manual scripting and setup.
In this article, we have reviewed various ways of creating a duplicate table in Oracle: we have started
by executing Oracle SQL commands and then looked at the way the same procedures are performed via
the intuitive interface of dbForge Studio for Oracle. The IDE delivers robust
comparison functionality
and empowers you to take your Oracle database interaction to a whole new level.
Check out other useful features provided by this powerful Oracle GUI tool!
FAQ
How do I copy a table in Oracle with all constraints and indexes?
To perform an Oracle copy table with constraints operation, you can't rely on a simple CREATE TABLE AS SELECT, since it only reproduces the structure and data. Instead, use tools like dbForge Studio for Oracle, which can clone a table in Oracle along with indexes, primary keys, foreign keys, and other dependencies. This ensures the new table mirrors the original, both structurally and functionally.
What's the difference between copying and creating a table in Oracle?
The difference lies in the intent and the scope. When you use CREATE TABLE in Oracle, you are defining a brand-new table with specified columns and data types. By contrast, performing an Oracle duplicate table operation means reusing an existing table's structure (and optionally its data) to generate a copy. The most common method is by using the Oracle CREATE TABLE AS SELECT statement, which allows you to build a new table that either includes both structure and rows from the original or just the structure if you add a condition such as WHERE 1=0.
How can I copy only the structure of a table without data in Oracle?
To copy a table in Oracle without data, use CREATE TABLE AS SELECT with a condition like WHERE 1=0. This way, you let Oracle copy the table structure only, creating a new table with the same columns but no rows.
How do I copy a table to another schema in Oracle?
To enable Oracle to copy a table to another schema, create a target table in the destination schema and use INSERT INTO target_schema.table SELECT * FROM source_schema.table. This copies the data while preserving the table structure and allows cross-schema duplication efficiently.
Which tool is better for duplicating tables: dbForge Studio or SQL Developer?
When comparing dbForge vs SQL Developer for duplicating tables, dbForge solution is generally more efficient and user-friendly. With features such as Copy Table Wizard, Oracle dbForge copy table options, and automated preservation of constraints, indexes, and triggers, dbForge Studio for Oracle reduces manual work, whereas SQL Developer often requires scripting and manual adjustments.
How do I duplicate a partitioned table in Oracle?
To clone a table in Oracle for a partitioned table, you need to replicate both its structure and partitioning scheme. For this, use CREATE TABLE AS SELECT. Still, for complete partitioning and constraints, tools like dbForge Studio for Oracle can simplify the process and ensure a new table mirrors the original setup.
How can I copy a table in Oracle using SQL only?
To copy a table using SQL only, use the Oracle CREATE TABLE AS SELECT statement. This method lets Oracle copy a table with data, creating a new table that replicates both the structure and the rows from the original table.
Can I include triggers and grants when duplicating a table?
Yes, when you clone a table in Oracle using tools like dbForge Studio, you can include triggers, grants, and other dependencies. This ensures that an Oracle copy table with constraints operation preserves not only the table's structure and data but also all associated constraints, rules, and permissions.
How do I validate that the copied table matches the original exactly?
To ensure accuracy, you can compare Oracle tables using tools like dbForge Studio's Data Comparison Wizard. This allows you to validate a table copy in Oracle by verifying that all rows, columns, and data types match between the source and target tables.
What's the fastest way to clone an Oracle table with structure and data?
The fastest way to duplicate a table, including both its structure and data, is by using an Oracle table copy tool such as dbForge Studio for Oracle. With the Oracle dbForge copy table feature, you can quickly clone a table without writing complex SQL, while also preserving constraints, indexes, and triggers.