In the Oracle Copy Command, the Copy command of SQL * Plus is a common task for Oracle DBAs to copy data between data tables. Oracle provides N solutions, the SQL * Plus Copy command is one of them. The SQL * Plus Copy command uses SQL * Net to Copy or move data between different tables (the same server or different servers.
In the actual running environment, selecting the SQL * Plus Copy command can effectively improve the data replication performance. The following describes how to use the SQL * Plus Copy command and compares it with the other two solutions in terms of performance, so as to provide a reference for using the OracleCopy command.
1. syntax and usage instructions
1.1 syntax
Next, let's take a look at the syntax and usage of the SQL * Copy command. Before interpreting the syntax of the SQL * Plus Copy command, make sure that the SQL * Plus OracleCopy command is neither a method nor a function nor an SQL statement. It is a command ), of course, this command must be run in SQL * Plus.
Syntax of the SQL * Plus Copy command:
COPY {FROM database | TO database | FROM database TO database} {APPEND | CREATE | INSERT | REPLACE} destination_table [(column,...)]
USING query
Here, we will explain the Division:
COPY-this does not need to be explained. The main command declares to execute the COPY operation.
From Database-source Database
To Database-target Database
Note that there are three optional statements in brackets (separated by "|"). If the source and target data tables are in the same Schema, you can write only From Database, you can also write only To Database. Of course, it can also be the third method, which fully writes From Database and To Database.
However, if the source and target data tables are not in the same Schema, you must write the From Database and To Database in the third way.
The format of From Database and To Database is the same: USERID/PASSWORD @ SID, which should be familiar To everyone.
{APPEND | CREATE | INSERT | REPLACE}-Method of declaring operation data. The following describes the methods respectively:
Append-Append a record to an existing target table. If the target table does not exist, it is automatically created. This is equivalent to Create.
Create-Create a target table and add records to it. If the target table already exists, an error is returned.
Insert-Insert a record into an existing target table. Unlike Append, if the target table does not exist and is not created automatically, an error is returned.
Replace-overwrite existing data in the target table with the queried data. If the target table does not exist, it is automatically created.
The above content mainly introduces the actual operations of the Oracle Copy command. I hope you will have something or.