Oracle XE not seeing tables with names longer than 14 chars - oracle

I have an Oracle XE database link to a MySQL 5.7 instance. The link is working fine as I am able to do lookups like:
select count(*) from "wp_mal_mast"#MYSQl1;
However, when I try to do this for tables with a name greater than 14 characters, it fails with an error:
select count(*) from "123456789012345"#MYSQL1;
ORA-28511: lost RPC connection to heterogeneous remote agent using SID=ORA-28511: lost RPC connection to heterogeneous remote agent using SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=MYSQL1)))
But, if I select anything up to 14 chars, even non-existing, I get a normal response:
select count(*) from "12345678901234"#MYSQL1;
ORA-00942: table or view does not exist
[MySQL][ODBC 5.1 Driver][mysqld-5.7.19-log]Table 'blah.12345678901234' doesn't exist {42S02,NativeErr = 1146}
Here is my init[SID].
initMYSQL1.ora
HS_FDS_CONNECT_INFO=MYSQL1
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_SHAREABLE_NAME=/usr/lib64/libmyodbc5.so
set ODBCINI=/u01/app/oracle/product/11.2.0/xe/odbc.ini

Related

ADF: Can't get the for each paramter to work in the query for the sink

We have an Oracle database with a table and one of the tables holds dates. I want to itterate over this table by this date to copy dat from Oracle to Azure Datalake. But somehow I cannot get this to work.
The loopkup for the foreach works fine, but when I want to copy the data, using the one of the dates from the lookup, the copy activity task fails with the error: Message=ERROR [HY000] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-00936: missing expression
I suspect it has something to do with the dateformat that Oracle spits out en expects in the where clause. When I run the lookup-query in sql-developer, the dat format is like 29-DEC-14.
The query for the lookup looks like this:
select distinct activity_day
from Table 1
where activity_day < '01-JAN-15'
I restrict the data for testing so it only has to itterate everything before 01-01-2015 (which in this case is three rows)
In the foreach component items is stated as follows:
#activity('LookupDates').output.value
In the Copy activity the sink is specified as an Oracle query (connection to the oracle database works fine)
select column1, column2, coumn3,.......
from Table
where activity_day = #item().activity_day
The result should be that I get three files in my datalake with the data from three days. But as stated earlier, it fails in the copy activity on the source side. complet error below here:
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [HY000] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-00936: missing expression,Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,''Type=System.Data.Odbc.OdbcException,Message=ERROR [HY000] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-00936: missing expression,Source=msora28.dll,'",
"failureType": "UserError",
"target": "Copy Data1"
Answer was given on MSDN: in combination with another ttopic on stackoverflow:
https://social.msdn.microsoft.com/Forums/en-US/4224338f-9511-4f80-9fbf-4bf4cbc1b596/cant-get-lookup-data-passed-to-oracle-database?forum=AzureDataFactory

How do I execute "use dbname" over Oracle dblink to Sybase?

How do I access tables in my user schema in Sybase from Oracle?
In isql I can do
use mydb
go
How do I select from mydb tables from Oracle using dblink NITSYB5?
This does not work:
select count(*) from "mydb"."lon_client_confirm_exec"#NITSYB5;
Error:
ORA-00942: table or view does not exist
[Oracle][ODBC Sybase Wire Protocol driver][SQL Server]"mydb"."lon_client_confirm_exec" not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
{42S02,NativeErr = 208}
ORA-02063: preceding 3 lines from NITSYB5
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
Error at Line: 3 Column: 30
NOTE: I don't work with Oracle and hence know nothing about Oracle's dblink, so fwiw ...
In Sybase ASE the fully qualified table name format is: <dbname>.<owner>.<table>
If you leave out the <owner> then the optimizer will first look for tables owned by the user running the query, then look for tables owned by dbo.
In your example it appears you've left out the <owner>. If the table is owned by your user or dbo then I'd suggest you try adding an additional period, eg:
select count(*) from mydb..lon_client_confirm_exec#NITSYB5;
NOTE: Add quotes as/if needed by Oracle's dblink.
SERVER 1 AND SERVER 2
open SSH server2 telnet server 1 host, its ok to done
su oracle
1) cd $ORACLE_HOME/bin
2) TNSPING database1 name
its ok done
create public database link
LINK_NAME
connect to
DB1USERNAME
identified by
111
using 'DB1NAME';
select * from dual#LINK_NAME, result x, finish.

jdbc oracle read only access error when query with multiple database links

i have 3 read only user on 3 oracle databases db1, db2,db3
then when i log onto pl/sql on db1 with it, i can perform the query
select 1 X from dual#db2 union select 2 X from dual#db3
then i tried the jdbc code
 stmt=con.createStatement();
