|
Jörgen Andersson wrote: Or as Tom Kyte[^] has said: "full scans are NOT ALWAYS evil, indexes are NOT ALWAYS good"
For many years I tried to nail down the best practice when indexing and tuning a database (generally sql server). Every time I had a DBA cornered I would quiz them on this subject and every time I would get back the namby pamby response "it depends", what sort of response is that, I want to lay down immutable rules that say this is how to set up the indexing, "it depends" just does not cut it.
Ah thats better, needed that, it's been slow day here.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
A DBA that doesn't say "it depends", hasn't been presented a specific enough case.
But I have found one "rule" that hasn't failed me yet when it's about aggregating data. It's all about minimizing the amount of data (in bytes, not necessarily rows) that the db has to handle.
Say for example that you want to join together several tables, some holding descriptive texts and some other holding data that should be aggregated.
If you make a query that makes the joins and the aggregation in one go, then the db will join first and aggregate later, creating millions of rows with text that will just be grouped when the aggregation happens. Creating all this in memory, or in worst case the HD, takes time.
Instead I'm breaking down all queries into smaller parts that I materialize using subquery factoring (CTE for you SQLServer people) and then I join the results from them together.
So I'm making one or more queries that aggregate the data, and one or more separate queries for the descriptions, and then I join the aggregated results together in the end.
This method is often magnitudes faster than a onepiece query.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
That's one of my "rules" too.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
I'm going to try different hints for the cursor to see what happens. Thanks.
Ultimately I expect to have to re-develop this whole procedure. It was originally written for Oracle 7 and then had several changes when migrated to 8. Since then it has not been touched, but I think I'll be heavily testing over the holidays.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Hi
Recently i faced an issue on sql database.
The database is in production which holds the data of all the employees in employee table
Recently we found that values in employee table(not all values) got changed. Bdays, Status are the columns which we identified and not sure if there is more data that got modified.
I need to find what exactly has happened, like any transactions that took place on the table? Or any other other way to find what has happened on database.
Thanks in advance
Naina
Naina
|
|
|
|
|
You could check list of recently ran query in SQL.
See HERE[^].
|
|
|
|
|
Hi
Thanks for the query, but the query gives only today's transactions. Is there any way to get old transactions?
Naina
Naina
|
|
|
|
|
Hi all,
I am using oracle transactions in c#.net in .net frameowrk 2008.The WCF web application giving error "Can't serialize access for the transaction" when multiple user searches for same record in a table in Oracle 11g can anybody tell how can it be resolved.I have increased the initrans value to 100 it is not giving error now, but what if the user gets above 1000 limit.will initrans works.
Thanks in advance.
|
|
|
|
|
|
I am trying to load a DB up with about 3100 tables of data using C#.
Somewhere around table 1770 I get the following message
"Microsoft SQL Native Client: Not enough storage is available to complete this operation."
Does anyone know how to fix this problem, any help would be greatly appreciated.
Thanks in advance,
Michael
|
|
|
|
|
Well you are doing something wrong, we load 1000s of table every day, peak is about 2k per hour. There is not enough info to be able to help here.
How are you loading the data in, BCP, BulkCopy, 1 record at a time?
Is you client having the problem or is it just relaying the error from the server.
Have you checked the transaction log size of the server, the event log of the server, the database properties of the server.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So...I am running Visual Studio 2010 on a new Windows 7 machine. I have a server on the network running Windows 2003 server with Oracle 9i and 10g installed. I am trying to connect to the Oracle 10g database on that server from a new .Net application on the Windows 7 machine. This is the error I keep getting:
{"System.Data.OracleClient requires Oracle client software version 8.1.7 or greater."}
I Googled the error and I have tried the following suggestions:
1. Changed the administration folder permissions for Read and Execute for Authenticated Users (with reboot).
2. Made changes to the tnsNames.ora file
3. Made changes to the sqlnet.ora file as follows; NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
4. Changed the listening port to the following different port numbers (1521,1522,8081).
This is the connection code with the various config strings that I have tried (Tel1 is the server name):
string CONNSTR =
"Data Source=//Tel1:1522;User Id=Patrick;Password=Pass;Integrated Security=no";
public Oracle()
{
InitializeComponent();
}
private void TestMyOracleConnection()
{
OracleConnection Conn = new OracleConnection(CONNSTR);
try
{
Conn.Open();
MessageBox.Show("Connection Established", "Success");
}
catch (OracleException ex)
{
MessageBox.Show(ex.Message, "Oracle Connection Failed!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Oracle Connection Failed!");
}
finally
{
Conn.Close();
MessageBox.Show("Connection Closed", "Success");
}
}
private void buttonTestConnection_Click(object sender, EventArgs e)
{
TestMyOracleConnection();
}
I am exasperated with this. I never have a connection issue with MS SQL or MySQL...in fact, I made connections from the same .Net program to both of these DB's both over the network and to a remotely hosted server and it works perfectly. Obviously, my knowledge of Oracle leaves much to be desired. I would appreciate any idea's or suggestions. Thank you...Pat
|
|
|
|
|
I beleive your dev machine needs the Oracle client installed (ours did) not just the tsnames file.
One of the benefits f going to WCF is that I only need to deal with the server connection to Oracle, not all the clients
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
RAH,
Thank you for your solution proposal. Please see message to Dilbert below...and thank you for your time and help...Pat.
|
|
|
|
|
Do I understand you correct that you have both oracle 9i and 10g on the same server.
While possible, it's a mess to configure, and in IMAO quite pointless.
Ok, that was a side track.
The error message you get is quite straight forward (for once).
Mycroft is probably quite correct, your Oracle client software isn't properly installed.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
Hello Dilbert
Thank you for your input. Re: WCF - comparing the 'cloud' to a real app is, to me, a joke...but if you prefer it, go for it!... . Now that that's settled...I am sure you are correct. My original request was somehow cut off before it was finished, so you did not see the end of my original statement. In any event, I installed the client on the developer machine and now I have 2 problems; First, it still does not work. The application stops responding and second; although I took the precaution of running 2 different catch error clauses (see the code), both for Oracle and for general use, the app actually crashes Windows 7 if I do not shut it down immediately following failure. I suppose that I could put the entire 10gEX version on the developer machine and try connecting directly to a local version first just to test the application. I might try that next if I cannot think of another solution. I am new to Oracle, and frankly, I don't like it from an administrative point of view. But it is not my choice to make. If the vendor already has the database in place, it is simply for me to make the application work with it. Thank you again for your time and your reply...I do appreciate it. If you think of anything else, let me know...and have a nice day...Pat.
Re: 9i and 10g: a friend of mine that is a DBA for the military and an adjunct professor/instructor in databases at our college set this machine up for me to practice with. It was never intended to be an actual solution but rather a training aid. It also has MS SQL 2005 and MySql on it as well.>>Pat
|
|
|
|
|
PDTUM wrote: DBA for the military and an adjunct professor/instructor
Ok so a military academic set up your server with all the most common databases available and you wonder why it won't talk to you.
Seriously, I'm not surprised the poor thing won't cooperate. And yes Oracle is a PITA to manage, especially after coming from SQL Server, it does however chew through the data with gratifying speed.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
PDTUM wrote: the app actually crashes Windows 7 if I do not shut it down immediately following failure
The OS actually crashes versus you receiving an OS exception?
|
|
|
|
|
Hello js,
Thank you for your question....Yes. Since I made the earlier post, I have installed 10g on the local server and everything works perfectly. Although I have gotten great help from the people here, I still have the original issue in this case, so I just uploaded a post to another forum as I am still baffled by this. I will post the new text below. If you have any ideas...I am ALL ears... ...Thanks, Pat
I have a Windows 7 dev machine used to create .Net applications with VS 2010. I want to connect to a remote network server (using Windows 2003) that is running an Oracle 10g database. I also need to mention (just in case) that the remote server is also hosting an MS SQL 2005 application as well. I am using the code below (with the first connection string) to connect directly to a version of 10g that is running on the same machine with no problems, however when I try to connect to the network machine, it actually crashes Windows 7. I have tried several variations of connection strings as I feel that I must be making a sytax error somewhere. What concerns me is that I have dual try/catch statements in the application and I do not understand why it simply does not refuse the connection and report the error. I suppose the real question is 'what is the correct syntax for the connection string'....or WHATEVER the hell I am doing wrong. This is my first go around with Oracle (and I am not liking it at all), but it is not a matter of choice for me. SO.........any help or suggestions are greatly appreciated. Thank you in advance...Best Regards, Pat
string CONNSTR = "Server=192.168.2.5:1521;User ID=Patt;Password=Mine;";
public Oracle()
{
InitializeComponent();
}
private void TestMyOracleConnection()
{
OracleConnection Conn = new OracleConnection(CONNSTR);
try
{
Conn.Open();
MessageBox.Show("Oracle Connection Established", "Success");
}
catch (OracleException ex)
{
MessageBox.Show(ex.Message, "Oracle Connection Failed!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Oracle Connection Failed!");
}
finally
{
Conn.Close();
MessageBox.Show("Oracle Connection Closed", "Success");
}
}
private void buttonTestConnection_Click(object sender, EventArgs e)
{
TestMyOracleConnection();
}
|
|
|
|
|
An OS crash is a pretty severe problem and one which has nothing to do with your code.
It just simply shouldn't be possible.
Some possible avenues.
1. Try it on another machine. Perhaps you have some significant failure (like hardware) on your current box.
2. Try a different Oracle driver, if that is possible.
3. Insure the OS is up to date.
Solutions:
1. Is the target run machine going to be windows 7 (or server 2008)? If not then use a different OS for development.
2. Use a proxy server. I would suggest java. That is going to require a lot of work. But your app connects to the proxy app, it does the database work, and then returns the result.
The last is a rather severe solution but so is an OS crash.
|
|
|
|
|
Guys,
In a few days I have a meeting internally about redesigning the Oracle database from scratch.
The downside is that none of the meeting participants is a real DBA (IMHO we should hire a DBA consultant for advice), but we do have some knowledge about Oracle.
one of my major concerns is that someone opted for multiple smaller databases (that should communicate if necessary) I can think of multiple reasons why this is a bad idea, but I couldn't find any satisfactory links to proove it. (Maybe it isn't that bad after all?)
I did write some stuff down already (never delete, but rather 'inactivate', use history mechanism etc..)
In short: What do I need to watch out for when designing a new database ?
If it can help, we're an insurance company, but we also do call taking (could result in some tables having rapid changes when a lot of calls come in) Also we will start with adding one project to it, then a second, a third etc... so no one time porting to another database.
Many thanks in advance.
V.
|
|
|
|
|
V. wrote: IMHO we should hire a DBA consultant for advice
This is what you should do, getting a good one is always difficult and expensive. Having recently been dipped in Oracle for the first time in over a decade I can tell you the design and setup is VASTLY more difficult than sql server. The cost of getting a database design wrong enormously outweighs the initial expense of getting in a DBA.
For one, I'm told Oracle does not like multiple databases on a server, the design is to use schemas, I thought this was pure bullshit but it came from a DBA so it may be right.
For another Oracle is case sensitive when dealing with data so where name = 'Johny' will miss 'johny' IMHO this and the ongoing support requirement enough reason to use another database (sql server). The ONLY reason to use Oracle is if your data is so huge that SQL Server chokes. If your design spec says < 1tb per year I would use another database.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: For one, I'm told Oracle does not like multiple databases on a server, the design is to use schemas, I thought this was pure bullsh*t but it came from a DBA so it may be right.
It's BS. It works quite fine. It's just pointless. Multiple schemas is the way to go.
Mycroft Holmes wrote: For another Oracle is case sensitive when dealing with data so where name = 'Johny' will miss 'johny' IMHO this and the ongoing support requirement enough reason to use another database (sql server).
And the problem is what? Use a function based index and you got the best of both worlds.
Example:
CREATE INDEX foo_bar_ix
ON foo (
LOWER("bar")
)
/
And then you can search the table with Select * from Foo where lower(bar) = lower('Johnny');
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
Jörgen Andersson wrote: Use a function based index and you got the best of both worlds
Nice. I didn't know you could do that. A 5 just for that trick.
Jörgen Andersson wrote: It's BS. It works quite fine. It's just pointless
I suspect he's referring to the load on having multiple instances running as opposed to a single instance running multiple schema.
|
|
|
|
|
Pete O'Hanlon wrote: Nice. I didn't know you could do that. A 5 just for that trick.
That single trick alone is worth the extra trouble of using Oracle
"When did ignorance become a point of view" - Dilbert
|
|
|
|