Number of records in Oracle 11G XE
Hi.
I'm establishing a database regime for my phd and am looking for a suitable database system.
I'm looking for a simple data storage without the need for any complex queries or application connected to the database.
In terms of numbers (if thats possible to say) would the XE be suitable for approx 14 mill records (in 15 columns with an average of 10 char pr column) plus an increase in number of records of approx. 100.000 each year for the next 5 years.
Hope that was comprehansable.
Best regards
Nicolai
would the XE be suitable for approx 14 mill records (in 15 columns with an average of 10 char pr column) plus an increase in number of records of approx. 100.000 each year for the next 5 years.Oracle Database Express Edition 11g Release 2 has known limitations. See Licensing Restrictions... but it probably will be able to fulfill your requirement:
14 mill + 500k makes 14.5 mill in total.
Simple maths would be:
14.5 mill * 15 * 10 result in approx. 2 GB of data. Add some overhead for indexes and other things you may or may not need to store aside from your main data pool the 11 GB allowed to be used in 11.2 XE should be sufficient.
On the other hand, you may have some restrictions on performance, since memory and cpu usage are limited as well, so processing large amounts of data at once (in a single query) might result in poor response times.
-Udo
Similar Messages
-
Count Number of Records in Oracle Database Table
Please help me to see if I "set" and "return" the number of records in my database table correctly (I am using the Oracle 9i):
public int getNumberOfRecipientBeans() throws AssertionException, DatabaseException
Connection conn = null;
PreparedStatement stmt = null;
String query = "SELECT count(*) FROM ContactEntry WHERE ContactTypeID = 6";
ResultSet rs = null;
try
conn = DBConnection.getDBConnection();
stmt = conn.prepareStatement( query );
rs = stmt.executeQuery();
// do I have to set anything here?
if ( !rs.next() )
throw new AssertionException("Assertion in servuce.getNumberOfRecipients");
// Am I returning the counts here?
return rs.getInt( 1 );
catch( SQLException sqle )
sqle.printStackTrace();
throw new DatabaseException( "Error executing SQL in service.getNumberOfRecipients." );
finally
if ( conn != null )
try
stmt.close();
stmt = null;
conn.close();
catch( Exception Ex )
System.out.println( "Problem occurs while closing " + Ex );
conn = null;public class MyE extends Exception {
public MyE() {
super(); // this line is not necessary. An empty method would suffice
public MyE(String msg) {
super(msg);
// Check the API for Exception or Throwable--I may have the args backward
public MyE(String msg, Throwable cause) {
super(msg, cause);
public MyE(Throwable cause) {
super(cause);
// Replace the log_warn() calls with appropriate logging calls for your context
public class Closer {
public static final void close(ResultSet closeMe) {
if (closeMe != null) {
try {
closeMe.close();
catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
public static final void close(Statement closeMe) {
if (closeMe != null) {
try {
closeMe.close();
catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
public static final void close(Connection closeMe) {
if (closeMe != null) {
try {
closeMe.close();
catch (Throwable th) { log_.warn("Closing " + closeMe + ": ", th); }
public static final void close(ResultSet rs, Statement stmt, Connection con) {
close(rs);
close(stmt);
close(con);
} -
Oracle 11G and SqlDataSource: 'ORA-01036: illegal variable name/number'
[Resolved - http://forums.oracle.com/forums/thread.jspa?messageID=2366331�]
I've created a short video to explain my problem with Oracle and SqlDataSource. If you'd rather watch than read, go see the video at http://www.kencox.ca/video/oracelandsqldatasource.html.
I'm trying to do some extremely simple drag and drop development in Visual Web Developer 2008 with the Oracle 11g database and ODP.NET. According to Oracle, "The data provider can be used with the latest .NET Framework 3.5 version. "
The SELECT statement works fine, but any attempt to use UPDATE via the SQLDataSource UpdateCommand nets me the infamous 'ORA-01036: illegal variable name/number' error.
I wouldn't mind using one of my MSDN Support Incidents to have Microsoft take a look at this issue, but I'm not sure the problem is Microsoft's. It seems like Oracle is doing a poor job in its Visual Studio integration.
Question: Has anyone successfully used an UpdateCommand statement in SQLDataSource against Oracle 11g? If so, let me know!
Below, you see the entire code as generated in Visual Web Developer 2008. To see it in action, check the video at http://www.kencox.ca/video/oracelandsqldatasource.html.
Ken
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ACCOUNTID" HeaderText="ACCOUNTID"
SortExpression="ACCOUNTID" />
<asp:BoundField DataField="ACCOUNTNAME" HeaderText="ACCOUNTNAME"
SortExpression="ACCOUNTNAME" />
<asp:BoundField DataField="ACCOUNTLOCATION" HeaderText="ACCOUNTLOCATION"
SortExpression="ACCOUNTLOCATION" />
<asp:BoundField DataField="ACCOUNTPHONE" HeaderText="ACCOUNTPHONE"
SortExpression="ACCOUNTPHONE" />
<asp:BoundField DataField="ACCOUNTCONTACT" HeaderText="ACCOUNTCONTACT"
SortExpression="ACCOUNTCONTACT" />
<asp:BoundField DataField="ACCOUNTWEBSITE" HeaderText="ACCOUNTWEBSITE"
SortExpression="ACCOUNTWEBSITE" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>"
SelectCommand="SELECT "ACCOUNTID", "ACCOUNTNAME", "ACCOUNTLOCATION", "ACCOUNTPHONE", "ACCOUNTCONTACT", "ACCOUNTWEBSITE" FROM "ACCOUNTS""
UpdateCommand="UPDATE ACCOUNTS SET ACCOUNTLOCATION = 'This Place' WHERE (ACCOUNTID = 4)">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>//////////using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Message was edited by:
kjopcKen,
One thing to be aware of is Microsoft has produced Visual Studio database tools and data provider for Oracle. In addition, Oracle has produced its own tools. Knowing which products you are using is important because you want to know which company you should be complaining about. :-)
In your video, you are using all Microsoft tools and data provider, not Oracle's.
I would recommend using Oracle Developer Tools (ODT) for VS and ODP.NET since these products are much better integrated with .NET and Oracle.
ODP.NET uses Oracle.DataAccess.Client namespace. System.Data.OracleClient belongs to the MS provider for Oracle, which Mark pointed out. If you drag and drop DB objects using ODT, it will generate ODP.NET code for you (and give you more data source wizard options as well).
You can download the latest 11g version of ODP.NET and ODT here:
http://www.oracle.com/technology/software/tech/windows/odpnet/index.html
These support .NET 3.5 and VS 2008. -
External tables in Oracle 11g database is not loading null value records
We have upgraded our DB from Oracle 9i to 11g...
It was noticed that data load to external tables in 9i is rejecting the records with null columns..However upgrading it to 11g,it allows the records with null values.
Is there are way to restrict loading the records that has few coulmns that are null..
Can you please share if this is the expected behaviour in Oracle 11g...
Thanks.Data isn't really loaded to an External Table. Rather, the external table lets you query an external data source as if it were a regular database table. To not see the rows with the NULL value, simply filter those rows out with your SQL statement:
SELECT * FROM my_external_table WHERE colX IS NOT NULL;
HTH,
Brian -
Select first and last records in grouped results - Oracle 11g
Say I have the following information in an Oracle 11g table:
Qty
Production order
Date and time
20
00000000000000001
12-JAN-14 00:02
20
00000000000000001
12-JAN-14 00:05
20
00000000000000001
12-JAN-14 00:07
20
00000000000000001
13-JAN-14 00:09
30
00000000000000002
12-JAN-14 00:11
30
00000000000000002
12-JAN-14 00:15
30
00000000000000002
12-JAN-14 00:20
30
00000000000000002
14-JAN-14 00:29
I would like to write a query that would return the following:
Qty
Production order
First
Last
80
00000000000000001
12-JAN-14 00:02
13-JAN-14 00:09
120
00000000000000002
12-JAN-14 00:11
14-JAN-14 00:29
That is, the sum of the Qty column grouped by Production order, and the date/time of the first and last records for each Production order.
I came up with a query that yielded this result:
Qty
Production order
First
Last
80
00000000000000001
12-JAN-14 00:02
14-JAN-14 00:29
120
00000000000000002
12-JAN-14 00:02
14-JAN-14 00:29
Which means that the First and Last columns show the overall first and last date / time of the whole table. Please note that this is a dummy table. Sorry I am now allowed to write the actual query
I came up with since work policies do not allow me to share it. Also, I tried with windowing functions such as rank()and row_number() but my user does not have enough privileges to do so.
Any help or hints will be greatly appreciated.Due to the fact that Oracle does not record the rows in any particular order, it would be wrong that the "first date" would be the first row processed by the query.
Therefore you would have to supply some other column if you do not want to consider the table as ordered by date.
Also, any analytical functions will need you to supply the "order by" and if its the date, then just a simple query will do:
SQL>WITH Tab1 (Qty, Production_Order, Pdate)
2 AS (SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:02', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
3 SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:05', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
4 SELECT 20, '00000000000000001', TO_DATE ( '12-JAN-14 00:07', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
5 SELECT 20, '00000000000000001', TO_DATE ( '13-JAN-14 00:09', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
6 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:11', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
7 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:15', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
8 SELECT 30, '00000000000000002', TO_DATE ( '12-JAN-14 00:20', 'DD-MON-YY HH24:MI') FROM DUAL UNION ALL
9 SELECT 30, '00000000000000002', TO_DATE ( '14-JAN-14 00:29', 'DD-MON-YY HH24:MI') FROM DUAL)
10 SELECT SUM ( Qty), Production_Order, MIN ( Pdate), MAX ( Pdate)
11 FROM Tab1
12 GROUP BY Production_Order
13* ORDER BY Production_Order
SQL> /
SUM(QTY) PRODUCTION_ORDER MIN(PDATE) MAX(PDATE)
80 00000000000000001 12-Jan-2014 00:02:00 13-Jan-2014 00:09:00
120 00000000000000002 12-Jan-2014 00:11:00 14-Jan-2014 00:29:00 -
Number of available records in Oracle 10g express database
Hi,
I am facing problems in getting the number of available records in Oracle 10g express database with the following query.
string filename = dbObject.FILENAME;
string vendorID = dbObject.VENDOR_ID;
OracleCommand myCommand = _connection.CreateCommand();
myCommand.CommandText = "SELECT COUNT(*) FROM ASSET_PROCESSING_OUTPUT WHERE *FILENAME = :filename AND VENDOR_ID = :vendorID*";
myCommand.CommandType = CommandType.Text;
myCommand.Parameters.AddWithValue("filename", filename);
myCommand.Parameters.AddWithValue("vendorID", vendorID);
OracleDataReader reader = myCommand.ExecuteReader();
Using this command how can I get if the record exists in the database with the given value.
Thanks in advance.
punitIt appears you're only executing the statement. You need to fetch the result to see the value returned by the SELECT statement.
-
Oracle Procedure returning more number of records
Hi,
I have created an Oracle Procedure which is supposed to fetch a record as per the input parameter passed.
The core query in the procedure is as below -
SELECT DISTINCT col1 FROM my_tab WHERE col2 = 'Input parameter'
Few of the input parms (col2) has more number of records (col1) and so the procedure gives an error like -
'ORA-01422: exact fetch returns more than requested number of rows'
Could you please let me know how can I modify the procedure so that it would return more number of records as the case may be?
Thank you!It still gives me the same error when it encounters more than one output.Yes, I'm sure it does.
But we can't tell you how to fix it because we don't know what you want.
What's the purpose of the procedure?
Is it to "spell check" the name of an intermediary? If so, you'll need to figure out what to do when you have more then one person with the same name.
You can add AND ROWNUM = 1. Or perhaps you can trap the too_many_rows exception.
Your procedure doesn't return anything (no out variables). Is that correct?
Or is the purpose of the procedure to return the ID of the matching name? -
Oracle 11g R2 write audit record to application event log in Windows server
Hi,
I have a oracle 11g R1 database in windows 2003 server,
I set the init parameter audit_trail=db,extended,
but some auditing record still keep writting to windows application log
Event Type: Information
Event Source: Oracle.test
Event Category: None
Event ID: 34
Date: 9/7/2011
Time: 3:36:38 PM
User: N/A
Computer: test
Description:
Audit trail: LENGTH: "226" SESSIONID:[7] "3875588" ENTRYID:[1] "1" USERID:[8] "test" ACTION:[3] "102" RETURNCODE:[1] "0" LOGOFF$PREAD:[1] "1" LOGOFF$LREAD:[3] "755" LOGOFF$LWRITE:[2] "26" LOGOFF$DEAD:[1] "0" DBID:[10] "1613217480" SESSIONCPU:[1] "0".
Is there any way to disable this?
Thanks
Vincentoh really, dont you say?
maybe next time read the whole note, not just the title
"In 11g these 'logoff by cleanup' audit records are not logged in DBA_AUDIT_TRAIL. The connection record remains as 'logon' record. It is not updated to 'logoff by cleanup'. *In these cases, the log off information like logoff_time, logoff_lread etc are written to an OS audit file as 'logoff by cleanup' audit record.* " -
Number of standby databases in Oracle 11g
Hi ,
We could create maximum of 9 standby databases in Oracle 10g.
How many maximum number of standby databases can be created in Oracle 11g?
Regards
BarkhaaYou can search for the answer here: http://www.oracle.com/pls/db112/homepage
-
Oracle 11g database stores CAS number incorrectly in chemical database.
Hi,
I have an issue in Oracle 11g database. I am working on a chemical database which handles chemical structures ,formulas, CAS numbers, ACX number. The database has a compound table which stores compound attributes like chemical structure, molecular weight, CAS number and so on. The CAS number is of type varchar2(15) and will be in the format 50-50-0. All the CAS numbers will be in this format.
The issue which I found specific to Oracle11g database is that when a CAS number is edite and saved from the application it changes into some random characters like AEAAAA8AA in the table. With Oracle 10g version there were no issues. Can anyone please help me to understand what could be the reason for this? Looking forward to your replies on this.
ThanksOk, thanks to all for pointers on finding the alert log. Found it. here's the relevant section, I believe:
ARCH: Error 19809 Creating archive log file to 'D:\ORADATA\FASTRECOVERY\....\ARCHIVELOG\2012_11_07\O1_MF_1_2456_%U_.ARC'
Errors in file C:\APP\diag\rdbms\....\trace\ukgb01_ora_3308.trc:
ORA-16038: log 2 sequence# 2456 cannot be archived
ORA-19809: limit exceeded for recovery files
ORA-00312: online log 2 thread 1: 'F:\ORADATA\REDO\....\REDO02.LOG'
USER (ospid: 3308): terminating the instance due to error 16038
ARC0: STARTING ARCH PROCESSES
System state dump requested by (instance=1, osid=3308), summary=[abnormal instance termination].
System State dumped to trace file C:\APP\diag\rdbms\.....\trace\xxxxx_diag_504.trc
Dumping diagnostic data in directory=[cdmp_20121107205514], requested by (instance=1, osid=3308), summary=[abnormal instance termination].
Instance terminated by USER, pid = 3308
Wed Nov 07 21:13:40 2012
Adjusting the default value of parameter parallel_max_servers
from 640 to 185 due to the value of parameter processes (200)
Starting ORACLE instance (normal)
I'm new to all this. What do I do in rman to clear this up? -
Where can i find oracle 11g csi number
Hi oracle Lord’s
This is Arun, I’m facing some problem while I installing oracle 11g on my machine. I downloaded oracle 11g from the below link
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html.
While I installing oracle 11g it will ask CSI Number, from where can I get the CSI number.
Thanks in advance.
Regards
Arun M MYou need to buy from your local oracle partner. This is the customer service identification number which need to log in to metalink support. But you don't need CSI to install oracle database. Avoid to check the latest patch version which need the CSI for connecting metalink.
In this paper we will install the 11.2.0.1 release of Oracle Database 11g. This is the base distribution of Oracle Database 11g release 2. Be sure to check Oracle Support’s Metalink at http://metalink.oracle.com to see if a newer patch set has been released since this paper was published. You will need a valid Customer Service Identifier (CSI) number in order to access the Metalink website.
Source : http://www.dbspecialists.com/oracle11glinux.html
Also,
2.4 Preinstallation Requirements for Oracle Configuration Manager
During installation, you are prompted to provide information required to enable Oracle Configuration Manager. In the event that you need to place a service request with Oracle Support, the configuration information can help to provide a more rapid resolution to the service issue.
You can enable Oracle Configuration Manager during or after installation, or choose not to enable it. To enable it during installation, you must have the following information available:
Customer Support Identification Number (CSI) that identifies your organization
OracleMetalink user account name
Country code associated with your service agreement
So, don't install OCM during the installation.
Regards
Asif Kabir
Edited by: asifkabirdba on Aug 29, 2010 12:50 PM -
Oracle 11g Table function returns no records on first call
Hello,
On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
Does anyone know of settings that can relate to this behaviour ?
Thanks in advance for the help.
Regards,
Stefano MuretThank you for answering so fast.
Here's the function code:
FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
RETURN table_type_tmpl_parameters PIPELINED
IS
li_exception INTEGER DEFAULT -20025;
POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
lt_parms table_type_tmpl_parms_raw;
sParmCheck VARCHAR2(4000);
iOccurrence INTEGER;
BEGIN
pOut_Parm := table_type_tmpl_parameters();
pOut_Parm.EXTEND;
select
tmpl_id
*,tmpl_name*
*,replace(upper(trim(sql_out)),'[SCHEMA].')*
*,UPPER(TRIM(out_tmpl_parms))*
bulk collect into lt_parms
from ref_templates
where tmpl_id = NVL(iTemplate,tmpl_id)
order by tmpl_id;
FOR k IN 1..lt_parms.COUNT
LOOP
pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
FOR i IN 1..2
LOOP
IF i = 1 THEN
sParmCheck := lt_parms(k).sql_out;
ELSE
sParmCheck := lt_parms(k).sql_parms;
END IF;
iOccurrence := 1;
*pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
WHILE pOut_Parm(1).parameter_name IS NOT NULL
LOOP
PIPE ROW (pOut_Parm(1));
iOccurrence := iOccurrence + 1;
*pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
END LOOP;
END LOOP;
END LOOP;
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
RETURN;
END template_parameters;
This function is part of a package.
The data on both environments is the same. -
Oracle 11g - Problem in referring ROWNUM in the SQL
Hello All,
We are facing a strange problem with Oracle 11g (11.2.0.1.0).
When we issue a query which refers the rownum, it returns a invalid record ( which is not exists in the table).
The same sql is working fine once we analyze the table
Note: The same sql is working fine with oracle 10g (Before analyze also).
The script to reproduce the issue:
DROP TABLE BusinessEntities;
CREATE TABLE BusinessEntities
business_entity_id VARCHAR2(25) PRIMARY KEY,
business_entity_name VARCHAR2(50) NOT NULL ,
owner_id VARCHAR2(25) ,
statutory_detail_id NUMBER ,
address_id NUMBER NOT NULL
DROP TABLE BusEntityRoles;
CREATE TABLE BusEntityRoles
business_entity_id VARCHAR2(25) NOT NULL,
role_id VARCHAR2(10) NOT NULL,
PRIMARY KEY (business_entity_id, role_id)
INSERT
INTO businessentities ( business_entity_id , business_entity_name, owner_id , statutory_detail_id , address_id)
VALUES
( 'OWNER', 'OWNER Corporation Ltd', NULL , 1, 1 );
INSERT
INTO businessentities ( business_entity_id , business_entity_name, owner_id , statutory_detail_id , address_id)
VALUES
( 'ALL_IN_ALL', 'ALL IN ALL Corporation Ltd', 'OWNER' , 2, 2 );
INSERT INTO busentityroles(business_entity_id, role_id) VALUES ('TEST' , 'OWNER');
INSERT INTO busentityroles (business_entity_id,role_id) VALUES ('TEST','VENDOR');
INSERT INTO busentityroles(business_entity_id, role_id) VALUES ('ALL_IN_ALL' , 'VENDOR');
SELECT *
FROM
(SELECT raw_sql_.business_entity_id, raw_sql_.business_entity_name, raw_sql_.owner_id, raw_sql_.address_id,
rownum raw_rnum_
FROM
(SELECT *
FROM BusinessEntities
WHERE (business_entity_id IN
(SELECT business_entity_id
FROM BusinessEntities
WHERE business_entity_id = 'OWNER'
OR owner_id = 'ALL_IN_ALL'
AND business_entity_id NOT IN
(SELECT business_entity_id FROM BusEntityRoles
ORDER BY business_entity_id ASC
) raw_sql_
WHERE rownum <= 5
WHERE raw_rnum_ > 0;
OUTPUT Before Analyzing
BUSINESS_ENTITY_ID: OWNER
BUSINESS_ENTITY_NAME: NULL
OWNER_ID: OWNER
ADDRESS_ID: NULL
RAW_RNUM_: 1
Note: There is no record in the table with the value business_entity_id as 'OWNER' and OWNER_ID as 'OWNER' and the address_id as NULL
OUTPUT : After analyzed the table Using the below mentioned command
ANALYZE TABLE "BUSENTITYSUPPLYCHAINROLES" ESTIMATE STATISTICS
ANALYZE TABLE "BUSINESSENTITIES" ESTIMATE STATISTICS
BUSINESS_ENTITY_ID: OWNER
BUSINESS_ENTITY_NAME: OWNER Corporation Ltd
OWNER_ID: NULL
ADDRESS_ID: 1
RAW_RNUM_: 1
Any clue why Oracle 11g is behaving like this.Hi,
it's a good practice to give aliases for tables, as well as name query blocks. Here it is (and formatted for convinience):
select --/*+ gather_plan_statistics optimizer_features_enable('10.2.0.4') */
from (select /*+ qb_name(v2) */
raw_sql_.business_entity_id
,raw_sql_.business_entity_name
,raw_sql_.owner_id
,raw_sql_.address_id
,rownum raw_rnum_
from (select /*+ qb_name(v1) */ *
from businessentities b1
where (b1.business_entity_id in
(select /*+ qb_name(in) */ b2.business_entity_id
from businessentities b2
where business_entity_id = 'OWNER'
or owner_id = 'ALL_IN_ALL'
and business_entity_id not in
(select /*+ qb_name(not_in) */ r.business_entity_id from busentityroles r)))
order by business_entity_id asc) raw_sql_
where rownum <= 5)
where raw_rnum_ > 0;You are facing some bug - definitely - and, possibly, it is caused by [join elimination|http://optimizermagic.blogspot.com/2008/06/why-are-some-of-tables-in-my-query.html]. As a workaround you should rewrite the query to eliminate unnecessary join manually; or you may include a hint to not eliminate join (it's not documented):
SQL>
select -- /*+ gather_plan_statistics optimizer_features_enable('10.2.0.4') */
from (select /*+ qb_name(v2) */
raw_sql_.business_entity_id
,raw_sql_.business_entity_name
,raw_sql_.owner_id
,raw_sql_.address_id
,rownum raw_rnum_
from (select /*+ qb_name(v1) no_eliminate_join(b1) */ *
from businessentities b1
where (b1.business_entity_id in
(select /*+ qb_name(in) */ b2.business_entity_id
from businessentities b2
where business_entity_id = 'OWNER'
or owner_id = 'ALL_IN_ALL'
and business_entity_id not in
(select /*+ qb_name(not_in) */ r.business_entity_id from busentityroles r)))
order by business_entity_id asc) raw_sql_
where rownum <= 5)
20 where raw_rnum_ > 0;
BUSINESS_ENTITY_ID BUSINESS_ENTITY_NAME OWNER_ID ADDRESS_ID RAW_RNUM_
OWNER OWNER Corporation Ltd 1 1Strange thing is executing a transformed query gives correct result too:
SELECT "from$_subquery$_001"."BUSINESS_ENTITY_ID" "BUSINESS_ENTITY_ID",
"from$_subquery$_001"."BUSINESS_ENTITY_NAME" "BUSINESS_ENTITY_NAME",
"from$_subquery$_001"."OWNER_ID" "OWNER_ID",
"from$_subquery$_001"."ADDRESS_ID" "ADDRESS_ID",
"from$_subquery$_001"."RAW_RNUM_" "RAW_RNUM_"
FROM (SELECT /*+ QB_NAME ("V2") */
"RAW_SQL_"."BUSINESS_ENTITY_ID" "BUSINESS_ENTITY_ID",
"RAW_SQL_"."BUSINESS_ENTITY_NAME" "BUSINESS_ENTITY_NAME",
"RAW_SQL_"."OWNER_ID" "OWNER_ID","RAW_SQL_"."ADDRESS_ID" "ADDRESS_ID",
ROWNUM "RAW_RNUM_"
FROM (SELECT /*+ QB_NAME ("V1") */
"SYS_ALIAS_1"."BUSINESS_ENTITY_ID" "BUSINESS_ENTITY_ID",
"SYS_ALIAS_1"."BUSINESS_ENTITY_NAME" "BUSINESS_ENTITY_NAME",
"SYS_ALIAS_1"."OWNER_ID" "OWNER_ID",
"SYS_ALIAS_1"."STATUTORY_DETAIL_ID" "STATUTORY_DETAIL_ID",
"SYS_ALIAS_1"."ADDRESS_ID" "ADDRESS_ID"
FROM "TIM"."BUSINESSENTITIES" "SYS_ALIAS_1"
WHERE ("SYS_ALIAS_1"."BUSINESS_ENTITY_ID"='OWNER'
OR "SYS_ALIAS_1"."OWNER_ID"='ALL_IN_ALL' AND NOT
EXISTS (SELECT /*+ QB_NAME ("NOT_IN") */ 0
FROM "TIM"."BUSENTITYROLES" "R"
WHERE "R"."BUSINESS_ENTITY_ID"="SYS_ALIAS_1"."BUSINESS_ENTITY_ID")
ORDER BY "SYS_ALIAS_1"."BUSINESS_ENTITY_ID") "RAW_SQL_"
WHERE ROWNUM<=5) "from$_subquery$_001"
26 WHERE "from$_subquery$_001"."RAW_RNUM_">0
27 /
BUSINESS_ENTITY_ID BUSINESS_ENTITY_NAME OWNER_ID ADDRESS_ID RAW_RNUM_
OWNER OWNER Corporation Ltd 1 1 -
Oracle 11g/R2 Query Result Cache - Incremental Update
Hi,
In Oracle 11g/R2, I created replica of HR.Employees table & executed the following statement (+Although using SUM() function is non-logical in this case, but just testifying the result+)
STEP - 1
SELECT /+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)*
FROM HR.Employees_copy
WHERE department_id = 20
GROUP BY employee_id, first_name, last_name;
EMPLOYEE_ID FIRST_NAME LAST_NAME SUM(SALARY)
202 Pat Fay 6000
201 Michael Hartstein 13000
Elapsed: 00:00:00.01
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 2 | 130 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 2 | 130 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL | EMPLOYEES_COPY | 2 | 130 | 3 (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------- Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
*690* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
STEP - 2
INSERT INTO HR.employees_copy
VALUES(200, 'Dummy', 'User','[email protected]',NULL, sysdate, 'MANAGER',5000, NULL,NULL,20);
STEP - 3
SELECT /*+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)
FROM HR.Employees_copy
WHERE department_id = 20
GROUP BY employee_id, first_name, last_name;
EMPLOYEE_ID FIRST_NAME LAST_NAME SUM(SALARY)
202 Pat Fay 6000
201 Michael Hartstein 13000
200 Dummy User 5000
Elapsed: 00:00:00.03
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 195 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 3 | 195 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| EMPLOYEES_COPY | 3 | 195 | 3 (0)| 00:00:01 |
Statistics
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
*714* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
In the execution plan of STEP-3, against ID-1 the operation RESULT CACHE is shown which shows the result has been retrieved directly from Result cache. Does this mean that Oracle Server has Incrementally Retrieved the resultset?
Because, before the execution of STEP-2, the cache contained only 2 records. Then 1 record was inserted but after STEP-3, a total of 3 records was returned from cache. Does this mean that newly inserted row is retrieved from database and merged to the cached result of STEP-1?
If Oracle server has incrementally retrieved and merged newly inserted record, what mechanism is being used by the Oracle to do so?
Regards,
Wasif
Edited by: 965300 on Oct 15, 2012 12:25 AM965300 wrote:
Hi,
In Oracle 11g/R2, I created replica of HR.Employees table & executed the following statement (+Although using SUM() function is non-logical in this case, but just testifying the result+)
STEP - 1
SELECT /+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)*
FROM HR.Employees_copy
WHERE department_id = 20
GROUP BY employee_id, first_name, last_name;
EMPLOYEE_ID FIRST_NAME LAST_NAME SUM(SALARY)
202 Pat Fay 6000
201 Michael Hartstein 13000
Elapsed: 00:00:00.01
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 2 | 130 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 2 | 130 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL | EMPLOYEES_COPY | 2 | 130 | 3 (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------- Statistics
0 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
*690* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
STEP - 2
INSERT INTO HR.employees_copy
VALUES(200, 'Dummy', 'User','[email protected]',NULL, sysdate, 'MANAGER',5000, NULL,NULL,20);
STEP - 3
SELECT /*+ RESULT_CACHE */ employee_id, first_name, last_name, SUM(salary)
FROM HR.Employees_copy
WHERE department_id = 20
GROUP BY employee_id, first_name, last_name;
EMPLOYEE_ID FIRST_NAME LAST_NAME SUM(SALARY)
202 Pat Fay 6000
201 Michael Hartstein 13000
200 Dummy User 5000
Elapsed: 00:00:00.03
Execution Plan
Plan hash value: 3837552314
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 3 | 195 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3acbj133x8qkq8f8m7zm0br3mu | | | | |
| 2 | HASH GROUP BY | | 3 | 195 | 4 (25)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| EMPLOYEES_COPY | 3 | 195 | 3 (0)| 00:00:01 |
Statistics
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
*714* bytes sent via SQL*Net to client
416 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
In the execution plan of STEP-3, against ID-1 the operation RESULT CACHE is shown which shows the result has been retrieved directly from Result cache. Does this mean that Oracle Server has Incrementally Retrieved the resultset?
Because, before the execution of STEP-2, the cache contained only 2 records. Then 1 record was inserted but after STEP-3, a total of 3 records was returned from cache. Does this mean that newly inserted row is retrieved from database and merged to the cached result of STEP-1?
If Oracle server has incrementally retrieved and merged newly inserted record, what mechanism is being used by the Oracle to do so?
Regards,
Wasif
Edited by: 965300 on Oct 15, 2012 12:25 AMNo, the RESULT CACHE operation doesn't necessarily mean that the results are retrieved from there. It could be being
written to there.
Look at the number of consistent gets: it's zero in the first step (I assume you had already run this query before) and I would
conclude that the data is being read from the result cache.
In the third step there are 4 consistent gets. I would conclude that the data is being written to the result cache, a fourth step repeating
the SQL should show zero consistent gets and that would be the results being read. -
Hello,
I am a new user for Oracle 11g. After the successful installation when I tried to Logging to SQL Plus Command Prompt with username and Password .Its throws the following set of errors
Error Message
Enter user-name: myOracle
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0
I again tried to login through SYS as SYSDBA but its saying Log Files are full and show the following set of message
Error Message Through CMD
C:\Documents and Settings\Bhaskar Anand>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 25 14:37:22 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter password:
ERROR:
ORA-28056: Writing audit records to Windows Event Log failed
OSD-2266672: Message 2266672 not found; product=RDBMS; facility=SOSD
O/S-Error: (OS 1502) The event log file is full.
ORA-28056: Writing audit records to Windows Event Log failed
OSD-2266672: Message 2266672 not found; product=RDBMS; facility=SOSD
O/S-Error: (OS 1502) The event log file is full.
Do Help me with the situationrefer the link:-ORA-28056: while connect to the database
Maybe you are looking for
-
[Solved]How can I create a bootable backup of my arch linux partition?
I'm trying to get my arch linux installation to have a gui, specifically KDE. I downloaded Xorg and the nvidia proprietary driver 340.24. After installing the nvidia driver and rebooting, my screen stays black and I can't see my console. I can still
-
SAP R/3 4.7 migration using Veritas PDC solution
Hi, I would like to do a heterogeneous system copy. My current environment:- OS= IBM AIX DB=Oracle 9i DB size=6TB Storage= Veritas Storage foundation suite (Portable Data Container) Target system:- OS=HPUX DB=Oracle 9i DB size=6TB Storage= Veritas St
-
Please advise, i have somehow downloaded some extra tracks of the same songs, plus their relavant albums showing in songs/albums lists on my ipod nano 7th gen,how can i remove the unwanted extra songs/albums safely. Please note i am a newcomer to u
-
Can anyone tell me whether you can stream audio stored on the hard drive of an Apple TV to "non-computer" clients (such as an Audiotron) via a home network? I do this currently with my (old) HP DE100C unit and it works great but the Apple TV is much
-
Influencing DBA_HIST_SQLSTAT
We recently migrated from HPUX to Linux 11GR2 on both. The data architect says that prior to the migration, the DBA_HIST_SQLSTAT view was populated by a lot more SQL statements than appear now. He wishes to know the reason for the discrepancy, and fr