How to execute remote query by Oracle Database Link
I use Oracle Database Link to query data from SQL Server. The query is like:
select *
from tableA@DL_SqlServer a
join tableB@DL_SqlServer b
on a.ID = b.ID*
tableA and tableB is large and the result is relatively small. This query executes quickly in SQL Server since indexes are built both on the two tables. But it is very slow on Oracle Database Link to SQL Server.
I guess the join operation is performed on Oracle side not on SQL Server side, thus the indexes are not used. Since I just need the joined result, I prefer to perform the query entirely on SQL Server and get the small result only. But I have no privilege to create views on SQL Sevrer.
I konw that using SQL Server's linked server and OPENQUERY function can achieve this goal. I wonder how to do this on Oracle Database Link. Thanks!
DO NOT DO THIS....specifically:
"select *
from tableA@DL_SqlServer a
join tableB@DL_SqlServer b
on a.ID = b.ID*"
You would be better off to do the following:
create a Materialized View in Oracle and once/day (or as frequently as you feel necessary) pull the data from SQLServer and then do the join locally by creating MV as TABLEA_MV and TABLEB_MV and then have views that have the REALTABLEA and REALTABLEB names that point to these MVs. This can be done without recompiling or changing your code. Trust me, I have seen this sort of thing in the past that completely crippled an IBM mainframe using DB2 along with a major network segment by having this sort of join via DB links. You must understand the ramifications of your "design" and I can tell you for certain that it is a very BAD!!! idea... Fix this before you are issuing another command: "alter DBA update resume/CV;"
The app went into production at 7AM. By 9:30AM, the mainframe had executed more than 10Billion I/O's. It took > 15hrs for the mainframe to recover once we shutdown the app and implemented the view/MV described above.
I will leave it as an excercise for the OP to develop the syntax for this.
Edited by: onedbguru on Feb 15, 2013 7:27 PM
Similar Messages
-
Variable database name in SQL Server query using Oracle database link
Hi All,
I have an ApEx 4.1 app running on 11g x64 (11.2.0.1) on Windows Server 2008 x64, and I have some data integration points with a SQL Server (2005 and 2008) that I need to establish. I have configured the database link with dg4odbc and it works beautifully... I can execute queries against the SQL Server database without any problems using the database link.
However, there is a scenario where the SQL Server database name is dynamic, and I need to generate it on the fly in a PL/SQL block, and then use that in a dynamic SQL query (all of this in ApEx). This is where I run into problems... when I am querying the default database based on the ODBC connection and I don't have to specify the database name, there is no issue. But when I need to access one of several other non-default databases, I keep receiving the "invalid table" error.
This runs fine:* (note that "fv" is the name of my database link)
v_query1 := 'select "ReleaseDate" from dbo.Schedules@fv where dbo.Schedules."SchedID" = :schedule';
EXECUTE IMMEDIATE v_query1 into rel_date using schedule;
I then take that rel_date variable, convert to a varchar2 (rel_date_char), and then use it as the database name in the next query...
This returns an error_ (Error ORA-00903: invalid table name)
v_query2 := 'select "PARTNO" from :rel_date_char.dbo.ProdDetails@fv where "SchedID" = :schedule and "UnitID" = :unit
and "MasterKey" = :master and "ParentKey" = :parent';
EXECUTE IMMEDIATE v_query2 into part_number using schedule, unit, master, parent;
I have also tried using all of the following to no avail:
'select "PARTNO" from ' || :rel_date_char || '.dbo.ProdDetails@fv where "SchedID"...
'select "PARTNO" from ' || rel_date_char || '.dbo.ProdDetails@fv where "SchedID"...
'select "PARTNO" from ' || @rel_date_char || '.dbo.ProdDetails@fv where "SchedID"...
'select "PARTNO" from @rel_date_char.dbo.ProdDetails@fv where "SchedID"...
Is there a way to do this in PL/SQL?
Thanks for any help!
-Ian C.
Edited by: 946532 on Jul 15, 2012 7:45 PMJust did a test using passthrough:
SQL> set serveroutput on
SQL> declare
2 val varchar2(100);
3 c integer;
4 nr integer;
5 begin
6 c:= dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 'select count(*) from EMP');
8 LOOP
9 nr:= DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
10 exit when nr=0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c,1,val);
12 dbms_output.put_line(val);
13 end loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
15 end;
16 /
24576
PL/SQL procedure successfully completed.
SQL> declare
2 val varchar2(100);
3 c integer;
4 nr integer;
5 begin
6 c:= dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 'select count(*) from dbo.EMP');
8 LOOP
9 nr:= DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
10 exit when nr=0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c,1,val);
12 dbms_output.put_line(val);
13 end loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
15 end;
16 /
24576
PL/SQL procedure successfully completed.
So all 3 ways work for me.
Edited by: kgronau on Jul 23, 2012 10:08 AM
Now using variables to perform the select:
SQL> declare
2 val varchar2(100);
3 c integer;
4 nr integer;
5 tabname varchar2(20) :='EMP';
6 ownr varchar2(20) :='dbo';
7 dbname varchar2(20) :='gateway';
8 begin
9 c:= dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
10 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 'SELECT count(*) FROM '||dbname||'.'|| ownr || '.'||tabname||'');
11 LOOP
12 nr:= DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
13 exit when nr=0;
14 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c,1,val);
15 dbms_output.put_line(val);
16 end loop;
17 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3(c);
18 end;
19 /
24576
PL/SQL procedure successfully completed.
=> instead of executing the statement using "execute Immediate" we have to use PASTHROUGH package to pass the statement to the SQL Server.
Edited by: kgronau on Jul 23, 2012 10:10 AM -
How can I connect to an oracle database remotely using telnet in DIAdem?
I need to query an oracle database on a remote server and store the result back in DIAdem. Does anyone know how to telnet through diadem and return the result?
DIAdem provides you with tools to connect to databases using SQL. Specifically, you can use SQL_Connect to open a connection to a database through a DSN (Data Source Name). The DSN has to be configured on the local machine (Control Panel -> Administrative Tools - > Data Sources) and has to point to the remote Database. You can map a network drive in the local machine so you can browse to your remote Database. The DSN will provide the link between DIAdem and the remote Database.
If your communication has to be throught telnet, then I suggest you try to use an ActiveX control. VBScript doesn't support Telnet natively, but it does support ActiveX controls. You can create one from Visual Basic or try to find a telnet client that has one already.
Best Re
gards, -
How to search this value in oracle database to find out the table
Hi expert,
I know there is a value in oracle database, please show me how to search this value in oracle database to find out the table holding this value.
Many Thanks,918440 wrote:
Hi friends,
this question is really practical, I already know there is value from application saved in database, I want to search the whole database to figure out which table the value is contained.write SQL that writes SQL to query every table.
Handle: 918440
Status Level: Newbie
Registered: Mar 2, 2012
Total Posts: 20
Total Questions: 10 (10 unresolved)
why do you waste time here when you NEVER get any answer to any question you post? -
Can execut a query in Oracle UCM to get View_Values instead of using GET_SC
Dear All,
i have a question that i had google it and didn't find anything helpful.
i want to ask if i can execut a query in Oracle UCM to get View_Values instead of using GET_SCHEMA_VIEW_VLAUES service ?
ie: asuume that we have a Table name called Employees (having empId, empName) and have a view named as Table name; Employees.
instead of use the GET_SCHEMA_VIEW_VLAUES service to get the data of Employees, can i write a query, ex: select from Employees*_ to get the data.
note: i have a connection parameter to connect to oracle UCM database
any suggestions.
RegardsYes, you can execute the query and store results into a result set (available also in iDocScript).
There are two sample components that you could use as a starting point - see here http://www.oracle.com/technetwork/middleware/webcenter/content/howtocomponentsbundle-132171.zip or here for 11g http://bexhuff.com/2011/03/howto-component-samples-for-oracle-ucm-11g
Take a look at DataAccess and DatabaseProvider from the sample stack. -
How to execute SQL Query in Code behind Using infopath 2010?
Hi,
I've repeatable on infopath form, and want bind it throuth code behind from SQL table. My question is that how to execute SQL Query in code behind from infopath as well as how would get Query result to bind repeatable control?
Thanks In Advance
Shoeb AhmadHello,
You first need to add new SQL DB connection then you need execute connection from code behind.
See below link to create new connection
http://office.microsoft.com/en-in/infopath-help/add-a-data-connection-to-a-microsoft-sql-server-database-HP010092823.aspx:
http://www.bizsupportonline.net/infopath2010/connect-infopath-2010-sql-server-2008-table.htm
Then use below code to execute this connection:
AdoQueryConnection conn = (AdoQueryConnection)(this.DataConnections["Data connection name"]);
string origCommand = Select * from tablename;
conn.Command = origCommand;
conn.Execute();
Finally bind your table:
http://www.bizsupportonline.net/infopath2007/4-way-programmatically-add-row-repeating-table.htm
http://stevemannspath.blogspot.in/2010/09/infopath-20072010-populate-repeating.html
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Executing SQL query in portal database
Hi ,
I wish to do a simple POC . I need to create a table from NWDS , populate it with some data and then access the table data using an sql query . I am aware how to create a table but I am not sure where exactly to write the query .
What I would like to understand is
1) If I create a table where would that table get created (The database) ?
2) Where would I write that query in NWDS ?
3) How would I execute that query in that database ?
Please help for the same .
(Needless to say that I always award points )
Regards
Deepak SinghHi Gopal ,
Thanks for the reply .This is what I did . I am pasting the whole code of the class that I am using to do the POC .
package com.gravity;
import java.sql.Connection;
import java.sql.Statement;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.sql.DataSource;
/*import sun.jdbc.odbc.ee.DataSource;/
@author Administrator
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
public class DataHandling {
public static void DataPost(){
Connection con = null ;
try {
Added code
Hashtable env = new Hashtable();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
System.out.println("initial_context_factory put ");
env.put(javax.naming.Context.PROVIDER_URL, "gms29:50004");
System.out.println("provide_url put ");
env.put(javax.naming.Context.SECURITY_PRINCIPAL, "j2ee_admin");
System.out.println("security_principal put ");
env.put(javax.naming.Context.SECURITY_CREDENTIALS, "gravity");
env.put("domain", "true");
env.put("force_remote", "true");
System.out.println("security_credentials put ");
InitialContext iCtxt = new InitialContext(env);
System.out.println("Object made for initial context ");
DataSource ds = (DataSource) iCtxt.lookup("jdbc/my_db");
System.out.println("Datasource obtained ");
try {
con = ds.getConnection();
Statement stmt = con.createStatement();
String query1 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('naveen',125188)";
String query2 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('deepak',125189)";
String query3 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('rajeev',125190)";
stmt.executeUpdate(query1);
stmt.executeUpdate(query2);
stmt.executeUpdate(query3);
}catch (Exception e) {
e.printStackTrace();
}catch (Exception e) {
e.printStackTrace();
} finally {
try {
con.close();
}catch (Exception e) {
e.printStackTrace();
public static void main (String[] args){
System.out.println("Hello");
DataPost();
I have imported all the driver jar files and sapj2eeclient.jar in the classpath .
Also the drivers found in the path
172.16.161.11\usr\sap\EP1\DVEBMGS00\j2ee\cluster\server0\bin\ext\com.sap.portal.jdbcdrivers
have all been added to the classpath .(Not sure if this is required)
Let me know what you find wrong in my code and in the meanwhile I will try to implement what you suggested .
Regards
Deepak Singh -
Query in timesten taking more time than query in oracle database
Hi,
Can anyone please explain me why query in timesten taking more time
than query in oracle database.
I am mentioning in detail what are my settings and what have I done
step by step.........
1.This is the table I created in Oracle datababase
(Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
CREATE TABLE student (
id NUMBER(9) primary keY ,
first_name VARCHAR2(10),
last_name VARCHAR2(10)
2.THIS IS THE ANONYMOUS BLOCK I USE TO
POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
declare
firstname varchar2(12);
lastname varchar2(12);
catt number(9);
begin
for cntr in 1..2599999 loop
firstname:=(cntr+8)||'f';
lastname:=(cntr+2)||'l';
if cntr like '%9999' then
dbms_output.put_line(cntr);
end if;
insert into student values(cntr,firstname, lastname);
end loop;
end;
3. MY DSN IS SET THE FOLLWING WAY..
DATA STORE PATH- G:\dipesh3repo\db
LOG DIRECTORY- G:\dipesh3repo\log
PERM DATA SIZE-1000
TEMP DATA SIZE-1000
MY TIMESTEN VERSION-
C:\Documents and Settings\dipesh>ttversion
TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
Instance admin: dipesh
Instance home directory: G:\TimestTen\TT70_32
Daemon home directory: G:\TimestTen\TT70_32\srv\info
THEN I CONNECT TO THE TIMESTEN DATABASE
C:\Documents and Settings\dipesh> ttisql
command>connect "dsn=dipesh3;oraclepwd=tiger";
4. THEN I START THE AGENT
call ttCacheUidPwdSet('SCOTT','TIGER');
Command> CALL ttCacheStart();
5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
create readonly cache group rc_student autorefresh
interval 5 seconds from student
(id int not null primary key, first_name varchar2(10), last_name varchar2(10));
load cache group rc_student commit every 100 rows;
6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
I SET THE TIMING..
command>TIMING 1;
consider this query now..
Command> select * from student where first_name='2155666f';
< 2155658, 2155666f, 2155660l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
another query-
Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
2206: Table SCOTT.STUDENTS not found
Execution time (SQLPrepare) = 0.074964 seconds.
The command failed.
Command> SELECT * FROM STUDENT where first_name='2093434f';
< 2093426, 2093434f, 2093428l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
Command>
7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
ID FIRST_NAME LAST_NAME
1498663 1498671f 1498665l
Elapsed: 00:00:00.15
Can anyone please explain me why query in timesten taking more time
that query in oracle database.
Message was edited by: Dipesh Majumdar
user542575
Message was edited by:
user542575TimesTen
Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
Version: 7.0.4.0.0 64 bit
Schema:
create usermanaged cache group factCache from
MV_US_DATAMART
ORDER_DATE DATE,
IF_SYSTEM VARCHAR2(32) NOT NULL,
GROUPING_ID TT_BIGINT,
TIME_DIM_ID TT_INTEGER NOT NULL,
BUSINESS_DIM_ID TT_INTEGER NOT NULL,
ACCOUNT_DIM_ID TT_INTEGER NOT NULL,
ORDERTYPE_DIM_ID TT_INTEGER NOT NULL,
INSTR_DIM_ID TT_INTEGER NOT NULL,
EXECUTION_DIM_ID TT_INTEGER NOT NULL,
EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
NO_ORDERS TT_BIGINT,
FILLED_QUANTITY TT_BIGINT,
CNT_FILLED_QUANTITY TT_BIGINT,
QUANTITY TT_BIGINT,
CNT_QUANTITY TT_BIGINT,
COMMISSION BINARY_FLOAT,
CNT_COMMISSION TT_BIGINT,
FILLS_NUMBER TT_BIGINT,
CNT_FILLS_NUMBER TT_BIGINT,
AGGRESSIVE_FILLS TT_BIGINT,
CNT_AGGRESSIVE_FILLS TT_BIGINT,
NOTIONAL BINARY_FLOAT,
CNT_NOTIONAL TT_BIGINT,
TOTAL_PRICE BINARY_FLOAT,
CNT_TOTAL_PRICE TT_BIGINT,
CANCELLED_ORDERS_COUNT TT_BIGINT,
CNT_CANCELLED_ORDERS_COUNT TT_BIGINT,
ROUTED_ORDERS_NO TT_BIGINT,
CNT_ROUTED_ORDERS_NO TT_BIGINT,
ROUTED_LIQUIDITY_QTY TT_BIGINT,
CNT_ROUTED_LIQUIDITY_QTY TT_BIGINT,
REMOVED_LIQUIDITY_QTY TT_BIGINT,
CNT_REMOVED_LIQUIDITY_QTY TT_BIGINT,
ADDED_LIQUIDITY_QTY TT_BIGINT,
CNT_ADDED_LIQUIDITY_QTY TT_BIGINT,
AGENT_CHARGES BINARY_FLOAT,
CNT_AGENT_CHARGES TT_BIGINT,
CLEARING_CHARGES BINARY_FLOAT,
CNT_CLEARING_CHARGES TT_BIGINT,
EXECUTION_CHARGES BINARY_FLOAT,
CNT_EXECUTION_CHARGES TT_BIGINT,
TRANSACTION_CHARGES BINARY_FLOAT,
CNT_TRANSACTION_CHARGES TT_BIGINT,
ORDER_MANAGEMENT BINARY_FLOAT,
CNT_ORDER_MANAGEMENT TT_BIGINT,
SETTLEMENT_CHARGES BINARY_FLOAT,
CNT_SETTLEMENT_CHARGES TT_BIGINT,
RECOVERED_AGENT BINARY_FLOAT,
CNT_RECOVERED_AGENT TT_BIGINT,
RECOVERED_CLEARING BINARY_FLOAT,
CNT_RECOVERED_CLEARING TT_BIGINT,
RECOVERED_EXECUTION BINARY_FLOAT,
CNT_RECOVERED_EXECUTION TT_BIGINT,
RECOVERED_TRANSACTION BINARY_FLOAT,
CNT_RECOVERED_TRANSACTION TT_BIGINT,
RECOVERED_ORD_MGT BINARY_FLOAT,
CNT_RECOVERED_ORD_MGT TT_BIGINT,
RECOVERED_SETTLEMENT BINARY_FLOAT,
CNT_RECOVERED_SETTLEMENT TT_BIGINT,
CLIENT_AGENT BINARY_FLOAT,
CNT_CLIENT_AGENT TT_BIGINT,
CLIENT_ORDER_MGT BINARY_FLOAT,
CNT_CLIENT_ORDER_MGT TT_BIGINT,
CLIENT_EXEC BINARY_FLOAT,
CNT_CLIENT_EXEC TT_BIGINT,
CLIENT_TRANS BINARY_FLOAT,
CNT_CLIENT_TRANS TT_BIGINT,
CLIENT_CLEARING BINARY_FLOAT,
CNT_CLIENT_CLEARING TT_BIGINT,
CLIENT_SETTLE BINARY_FLOAT,
CNT_CLIENT_SETTLE TT_BIGINT,
CHARGEABLE_TAXES BINARY_FLOAT,
CNT_CHARGEABLE_TAXES TT_BIGINT,
VENDOR_CHARGE BINARY_FLOAT,
CNT_VENDOR_CHARGE TT_BIGINT,
ROUTING_CHARGES BINARY_FLOAT,
CNT_ROUTING_CHARGES TT_BIGINT,
RECOVERED_ROUTING BINARY_FLOAT,
CNT_RECOVERED_ROUTING TT_BIGINT,
CLIENT_ROUTING BINARY_FLOAT,
CNT_CLIENT_ROUTING TT_BIGINT,
TICKET_CHARGES BINARY_FLOAT,
CNT_TICKET_CHARGES TT_BIGINT,
RECOVERED_TICKET_CHARGES BINARY_FLOAT,
CNT_RECOVERED_TICKET_CHARGES TT_BIGINT,
PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
READONLY);
No of rows: 2228558
Config:
< CkptFrequency, 600 >
< CkptLogVolume, 0 >
< CkptRate, 0 >
< ConnectionCharacterSet, US7ASCII >
< ConnectionName, tt_us_dma >
< Connections, 64 >
< DataBaseCharacterSet, AL32UTF8 >
< DataStore, e:\andrew\datacache\usDMA >
< DurableCommits, 0 >
< GroupRestrict, <NULL> >
< LockLevel, 0 >
< LockWait, 10 >
< LogBuffSize, 65536 >
< LogDir, e:\andrew\datacache\ >
< LogFileSize, 64 >
< LogFlushMethod, 1 >
< LogPurge, 0 >
< Logging, 1 >
< MemoryLock, 0 >
< NLS_LENGTH_SEMANTICS, BYTE >
< NLS_NCHAR_CONV_EXCP, 0 >
< NLS_SORT, BINARY >
< OracleID, NYCATP1 >
< PassThrough, 0 >
< PermSize, 4000 >
< PermWarnThreshold, 90 >
< PrivateCommands, 0 >
< Preallocate, 0 >
< QueryThreshold, 0 >
< RACCallback, 0 >
< SQLQueryTimeout, 0 >
< TempSize, 514 >
< TempWarnThreshold, 90 >
< Temporary, 1 >
< TransparentLoad, 0 >
< TypeMode, 0 >
< UID, OS_OWNER >
ORACLE:
Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
Schema:
CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
TABLESPACE TS_OS
PARTITION BY RANGE (ORDER_DATE)
PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TS_OS
NOCACHE
NOCOMPRESS
NOPARALLEL
BUILD DEFERRED
USING INDEX
TABLESPACE TS_OS_INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT order_date, if_system,
GROUPING_ID (order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id
) GROUPING_ID,
/* ============ DIMENSIONS ============ */
time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
instr_dim_id, execution_dim_id, exec_exchange_dim_id,
/* ============ MEASURES ============ */
-- o.FX_RATE /* FX_RATE */,
COUNT (*) no_orders,
-- SUM(NO_ORDERS) NO_ORDERS,
-- COUNT(NO_ORDERS) CNT_NO_ORDERS,
SUM (filled_quantity) filled_quantity,
COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
COUNT (quantity) cnt_quantity, SUM (commission) commission,
COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
COUNT (fills_number) cnt_fills_number,
SUM (aggressive_fills) aggressive_fills,
COUNT (aggressive_fills) cnt_aggressive_fills,
SUM (fx_rate * filled_quantity * average_price) notional,
COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
SUM (fx_rate * fills_number * average_price) total_price,
COUNT (fx_rate * fills_number * average_price) cnt_total_price,
SUM (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END) cancelled_orders_count,
COUNT (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END
) cnt_cancelled_orders_count,
-- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
-- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
-- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
SUM (routed_orders_no) routed_orders_no,
COUNT (routed_orders_no) cnt_routed_orders_no,
SUM (routed_liquidity_qty) routed_liquidity_qty,
COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
SUM (removed_liquidity_qty) removed_liquidity_qty,
COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
SUM (added_liquidity_qty) added_liquidity_qty,
COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
SUM (agent_charges) agent_charges,
COUNT (agent_charges) cnt_agent_charges,
SUM (clearing_charges) clearing_charges,
COUNT (clearing_charges) cnt_clearing_charges,
SUM (execution_charges) execution_charges,
COUNT (execution_charges) cnt_execution_charges,
SUM (transaction_charges) transaction_charges,
COUNT (transaction_charges) cnt_transaction_charges,
SUM (order_management) order_management,
COUNT (order_management) cnt_order_management,
SUM (settlement_charges) settlement_charges,
COUNT (settlement_charges) cnt_settlement_charges,
SUM (recovered_agent) recovered_agent,
COUNT (recovered_agent) cnt_recovered_agent,
SUM (recovered_clearing) recovered_clearing,
COUNT (recovered_clearing) cnt_recovered_clearing,
SUM (recovered_execution) recovered_execution,
COUNT (recovered_execution) cnt_recovered_execution,
SUM (recovered_transaction) recovered_transaction,
COUNT (recovered_transaction) cnt_recovered_transaction,
SUM (recovered_ord_mgt) recovered_ord_mgt,
COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
SUM (recovered_settlement) recovered_settlement,
COUNT (recovered_settlement) cnt_recovered_settlement,
SUM (client_agent) client_agent,
COUNT (client_agent) cnt_client_agent,
SUM (client_order_mgt) client_order_mgt,
COUNT (client_order_mgt) cnt_client_order_mgt,
SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
SUM (client_trans) client_trans,
COUNT (client_trans) cnt_client_trans,
SUM (client_clearing) client_clearing,
COUNT (client_clearing) cnt_client_clearing,
SUM (client_settle) client_settle,
COUNT (client_settle) cnt_client_settle,
SUM (chargeable_taxes) chargeable_taxes,
COUNT (chargeable_taxes) cnt_chargeable_taxes,
SUM (vendor_charge) vendor_charge,
COUNT (vendor_charge) cnt_vendor_charge,
SUM (routing_charges) routing_charges,
COUNT (routing_charges) cnt_routing_charges,
SUM (recovered_routing) recovered_routing,
COUNT (recovered_routing) cnt_recovered_routing,
SUM (client_routing) client_routing,
COUNT (client_routing) cnt_client_routing,
SUM (ticket_charges) ticket_charges,
COUNT (ticket_charges) cnt_ticket_charges,
SUM (recovered_ticket_charges) recovered_ticket_charges,
COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
FROM us_datamart_raw
GROUP BY order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id;
-- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
-- by Oracle with the associated materialized view.
CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
NOLOGGING
NOPARALLEL
COMPRESS 7;
No of rows: 2228558
The query (taken Mondrian) I run against each of them is:
select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
--, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
--, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
--, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
--, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
--, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
--, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
--, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
--, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
--, sum("MV_US_DATAMART"."COMMISSION") as "m9"
--, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
--, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
--,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
--,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
--, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
--, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
--, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
--, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
--,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
--, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
No Columns ORACLE TimesTen
1 1.05 0.94
2 1.07 1.47
3 2.04 1.8
4 2.06 2.08
5 2.09 2.4
6 3.01 2.67
7 4.02 3.06
8 4.03 3.37
9 4.04 3.62
10 4.06 4.02
11 4.08 4.31
12 4.09 4.61
13 5.01 4.76
14 5.02 5.06
15 5.04 5.25
16 5.05 5.48
17 5.08 5.84
18 6 6.21
19 6.02 6.34
20 6.04 6.75 -
How to I convert data from oracle database into excel sheet
how to I convert data from oracle database into excel sheet.
I need to import columns and there datas from oracle database to microsoft excel sheet.
Please let me know the different ways for doing this.
Thanks.asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
Justin -
How I enable network service of Oracle database 10g XE ?
Hi,
How I enable network service of Oracle database 10g XE ?
Following error occurs when printing:
ORA-20001: The printing engine could not be reached because either
the URL specified is incorrect or a proxy URL needs to be specified.ORA-20001 is a user defined error. So you will have to find out where it comes from.
Regards
Marcus -
How sql developer connects to a oracle database
hi,
I wonder how sql developer connects to a oracle database. does it use oracle client like Toad?
How does it make the connection with oracle server?
Sameera924164 wrote:
hi,
I wonder how sql developer connects to a oracle database. does it use oracle client like Toad?
How does it make the connection with oracle server?
SameeraWelcome to OTN
From Left side Tab click on (+) New Connection. Then at the window give a connection name,User name,Password.
Then provide Host Name, Port and SID
Click on Test button and then save or connect.
Hope this will help you -
Error executing a query using a DB-Link
Hi all,
I'm trying to execute a query on a DB using a connection. I created a DB-LINK on the DB. executing the select:
select sysdate from dual@lnk_db_prod;
I get the following error:
Error starting at line 1 in command:
select sysdate from dual@lnk_db_prod
Error at Command Line:1 Column:19
Error report:
SQL Error: ORA-01882: timezone region not found
ORA-02063: preceding line from lnk_db_prod
The error will be return executing any query on a db-link.
It appens if I create a db-link using syntax referencing the SID and using the sintax with the complete connection string. Below the two example of db-link DDL commands:
1.
CREATE DATABASE LINK lnk_db_prod
CONNECT TO prod IDENTIFIED BY prod
USING 'DBPROD';
2.
create database link lnk_db_prod2
connect to prod
identified by prod
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 10.41.54.156)
(Port = 1521)
(CONNECT_DATA = (SID = DBPROD)
Can you help me, please?
bye,
IvanHi,
You would be better off posting / searching on other Oracle forums that deal more specifically with Application Servers. I googled "WebLogic set time_zone" and the first three hits were from our forums:
Default TimeZone
How to fix msg=ORA-01882: timezone region not found
http://kr.forums.oracle.com/forums/thread.jspa?messageID=9400587
I hope one of the these is what you are looking for.
Regards,
Gary Graham
SQL Developer Team -
ORA-28545 on mySQL - Oracle database link
Hi All,
I'm trying to make a connection to mySQL database from oracle.
Oracle database runs on windows 2003 64 bit machine and version is 10.2.0.4.0.
my init<dbname>, listner and tnsnames looks like this and I can create database links without any problem at all. Also oracle to oracle database links are working fine on that machine as well.
HS_FDS_CONNECT_INFO=BOOKDB
HS_FDS_TRACE_LEVEL=debug
BOOKDB=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
SID_LIST_BOOKDB=
(SID_LIST=
(SID_DESC=
(SID_NAME=BOOKDB)
(ORACLE_HOME=C:\oracle\product\10.2.0\db_1)
(PROGRAM=hsodbc)
BOOKDB=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522))
(CONNECT_DATA=(SID=BOOKDB))
(HS=OK)
)When I try start the listner and then do the tnsping everything seems fine.
C:\Documents and Settings\adminkh>lsnrctl start bookdb
LSNRCTL for 64-bit Windows: Version 10.2.0.4.0 - Production on 20-JUL-2010 12:01:40
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNSLSNR for 64-bit Windows: Version 10.2.0.4.0 - Production
System parameter file is C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Log messages written to C:\oracle\product\10.2.0\db_1\network\log\bookdb.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\PNPKEYipc)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522))
STATUS of the LISTENER
Alias bookdb
Version TNSLSNR for 64-bit Windows: Version 10.2.0.4.0 - Production
Start Date 20-JUL-2010 12:01:42
Uptime 0 days 0 hr. 0 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
Listener Log File C:\oracle\product\10.2.0\db_1\network\log\bookdb.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\PNPKEYipc)))
Services Summary...
Service "bookdb" has 1 instance(s).
Instance "bookdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
C:\Documents and Settings\adminkh>tnsping bookdb
TNS Ping Utility for 64-bit Windows: Version 10.2.0.4.0 - Production on 20-JUL-2010 12:02:16
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522)) (CONNECT_DATA=(SID=bookdb)) (HS=OK))
OK (10 msec)And then I create the database link and it created without a problem.
create database link booklink connect to bookuser identified by ITDepartment using 'BOOKDB';And then I try to run small query.
SQL> select * from admins@booklink;
select * from admins@booklink
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from BOOKLINKSo can anyone help me with regards to this error.
Edited by: garuka on Jul 20, 2010 4:08 AM
Edited by: garuka on Jul 20, 2010 4:09 AMlistner.ora from 11g
BOOKDB=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
SID_LIST_BOOKDB=
(SID_LIST=
(SID_DESC=
(SID_NAME=BOOKDB)
(ORACLE_HOME=C:\Oracle11g\product\11.2.0\tg_1)
(PROGRAM=hsodbc)
)status:
C:\Oracle11g\product\11.2.0\tg_1\bin>lsnrctl status bookdb
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 20-JUL-2010 15:35:34
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522))
STATUS of the LISTENER
Alias bookdb
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date 20-JUL-2010 15:34:51
Uptime 0 days 0 hr. 0 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\Oracle11g\product\11.2.0\tg_1\network\admin\listener.ora
Listener Log File c:\oracle11g\product\11.2.0\tg_1\log\diag\tnslsnr\khhq-xs-ifsb01\bookdb\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.72.176)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\PNPKEYipc)))
Services Summary...
Service "bookdb" has 1 instance(s).
Instance "bookdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfullyEdited by: garuka on Jul 20, 2010 7:42 AM -
How to access the LOB objects through database links??????????????
Hi
See:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:52297289480186
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5322964030684
And you also might want to get a new keyboard, your '?' seems to be stucked.... -
Oracle Database link for AS400
Hi
i have two (2) database servers
1) Oracle 9i server
2) AS400 server
I want to create Oracle DataBase Link for AS400.
means i just want to connect AS400 system from oracle prompt by using
oracle database link.
please anybody help me in detail
Nasir,There is two method.
One of that
(1) Buy Oracle Transparent Gateway for AS400/DB2 and install it to AS400.
(2) Set tnsnames.ora for connecting to AS400/DB2.
(3) Create database link
http://download-west.oracle.com/docs/html/A97615_01/toc.htm
Another of that
(1) Get odbc driver for AS400/DB2 (on your OS executing Oracle)
(2) Set listener.ora, inithsodbc.ora and tnsnames.ora.
(3) Create database link
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96544/gencon.htm#1004729
Maybe you are looking for
-
Today I found a gaping hole and bend on the sueprdrive of my MacBook Pro.
I open up my macbook pro neoprene sleeve today to reveal a bulge on the superdrive corner. There was no disc in the drive for weeks. The aluminum is actually bending outwards. There is a huge gap on the side where the aluminum meets with the grey pla
-
Hi, I had a form with content/stacked canvases and I converted all of them to tab so that it would be much easier for the users to view. Everything's working fine but somehow the color of all the canvases has changed to light gray. Earlier my canvase
-
How do I install a certificate to Trusted People Local Computer in Windows 8?
When I go through the MMC, I add the snap in for certificate. When I go through the import process for Trusted People, in Win 7 you can click "show physical stores" and "local computer" becomes an option for "trusted people". I don't see this in Win
-
Hi, I try to create empty pdf document using C# from standalone app. Here is my code. CAcroApp acroApp = new AcroAppClass(); acroApp.Show(); AcroPDDoc pdDoc = new AcroPDDocClass(); Object jsObj = pdDoc.GetJSObject(); // jsObj = null in this Type
-
What is the different between statement and preparedstatement?
hi, recently i have attended a telephonic interview. they asked me what is the different between statement and preparedstatement? and when u will use them? Hi! can any one say me the original difference??