How to import additional fields in Oracle as null values
Q: We have migrated our Oracle database to a new environment. Some customer tables exist in two databases at the same time, but those tables in the new environment have some additional fields. Can you help me use the import/export tool? In this way, I can either import a new null value or export it as a null value from the original environment, and then import it again. Thank you very much.
A:
There are two similar options for you to convert data from the source database to the target database, while saving additional fields in the target system. The export/import tool does not allow you to save those fields in the target database. You can use the query option with export, but this only allows some rows to be exported, rather than some fields (columns) to be exported.
The first option involves creating a database link between the source and target databases, and then using the INSERT command to insert only the required data rows and fields. Here is an example:
Insert into emp (empid, ename, email)
SELECT empid, ename, emailFROM
Emp @ remote_dbWHERE ...;
The second option is SQL * Loader. You must read some rows from the source table in the format that SQL * Loader can read. However, you can use SQL * Loader to insert rows into the target database, or if these rows already exist, attach them.