I am trying to import dump file into Oracle using cx_Oracle. I am able to execute command by command. Can any one suggest how to do this?
I'm currently using:
imp servicely/tiger@ubuntu file=/home/hemalatha/hemalatha_data/test_data/oracle/schema_only.sql full=y.
But, I'm getting the error: IMP-00037: Character set marker unknown
I think you are confused about what you actually have.
You say
and also your supposed import file has a
.sql
extension. I think you have a script full of SQL statements. You do not have an export file, which is a binary file generated byexp
orexpdp
.imp
andimpdp
are used to import the files generated byexp
andexpdp
respectively. They will act confused if you give them a SQL script to run.If you have a SQL script to run against the database, use SQL*Plus. Here's a simple SQL*Plus script which doesn't do much:
Here's a simple Python script to run this script in SQL*Plus and display the output:
Note that we need to connect to SQL*Plus's input and close it, as otherwise SQL*Plus will not exit and the script will hang.
When I run this, I get the following output: