s:/home/s/Documents/mysql$ session
ID User Database Server
--------- ---- ---------------- ----------------------------------------------------------------
mysql* root performance_test /home/s/.datastudio/connections/NexGen Servers/MySQL/MySQL 5.5
ora12 sys ORCLB /home/s/.datastudio/connections/NexGen Servers/Oracle/Oracle 11g
ora12ivan IVAN ORCLB /home/s/.datastudio/connections/NexGen Servers/Oracle/Oracle 11g
s:/home/s/Documents/mysql$ select * from iptest limit 25
s:/home/s/Documents/mysql$ sqlexport | sqlimport -k ora12ivan IPTEST
sqlimport: import failed: Table 'IPTEST' is not defined in database 'ORCLB'.
If the schema is not defined by the user with a -s option or with a fully qualified name, then we should use the user name for the login, and not the one defined by the connection.
Also, when we display the error message we should include the schema. We currently display the table and database name, but not the schema. Something like :
sqlimport: import failed: Table 'IPTEST' in schema 'SCHEMA' is not defined in database 'ORCLB'.
(1) Made change to include the schema name in the error message, SVN r29131.
(2) For -u option, it has something to do with \connect command, but not \sqlimport because \sqlimport does not support -u option; \sqlimport simply uses the connection created by the \connect command.
I reviewed connection related code: when a new connection is requested, ConnectionProperties.getConnectionPrivate(...) will be called. In ConnectionProperties.getConnectionPrivate(...), there is a special handling for "SYSDBA" which is defined as "Connect as" in the Server Properties dialog. This seems to be the root cause of the problem (the server property file used in this issue's test case has "Connect as" set to "SYSDBA").
The special handling for "SYSDBA" (as well as SYSOPER and SYSASM) seems to ignore the passed in Username and always login as SYS. I am not sure whether this is a correct statement or not. However, I did some other test as described below which allow me to switch between different users.
(a) In the same Oracle database, I created a new user, TMP_USER.
(b) In my environment, I created a new server node with "Login Name" set to TMP_USER and "Connect as" set to Normal.
(c) I then created a session using the property file created in (2) with -u option set to IVAN and -k option set to ora_tmp.
(d) I then can execute the command below without any problem:
cat data_3.csv | sqlimport -k ora_tmp TMP_TBL_3
where table TMP_TBL_3 is defined in the schema IVAN.
(1) Made change to include the schema name in the error message, SVN r29131.
(2) For -u option, it has something to do with \connect command, but not \sqlimport because \sqlimport does not support -u option; \sqlimport simply uses the connection created by the \connect command.
I reviewed connection related code: when a new connection is requested, ConnectionProperties.getConnectionPrivate(...) will be called. In ConnectionProperties.getConnectionPrivate(...), there is a special handling for "SYSDBA" which is defined as "Connect as" in the Server Properties dialog. This seems to be the root cause of the problem (the server property file used in this issue's test case has "Connect as" set to "SYSDBA").
The special handling for "SYSDBA" (as well as SYSOPER and SYSASM) seems to ignore the passed in Username and always login as SYS. I am not sure whether this is a correct statement or not. However, I did some other test as described below which allow me to switch between different users.
(a) In the same Oracle database, I created a new user, TMP_USER.
(b) In my environment, I created a new server node with "Login Name" set to TMP_USER and "Connect as" set to Normal.
(c) I then created a session using the property file created in (2) with -u option set to IVAN and -k option set to ora_tmp.
(d) I then can execute the command below without any problem:
cat data_3.csv | sqlimport -k ora_tmp TMP_TBL_3
where table TMP_TBL_3 is defined in the schema IVAN.
Schema handling works now except for SYSDBA, as mentioned by @funfun.
The special handling for "SYSDBA" (as well as SYSOPER and SYSASM) seems to ignore the passed in Username and always login as SYS.
Schema handling works now except for SYSDBA, as mentioned by @funfun.
The special handling for "SYSDBA" (as well as SYSOPER and SYSASM) seems to ignore the passed in Username and always login as SYS.
Can you tell me what class and line the problem is?
Can you tell me what class and line the problem is?
ConnectionProperties.getConnectionPrivate(...) - lines 2151-2157
ConnectionProperties.getConnectionPrivate(...) - lines 2151-2157
\connect command offers -ca option which can be used to overwrite 'Connect as' attribute.
In the original test case, one can use the following command to switch User even the server property file has SYSDBA defined:
prompt$ \connect server_property_file -u IVAN -ca NORMAL -k sid
\connect command offers -ca option which can be used to overwrite 'Connect as' attribute.
In the original test case, one can use the following command to switch User even the server property file has SYSDBA defined:
prompt$ \connect server_property_file -u IVAN -ca NORMAL -k sid
Issue #7531 |
| Closed |
| Fixed |
| Resolved |
Completion |
| No due date |
| Fixed Build trunk/29131 |
| No time estimate |
If the schema is not defined by the user with a -s option or with a fully qualified name, then we should use the user name for the login, and not the one defined by the connection.
Also, when we display the error message we should include the schema. We currently display the table and database name, but not the schema. Something like :
sqlimport: import failed: Table 'IPTEST' in schema 'SCHEMA' is not defined in database 'ORCLB'.