The database is Oracle 9i
1. Export a csv file
This is very simple. You can use the pl/SQL tool. First, select the table to be exported, right-click Query data, and in the window that appears on the left, select Export Query Restls and select the file type to Export. Generally, the csv format is exported.
2. Import csv files
In the analogy database, the t_province Field 1: province Field 2: city
CSV file storage path: f: \ test.csv column must be consistent with the database
You also need to write a test. ctl file with the following content:
Load data
Infile 'f: \ city .csv'
Into table "T_PROVINCE"
Fields terminated ','
(Province, city)
Then under cmd, enter: sqlldr userid = clevergirl/clevergirl@ORCL_192.168.128.129 control = f: test. ctl and press Enter.
3. Notes
At first, I wrote sqlldr control = f: \ test. ctl log = f: test. log.
SQL * Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12560: TNS: protocol adapter error.
I checked it online and said it was related to the environment variable. It can be modified.
Then I am afraid that the permissions are not enough, so log on directly with the sys User: sqlldr userid = sys/sys@ORCL_192.168.128.129 control = f: test. ctl
Reported: SQL * Loader-128: unable to start session
ORA-28009: connection to sys shoshould be as sysdba or sysoper
After the above is changed to the correct one, another
SQL * Loader-941: An error occurred while describing the table "t_province ".
ORA-04043: the object "t_province" does not exist
The problem with this error lies in the ctl file, where the table name must be capitalized before OK.