stmt.executeQuery("select 1 X from dual#db2 union select 2 X from dual#db3");
i got ORA-16000 database open read only access error
then i tried all kinds of things like:
con.setReadOnly(true)
stmt.execute("set transaction read only");//also set transaction read/write, set transaction isolation level ...
con.setAutoCommit(true);
whatever i can think, all got the same error.
What's the difference between JDBC and oracle client used by PL/SQL? how can i get this work?

Tuning the below Sql query

I have a database of Old version Oracle 8.1.7 there I have been running the below Union query
select c_ordine_es
,c_ordine_salesnet
,v_oyov
,v_annuale
,v_oneoff
,v_canone
,c_operatore_tam
from v_ordine_cliente_easysell
where d_ultima_modifica>DataRif
union
select c_ordine_es
,c_ordine_salesnet
,v_oyov
,v_annuale
,v_oneoff
,v_canone
,c_operatore_tam
from v_ordine_cliente_easysell v
,scarti_interfaccia_easysell_o s
where s.c_codice_es=v.c_ordine_es
and s.t_tabella_es=pkType.K_SCARTO_ORDINE_CLIENTE;
Every time I run these query the SQL Client(I am using Toad) hangs. Here I must mention data in v_ordine_cliente_easysell and scarti_interfaccia_easysell_o these two views/synonyms are fetched using DB Link(To another SIEBEL DB). I guess the problem is happening at the time of fetching data via DB_LINK, as the SIEBEL DB is alwas very busy. Would you please suggest me how could I tune the above query?
The Explain plan goes like below
OPERATION OPTIONS OBJECT_NODE POSITION COST CARDINALITY BYTES
SELECT STATEMENT 28 28 478912 61779648
HASH JOIN 1 28 478912 61779648
INDEX FAST FULL SCAN 1 2 11354 102186
REMOTE SIEB.WORLD 2 23 4218 506160
Make a local copy of table v_ordine_cliente_easysell.
Make a local copy of table scarti_interfaccia_easysell_o filtered with
t_tabella_es=pkType.K_SCARTO_ORDINE_CLIENTE.
Run the query on local copies, but using UNION ALL

How to copy data from one database/table to another database/table

I have written the following query using the documentation at: Oracle Documentation to copy some data from a database/table on my production server to database/table on Sandbox server.
COPY FROM username1/passwd1#<production_IP> to username2/passwd2#<sandbox_IP> INSERT TABLE_C (*) USING
(SELECT * FROM TABLE_C WHERE COL_A = 4884);
However, I am constantly running into Connection failed error. Is there anything wrong with the query?
In a typical Oracle environment, you have TNS names set up. That's a service to lookup the connection parameters for Oracle instances given an SID or service name. In it's simplest form, TNS names is a file called tnsnames.ora located by the environment variable TNS_ADMIN (which points to the directory where the file is).
Given the SIDs PROD and SANDBOX, you can then copy the tables from the SQLPLUS command line utility:
COPY FROM username1/passwd1#PROD to username2/passwd2#SANDBOX
INSERT TABLE_C (*) USING (SELECT * FROM TABLE_C WHERE COL_A = 4884);
Please note that this COPY command only supports a limited set of Oracle datatypes: char, date, long, varchar2, number.
If you don't have TNS names set up, you'll need to know the host name or IP address, the port number and the service name. The syntax then becomes:
COPY FROM username1/passwd1#//192.168.3.17:1521/PROD_SERVICE to username2/passwd2#//192.168.4.17:1521/SANDBOX_SERVICE
INSERT TABLE_C (*) USING (SELECT * FROM TABLE_C WHERE COL_A = 4884);
To determine the SID and/or service name, you best have a look into the TNSNAMES.ORA file on the database server itself. If you are able to login to the database, you can use the following queries to determine the SID and service name (but don't ask me which is which):
select name from v$database;
select * from global_name;
select instance_number, instance_name, host_name from v$instance;
Copy gpl_project/gpl_project#gpldatar to gpl_project/gpl_project#gplrdp. Replace BGROUPMASTER using select * from BGROUPMASTER.
The following is the solution that I used. I created a link the remote database then used an INSERT command to populate the data.
CREATE DATABASE LINK database_link_name
CONNECT TO my_user_name IDENTIFIED BY my_password
USING 'tns_name';
INSERT INTO my_table SELECT * FROM my_remote_table#database_link_name;
If you want to get rid of the database link after the work. Use the following:
DROP DATABASE LINK database_link_name;
See this link for helpful information:
https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:9532217300346683472

Resources