Problem in sql
hi all,
iam having a table by name owner whos is having a particular filed by name mapclientid.one owner is assigned more than one client.iam having a mapping table and in that iam having two fields mapclientid and client id.another table iam having is clients in which iam having many information and also a field by name clientid.the clientid in the client table is a primary key.now i want to extract client information using form client table for a single owner whos is more than one client.plz give me examples and explain that.thanks in advance......
Forget about the mapping table.It is completely unnecessary. If an owner can have many clients, but a client is assigned to one owner and only one, then you should create an extra field in the clients table called 'owner_id ' that will be foreign key to the owner's table. Then your query would look like:
SELECT c.* FROM clients AS c
INNER JOIN owner AS o ON o.id=c.owner_id
WHERE o.name ='foo' ;
You can change the 'WHERE' clause the way it suits you.
And btw, this is a java forum.
Similar Messages
-
Local Network Connection Problem with SQL Server 2008 R2
Hi,
I have CRM application which uses SQL server 2008. Weird thing is that I have no problems connecting from client machines to the server when using a particular router (via LAN) and when I upgrade the firmware of the same router (A common open source firmware
which is used by many also works perfect apart from mentioned problem) and restart the server, the connection cannot be established. I get Error 40.
When i downgrade the firmware and restart the server, the connection works again.
Please note that I am absolutely not touching any configuration of the server. Also the CRM software allows remote connections from public IPs which this feature works fine with both downgraded and upgraded firmwares.
As for my understanding, the routers do not block ports in LAN connections. So how can I diagnose the reason for this connection problem?Hi Leony83,
Please also help to check Windows Event Log information regarding this issue, so that we can do further investigation. In additin, here is the general steps to troubleshoot SQL Server Error 40 issue. Please see:
SQL SERVER – Fix : Error : 40 – could not open a connection to SQL server – Fix Connection Problems of SQL Server:
http://blog.sqlauthority.com/2008/08/24/sql-server-fix-error-40-could-not-open-a-connection-to-sql-server-fix-connection-problems-of-sql-server/
Hope this helps.
Regards,
Elvis Long
TechNet Community Support -
Dear All,
I am having some problem in SQL query. I am trying to get total sum of one inventory using the following query it works fine:
sum(case when mt.transaction_quantity > 0 then (mt.transaction_quantity) else 0 end) "TOT_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (abs(mt.transaction_quantity)) end) "TOT_OUT"
But when I breakup the total sum into monthly breakup it fails to return the correct some could any one help what is wrong in the following query which is returning incorrect monthly sum. Following is that query. Your help in this regard would highly be appreciated.
sum(case when mt.transaction_quantity > 0 then (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, mt.transaction_quantity, null)) else 0 end) "MONTH1_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, abs(mt.transaction_quantity), null)) end) "MONTH1_OUT"
ThanksHi,
Sorry, I don't really understand what you want.
Whenever you have a question, it helps to post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data
(4) Your best attempt so far (formatted)
(5) The full error message (if any), including line number
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
Formatted tabular output is okay for (3). Type these 6 characters
{code}
(small letters only, inside curly brackets) before and after the tabular text, to preserve spacing.
What exactly do you mean by "monthly breakup"?
If you want separate figures for each calendar month, Blushadow's suggestion (TRUNC (mt.transaction_date, 'MM')) is what you want.
If you want separate figures for the last 30 days before today, then something like what you posted ("FLOOR ((:target_date - mt.transaction_date) / 30)": the extra FLOOR doesn't help any) should work, so if you ran the query on March 17, 2009, the first "month" would be February 16 through March 17.
In a CASE statement, there's rarely any need to use DECODE. The following is equivalent to the last line of code you posted:
, SUM ( CASE
WHEN mt.transaction_quantity >= 0
THEN 0
WHEN TO_DATE ('17-MAR-2009', 'DD-MON-YYYY') - mt.transaction_date
BETWEEN 0
AND 29.99999 -- 30 days minus a fraction of a second
THEN ABS (mt.transaction_quantity)
END
) AS month1_outDon't you find this easier to understand (and debug)? -
Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?
hi All:
I have a problem in SQL with CURSOR.
The data is as the attachments.
Here is the SQL statement as follow:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
IGLITM
1KV90CPG2
1KV90CPG2
1KV90CPG2
But, after I add one statement in the subquery, there is no record returned from CURSOR.
Here is the SQL statement:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST=B.IGCOST
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
no rows selected
Why the CURSOR did not work?
The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
F3102 DATA:
IGDOCO IGDCTO IGLITM IGCOST
10004 WO 1KV90CPG2 A1
10004 WO 1KV90CPG2 B1
10004 WO 1KV90CPG2 C3
10004 WO 1KV90CPG2 D1
F4801 DATA:
WADCTO WADOCO
WO 10004
Edited by: user2319139 on 2010/3/2 上午 1:17
Edited by: user2319139 on 2010/3/2 上午 1:20Why this structure and not a join?
The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way? -
Problem with SQL connection and a Collection
hi all,
I have two problems with sql...
1. how can I assign the values of a resultset to a collection?
2. how can I close the sql connection, because when I close the statement and connection error shows me in the resultset
thanks!Hello Pablo,
RetrivingResults In Collection:
1) use getObject method, and assign it to collection.
Collection c_obj=new ArrayList();
while(rs.next())
c_obj.add(rs.getInt(Project_ID), rs.getString(Project_Name));
Closing ResultSet
2) The close() methos of ResultSet closes the ResultSet object, like bellow
ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
rs.close(); //Closes the result set -
Problem in SQL Query Execution
Hi,
I have tried to Insert Data in Table (Using MySQL) , and as far as i know there is no error in my program and it's executing well with out showing any error and throwing exception. Database connected successfully. I have given the full code here. Help me to execute this program as soon as possible .Thanks in advance.
Code:_
public class MysqlConnect{
public static void main(String[] args) {
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "demo";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try {
Class.forName(driver);
conn= DriverManager.getConnection(url+dbName,userName,password);
try{
Statement st = conn.createStatement();
System.out.println("Connection Established");
int value = st.executeUpdate("INSERT INTO demo.login VALUES("+17+","+"'G'"+","+"'GG'"+","+70+")");
System.out.println("1 Row Inserted"+ value);
conn.close();
System.out.println("Disconnected from database");
catch(SQLException Se)
System.out.println("Exception::SQL Statement Not Executed");
} catch (Exception e) {
e.printStackTrace();
Regards,
Prabu
Edited by: [email protected] on Apr 17, 2008 11:10 AM
Edited by: [email protected] on Apr 17, 2008 11:13 AMI think there is some problem in sql statement u have written code as shown bollow
st.executeUpdate("INSERT INTO demo.login VALUES("17",""'G'"",""'GG'"","70")");
i think the proper statement is as shown bellow
st.executeUpdate("INSERT INTO demo.login VALUES('17','G','GG','70')");
(if all u have 4 columns in u r table of type varchar)
and if this is not solution for ur problem let me know the table structure , i mean columns and datatype of columns. -
Problem using SQL Loader with ODI
Hi,
I am having problems using SQL Loader with ODI. I am trying to fill an oracle table with data from a txt file. At first I had used "File to SQL" LKM, but due to the size of the source txt file (700MB), I decided to use "File to Oracle (SQLLDR)" LKM.
The error that appears in myFile.txt.log is: "SQL*Loader-101: Invalid argument for username/password"
I think that the problem could be in the definition of the data server (Physical architecutre in topology), because I have left blank Host, user and password.
Is this the problem? What host and user should I use? With "File to SQL" works fine living this blank, but takes to much time.
Thanks in advanceI tried to use your code, but I couldn´t make it work (I don´t know Jython). I think the problem could be with the use of quotes
Here is what I wrote:
import os
retVal = os.system(r'sqlldr control=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.ctl log=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.log userid=MYUSER/myPassword @ mySID')
if retVal == 1 or retVal > 2:
raise 'SQLLDR failed. Please check the for details '
And the error message is:
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 5, in ?
SQLLDR failed. Please check the for details
at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.h.y(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source) -
Problem accessing Sql server Procedure from Crystal with JDBC driver
I have some Crystal reports using SQL Server procedures, most of them are working very well; however, I have 2 that have problems accessing sql server procedures. These reports are working using OLE DB connection without problem, but when I try to relocate the connection to JDBC Crystal generates an error like that the procedure not return records.
The procedure is working with other products including OLE DB connections from crystal.
What can I do?
Thanks in Advance,
JaimeCI am using:
Crystal report 11 - 11.0.0.1282 and Crystal 2008 = 12.0.0.683
SQL Server 2005 - Microsoft SQL Server Management Studio Express 9.00.4035.00
Windows XP
I have discovered that the procedures create and work temporary tables. In other cases when is working ok, the procedures have not working temporary tables.
Thanks,
Jaime Carrillo -
Problem connecting sql developer with a remote database MAc OSX Snow Leopar
Hi everyone, sorry for my poor english but i don 't speak this language.
I'm trying to connect Sql develper to a remote database and it does not work, showing this error: The Network Adapter could not establish the connection.
Before running sql developer i install the oracle instant client and sql plus, i use the same tnsnames.ora file as my windows machine and sqlplus (in snow leopard) connect perfect.
i set the path of my tnsnames in the setup of sql developer but i can't do it work.
Anyone can help me please? thanks a lot.Duplicate thread Problem running Sql developer in Mac OSX Snow Leopard.
-
Re: Problem in SQL Query
Hi Billy,
Thanks for ur reply. It was very helpful. I do have a small problem i want to reterieve a column called doc_class_description from a table called class which also contains the doc_class_code. To be more clear
tablename: Class
the fields are:
Name Null? Type
DOC_CLASS_CODE NOT NULL NUMBER(10)
DOC_CLASS_DESCRIPTION VARCHAR2(1000)
I want to reterieve this column DOC_CLASS_DESCRIPTION along with the columns in subclass table in the same format as asked yesterday.
for ur reference:
fields in subclass table are:
Name Null? Type
DOC_CLASS_CODE NUMBER(10)
DOC_SUBCLASS_CODE NOT NULL NUMBER(10)
DOC_SUBCLASS_DESCRIPTION VARCHAR2(1000)
My output should look like:
DOC_CLASS_CODE DOC_CLASS_DESCRIPTION DOC_SUBCLASS_CODE DOC_SUBCLASS_DESCRIPTION
12 ABC 1 XYZ
2 DFG
Can the same query given yesterday be modifiedDuplicate thread
Re: Problem with SQL query -
TROUBLE SHOOTING PROBLEM ON SQL*NET, NET8.X, AND NET SERVICES
제품 : SQL*NET
작성날짜 : 2002-11-24
TROUBLE SHOOTING PROBLEM ON SQL*NET, NET8.X, AND NET SERVICES
(GENERATING TRACE FILE OF SQL*NET, NET8.X, AND NET SERVICES)
==========================================================
PURPOSE
이 글은 고객들이 Oracle Server의 Oracle Networking 제품들을 사용하다가
Networking과 관련된 문제를 만났으나 스스로 해결할 수 없는 경우, 예를
들어 http://metalink.oracle.com 에서 같은 case를 발견할 수 없는 경우,
원인을 찾기 위하여 Networking 제품의 trace를 떠 보는 방법을 설명합니다.
Explanation
Oracle Networking 제품을 사용 중에 어떠한 문제를 겪는 경우 무엇보다도
OS의 Networking Protocol Stack 쪽을 살펴보는 것이 선행되어야 합니다.
일부 고객분들은 Oracle Networking 제품들이 OS의 Protocol Stack이 동작
하는데 어떤 중대한 영향을 주는 것이 아닌가 하고 문의를 합니다만
그러한 의문은 Oracle Networking 제품도 OS의 Protocol Stack을 사용하는
하나의 network client라는 것을 이해함으로써 해소가 됩니다.
Oracle Networking 제품도 OS의 Protocol Stack을 이용하는 하나의 network
client이기 때문에 Oracle Networking 제품이 OS Protocol Stack의 동작에
어떠한 식으로든 영향을 준다던가 하는 것은 있을 수 없기 때문입니다.
고객의 관점에서 OS의 Protocol Stack은 정상적으로 설정이 되었다고 믿고
있으며 기타 networking 환경을 정확히 판단할 수 없는, 예를 들어
host설정은 잘 되어 있다고 믿고 있으나 firewall을 통해야만 하는 등의
다소 접근하기 어려운 networking 환경에서 networking이 잘 되지 않는,
예를 들어, Oracle Server에 연결이 잘 안되거나 연결 중 networking
error가 발생하는 경우에는 http://metalink.oracle.com에서 같은 case를
찾는 것이 가장 빠른 해결 방법입니다.
그러나 드물게 http://metalink.oracle.com에서 같은 case가 나오지 않는
경우 Oracle Networking 제품의 trace file을 떠서 원인을 찾게 됩니다.
Oracle Networking 제품은 Oracle 7.x에서 SQL*Net, Oracle 8.x에서 Net 8.x,
Oracle 9.x에서 Oracle Net Services라는 이름이 가지고 있으나 여기에서는
편의상 모두 Oracle Networking 제품으로 부르도록 하겠습니다.
아울러 여기서 언급하는 Trace File은 Oracle Server의 Trace File과
다른 것입니다. Oracle Server의 Trace File은 database instance의 대한
내용만을 기록하며 Oracle Networking 제품의 Trace File은 networking에
대한 내용만을 기록합니다.
Trace File의 작성 방법은 Oracle 7.x부터 9.x까지 같습니다.
Solution Description
1. Client가 되는 host에서 어떠한 문제를 경험한 경우, 간혹 문제의 발생
빈도가 낮거나 network나 server 쪽에 이상을 느끼시면서도 문제를 확인하기
여러운 경우가 있습니다. 이런 경우엔는 문제가 다시 발생될 때 까지
Client에서 Client Trace File를 작성하여 보아야 합니다.
a. prompt$ echo $TNS_ADMIN
b. $TNS_ADMIN이 설정되어 있으면, prompt$ cd $TNS_ADMIN
아니면, prompt$ cd $ORACLE_HOME/network/admin
c. vi sqlnet.ora
# 다음 line들을 추가
TRACE_LEVEL_client=16
TRACE_FILE_client=<filename>
TRACE_DIRECTORY_client=<directory>
TRACE_UNIQUE_client=TRUE
:wq
prompt$
예를 들어, client가 Windows OS인 경우 다음과 같이 합니다.
prompt> notepad sqlnet.ora
TRACE_LEVEL_client=16
TRACE_FILE_client=client
TRACE_DIRECTORY_client=D:\temp
TRACE_UNIQUE_client=TRUE
prompt>
d. SQL*Plus와 같은, 또는 사용하던 Client software를 계속 이용
e. 다시 문제가 발생
f. 작성된 trace file들의 날자를 보아 문제가 발생한 시간과
거의 같은 시간에 작성된 file들이 있는지 확인
prompt> dir D:\temp
client_<PID1>.trc ...
client_<PID2>.trc ...
prompt>
g. trace를 중단합니다.
prompt$ vi sqlnet.ora
TRACE_LEVEL_client=0
:wq
prompt$
h. Trace Assistant를 이용하여 Oracle Networking 제품의 error code
(이하 TNS error code)를 trace file에서 찾아냅니다.
prompt$ cd <directory of TRACE_DIRECTORY_client>
prompt$ trcasst <filename of TRACE_FILE_client>_<PID>.trc > trcasst.out
prompt$ vi -R trcasst.out
Trace Assistant (trcasst command)는 Oracle 8.x부터 제공되며,
Oracle 9.x의 Trace Assistant를 사용할 것을 권합니다.
i. oerr command로 tns error에 대한 error message를 봅니다.
예를 들어, 흔한 경우 중에 listener가 실행 중이지 않거나 잘못된
tnsnames.ora 설정으로 client가 listener가 service 중이지 않은
network address로 연결을 시도하다가 TNS-12541 TNS-12560 TNS-511
error가 차례대로 나왔다면 다음과 같이 하여 각 TNS error code에
대한 message와 설명 및 해결방법을 볼 수 있습니다.
prompt$ oerr tns 12541
prompt$ oerr tns 12560
prompt$ oerr tns 511
j. Trace Assistant가 알려준 TNS error code를 http://metalink.oracle.com
에서 검색하여 같은 case가 있는지 확인합니다.
Web browser에서:
1) Go to http://metalink.oracle.com, then login
오른쪽 위 HTML frame에서 :
2) "Advanced" Button을 누릅니다.
오른쪽 아래 HTML frame에서:
3) "Enter Keyword" text box에 tns error code를 모두 입력합니다.
예를 들어, tns-12541 tns-12560 tns-511
4) "Search" button을 누릅니다.
k. http://metalink.oracle.com에서 검색이 거의 되지 않거나
문제가 매우 이상한 경우 이 글 아래를 보시기 바랍니다.
2. Client에서 SQL*Plus나 Oracle Client를 사용하는 다른 3rd party
appliction은 잘 동작하나 유독 tnsping command에서 error가 나는 경우가
드물게 있습니다. 이 때에는 tnsping command의 trace file을 작성해봅니다.
prompt$ vi sqlnet.ora
TNSPING_TRACE_LEVEL=16
TNSPING_TRACE_DIRECTORY=<directory>
:wq
prompt$ tnsping <tns alias>
3. Server, 즉 listener에 문제가 있다고 생각되는 경우 우선 listener의
log file을 봅니다. listener의 log에 대해서는 bulletin.18364를
이용합니다.
4. listener의 trace file은 다음과 같이 설정합니다.
listener의 trace 설정은 parameter 이름에 trace file을 작성하고자 하는
listener의 이름이 오는 점, 설정 후 listener process를 restart해야 하는
점 두 가지를 제외하면 나머지 절차가 앞서 설명드린 client와 같습니다.
prompt$ vi listener.ora
TRACE_LEVEL_<listener name>=16
TRACE_FILE_<listener name>=<filename>
TRACE_DIRECTORY_<listener name>=<directory>
:wq
prompt$ lsnrctl stop <listener name>
prompt$ lsnrctl start <listener name>
5. 만일 위와 같이 http://metalink.oracle.com을 검색하여도
같은 case가 전혀 없거나 찾아낸 error message들이 원인과 관련이 없어
보일정도로 매우 이상한 경우 다음과 같이 해봅니다.
a. Oracle Software의 version과 OS의 version이 certification matrix에
있는 지 확인합니다.
Web browser에서:
1) Go to http://metalink.oracle.com, then login
왼쪽 menu에서 :
2) "Certify & Availabilty" menu item을 click합니다.
오른쪽 아래 HTML frame에서:
3) 현재 사용중인 Product와 그 version 및 OS와 그 version을 선택하
여 검색합니다.
Certification Matrix는 매우 정확하게 정보를 보여주고 있습니다.
Matrix에 없는 Oracle Product와 OS version은 certify되어 있지 않으며
모든 Oracle 제품을 Certify되지 않은 OS version에서 사용하는 것은
그 어떠한 이유로든 보증과 지원이 되지 않습니다.
만일 사용중인 제품이 certify되지 않은 경우, 무조건 certify된 제품
과 OS의 version으로 install하여 다시 시도를 해야 합니다.
예를 들어, Windows OS의 경우 그 어떠한 Oracle 제품도 Windows Me 및
Windows XP Home Edition에 certify되어 있지 않습니다.
Windows 2000 Professional 이상에 Certify된 제품은 Oracle 8.1.6부터
이며 XP Professional 이상에 Certify된 제품은 Oracle 9.0.1부터
입니다.
Oracle 제품은 software이기는 하나 매우 완벽한 수준의 제품이라고 할
수 있습니다. 그러나 Oracle 제품은 하나의 OS의 process로써 실행이
되고 시간이 지나며 많은 환경이 major upgrade가 되면서 그러한 환경
에 따라 Oracle software도 새로운 version으로 제작이 되면서 다시
certification이 이루어지게 됩니다.
그렇기 때문에 고객들은 특히 다수의 client나 고가의 server를 계획하
시는 고객들은 저희 certification matrix를 사전에 철저히 확인하셔야
합니다.
앞서 Certification Matrix이전에 Installation Guide에 명시된
OS version만이 certify되어 있다고 생각하시면 되겠습니다.
b. Unix에서는 Oracle Software를 install한 후 OS의 Networking patch를
씌우고 사용하다보면 문제가 되는 경우가 있습니다.
이런 경우 relink를 해주어 바뀐 OS환경에서 Oracle 실행 file들을 다
시 만들어 주어야 합니다.
자세한 내용은 http://metalink.oracle.com에서
다음 글을 읽어 보시기 바랍니다.
Note:131321.1 How to Relink Oracle Database Software on UNIX
c. Certify된 환경에서도 원인을 찾을 수 없는 경우 trace file을 가지고
Oracle Support Services에 문의를 합니다. (지원 계약 고객에 한함)
Reference Documents
Chapter 17 Trouble shooting Oracle Net Services
Oracle 9i Net Services Administrator's Guide
SQL*Net, Net8.x, Net Services 9.x Network Administration Guide/Reference제품 : SQL*NET
작성날짜 : 2002-11-24
TROUBLE SHOOTING PROBLEM ON SQL*NET, NET8.X, AND NET SERVICES
(GENERATING TRACE FILE OF SQL*NET, NET8.X, AND NET SERVICES)
==========================================================
PURPOSE
이 글은 고객들이 Oracle Server의 Oracle Networking 제품들을 사용하다가
Networking과 관련된 문제를 만났으나 스스로 해결할 수 없는 경우, 예를
들어 http://metalink.oracle.com 에서 같은 case를 발견할 수 없는 경우,
원인을 찾기 위하여 Networking 제품의 trace를 떠 보는 방법을 설명합니다.
Explanation
Oracle Networking 제품을 사용 중에 어떠한 문제를 겪는 경우 무엇보다도
OS의 Networking Protocol Stack 쪽을 살펴보는 것이 선행되어야 합니다.
일부 고객분들은 Oracle Networking 제품들이 OS의 Protocol Stack이 동작
하는데 어떤 중대한 영향을 주는 것이 아닌가 하고 문의를 합니다만
그러한 의문은 Oracle Networking 제품도 OS의 Protocol Stack을 사용하는
하나의 network client라는 것을 이해함으로써 해소가 됩니다.
Oracle Networking 제품도 OS의 Protocol Stack을 이용하는 하나의 network
client이기 때문에 Oracle Networking 제품이 OS Protocol Stack의 동작에
어떠한 식으로든 영향을 준다던가 하는 것은 있을 수 없기 때문입니다.
고객의 관점에서 OS의 Protocol Stack은 정상적으로 설정이 되었다고 믿고
있으며 기타 networking 환경을 정확히 판단할 수 없는, 예를 들어
host설정은 잘 되어 있다고 믿고 있으나 firewall을 통해야만 하는 등의
다소 접근하기 어려운 networking 환경에서 networking이 잘 되지 않는,
예를 들어, Oracle Server에 연결이 잘 안되거나 연결 중 networking
error가 발생하는 경우에는 http://metalink.oracle.com에서 같은 case를
찾는 것이 가장 빠른 해결 방법입니다.
그러나 드물게 http://metalink.oracle.com에서 같은 case가 나오지 않는
경우 Oracle Networking 제품의 trace file을 떠서 원인을 찾게 됩니다.
Oracle Networking 제품은 Oracle 7.x에서 SQL*Net, Oracle 8.x에서 Net 8.x,
Oracle 9.x에서 Oracle Net Services라는 이름이 가지고 있으나 여기에서는
편의상 모두 Oracle Networking 제품으로 부르도록 하겠습니다.
아울러 여기서 언급하는 Trace File은 Oracle Server의 Trace File과
다른 것입니다. Oracle Server의 Trace File은 database instance의 대한
내용만을 기록하며 Oracle Networking 제품의 Trace File은 networking에
대한 내용만을 기록합니다.
Trace File의 작성 방법은 Oracle 7.x부터 9.x까지 같습니다.
Solution Description
1. Client가 되는 host에서 어떠한 문제를 경험한 경우, 간혹 문제의 발생
빈도가 낮거나 network나 server 쪽에 이상을 느끼시면서도 문제를 확인하기
여러운 경우가 있습니다. 이런 경우엔는 문제가 다시 발생될 때 까지
Client에서 Client Trace File를 작성하여 보아야 합니다.
a. prompt$ echo $TNS_ADMIN
b. $TNS_ADMIN이 설정되어 있으면, prompt$ cd $TNS_ADMIN
아니면, prompt$ cd $ORACLE_HOME/network/admin
c. vi sqlnet.ora
# 다음 line들을 추가
TRACE_LEVEL_client=16
TRACE_FILE_client=<filename>
TRACE_DIRECTORY_client=<directory>
TRACE_UNIQUE_client=TRUE
:wq
prompt$
예를 들어, client가 Windows OS인 경우 다음과 같이 합니다.
prompt> notepad sqlnet.ora
TRACE_LEVEL_client=16
TRACE_FILE_client=client
TRACE_DIRECTORY_client=D:\temp
TRACE_UNIQUE_client=TRUE
prompt>
d. SQL*Plus와 같은, 또는 사용하던 Client software를 계속 이용
e. 다시 문제가 발생
f. 작성된 trace file들의 날자를 보아 문제가 발생한 시간과
거의 같은 시간에 작성된 file들이 있는지 확인
prompt> dir D:\temp
client_<PID1>.trc ...
client_<PID2>.trc ...
prompt>
g. trace를 중단합니다.
prompt$ vi sqlnet.ora
TRACE_LEVEL_client=0
:wq
prompt$
h. Trace Assistant를 이용하여 Oracle Networking 제품의 error code
(이하 TNS error code)를 trace file에서 찾아냅니다.
prompt$ cd <directory of TRACE_DIRECTORY_client>
prompt$ trcasst <filename of TRACE_FILE_client>_<PID>.trc > trcasst.out
prompt$ vi -R trcasst.out
Trace Assistant (trcasst command)는 Oracle 8.x부터 제공되며,
Oracle 9.x의 Trace Assistant를 사용할 것을 권합니다.
i. oerr command로 tns error에 대한 error message를 봅니다.
예를 들어, 흔한 경우 중에 listener가 실행 중이지 않거나 잘못된
tnsnames.ora 설정으로 client가 listener가 service 중이지 않은
network address로 연결을 시도하다가 TNS-12541 TNS-12560 TNS-511
error가 차례대로 나왔다면 다음과 같이 하여 각 TNS error code에
대한 message와 설명 및 해결방법을 볼 수 있습니다.
prompt$ oerr tns 12541
prompt$ oerr tns 12560
prompt$ oerr tns 511
j. Trace Assistant가 알려준 TNS error code를 http://metalink.oracle.com
에서 검색하여 같은 case가 있는지 확인합니다.
Web browser에서:
1) Go to http://metalink.oracle.com, then login
오른쪽 위 HTML frame에서 :
2) "Advanced" Button을 누릅니다.
오른쪽 아래 HTML frame에서:
3) "Enter Keyword" text box에 tns error code를 모두 입력합니다.
예를 들어, tns-12541 tns-12560 tns-511
4) "Search" button을 누릅니다.
k. http://metalink.oracle.com에서 검색이 거의 되지 않거나
문제가 매우 이상한 경우 이 글 아래를 보시기 바랍니다.
2. Client에서 SQL*Plus나 Oracle Client를 사용하는 다른 3rd party
appliction은 잘 동작하나 유독 tnsping command에서 error가 나는 경우가
드물게 있습니다. 이 때에는 tnsping command의 trace file을 작성해봅니다.
prompt$ vi sqlnet.ora
TNSPING_TRACE_LEVEL=16
TNSPING_TRACE_DIRECTORY=<directory>
:wq
prompt$ tnsping <tns alias>
3. Server, 즉 listener에 문제가 있다고 생각되는 경우 우선 listener의
log file을 봅니다. listener의 log에 대해서는 bulletin.18364를
이용합니다.
4. listener의 trace file은 다음과 같이 설정합니다.
listener의 trace 설정은 parameter 이름에 trace file을 작성하고자 하는
listener의 이름이 오는 점, 설정 후 listener process를 restart해야 하는
점 두 가지를 제외하면 나머지 절차가 앞서 설명드린 client와 같습니다.
prompt$ vi listener.ora
TRACE_LEVEL_<listener name>=16
TRACE_FILE_<listener name>=<filename>
TRACE_DIRECTORY_<listener name>=<directory>
:wq
prompt$ lsnrctl stop <listener name>
prompt$ lsnrctl start <listener name>
5. 만일 위와 같이 http://metalink.oracle.com을 검색하여도
같은 case가 전혀 없거나 찾아낸 error message들이 원인과 관련이 없어
보일정도로 매우 이상한 경우 다음과 같이 해봅니다.
a. Oracle Software의 version과 OS의 version이 certification matrix에
있는 지 확인합니다.
Web browser에서:
1) Go to http://metalink.oracle.com, then login
왼쪽 menu에서 :
2) "Certify & Availabilty" menu item을 click합니다.
오른쪽 아래 HTML frame에서:
3) 현재 사용중인 Product와 그 version 및 OS와 그 version을 선택하
여 검색합니다.
Certification Matrix는 매우 정확하게 정보를 보여주고 있습니다.
Matrix에 없는 Oracle Product와 OS version은 certify되어 있지 않으며
모든 Oracle 제품을 Certify되지 않은 OS version에서 사용하는 것은
그 어떠한 이유로든 보증과 지원이 되지 않습니다.
만일 사용중인 제품이 certify되지 않은 경우, 무조건 certify된 제품
과 OS의 version으로 install하여 다시 시도를 해야 합니다.
예를 들어, Windows OS의 경우 그 어떠한 Oracle 제품도 Windows Me 및
Windows XP Home Edition에 certify되어 있지 않습니다.
Windows 2000 Professional 이상에 Certify된 제품은 Oracle 8.1.6부터
이며 XP Professional 이상에 Certify된 제품은 Oracle 9.0.1부터
입니다.
Oracle 제품은 software이기는 하나 매우 완벽한 수준의 제품이라고 할
수 있습니다. 그러나 Oracle 제품은 하나의 OS의 process로써 실행이
되고 시간이 지나며 많은 환경이 major upgrade가 되면서 그러한 환경
에 따라 Oracle software도 새로운 version으로 제작이 되면서 다시
certification이 이루어지게 됩니다.
그렇기 때문에 고객들은 특히 다수의 client나 고가의 server를 계획하
시는 고객들은 저희 certification matrix를 사전에 철저히 확인하셔야
합니다.
앞서 Certification Matrix이전에 Installation Guide에 명시된
OS version만이 certify되어 있다고 생각하시면 되겠습니다.
b. Unix에서는 Oracle Software를 install한 후 OS의 Networking patch를
씌우고 사용하다보면 문제가 되는 경우가 있습니다.
이런 경우 relink를 해주어 바뀐 OS환경에서 Oracle 실행 file들을 다
시 만들어 주어야 합니다.
자세한 내용은 http://metalink.oracle.com에서
다음 글을 읽어 보시기 바랍니다.
Note:131321.1 How to Relink Oracle Database Software on UNIX
c. Certify된 환경에서도 원인을 찾을 수 없는 경우 trace file을 가지고
Oracle Support Services에 문의를 합니다. (지원 계약 고객에 한함)
Reference Documents
Chapter 17 Trouble shooting Oracle Net Services
Oracle 9i Net Services Administrator's Guide
SQL*Net, Net8.x, Net Services 9.x Network Administration Guide/Reference -
Query update on each iteration problem (MS SQL Sever / ODBC / Native Driver
Hello,
I�ve been working to learn some Java and now JDBC over the past 10 or so months.
I think I have a general understanding of how to perform queries and work with data using JDBC. However, I�ve run into a problem. I�m trying to do a query of a set of data in a database based on the value of a status column. I want to loop over the messages and perform various functions with the data then update their status in the database. It�s preferable to do these 250 to 1000 rows at a time, but no more and no less.
I�m connecting to MS SQL Server 2000, currently with ODBC. I�ve also tried it with the Java SQL Server 2000 drivers provided by Microsoft with the same results.
I�ve found that I can do a one table query and loop though it with a while (rs.next()) {�} and run an Update statement with executeUpdate on each iteration without any problems, no matter the number of rows returned in query.
I have not been able to use the updateString and updateRow inside the while loop. I keep getting errors like this at the line with the updateRow():
Exception in thread "main" java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Row update failed.
This occurs no mater how many rows I select, 1 or more.
The real problem I�ve been having is that the query I need to loop though joins across several tables and returns some rows from some of those tables. This only seems to work when I query for 38 or less selected rows and I use an Update statement with executeUpdate on each iteration. The updateString and updateRow methods never work. Any number of rows selected greater than 38 causes a deadlock where the Update is waiting for the select to compete on the server and the Update can�t proceed until the Select is complete.
As I stated above I�ve tried both ODBC and the native SQL Server driver with the same results. I have not tried any other databases, but that�s moot as my data is already in MS SQL.
Questions:
How can I avoid or get around this 38 row limit without selecting each row, one at a time?
What am I doing wrong with the updateString and updateRow?
Is there a better approach that anyone can suggest?
Here�s some sample code with the problem:
import java.sql.*;
public class db1{
public static void main(String[] args) throws Exception{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:eBrochure_live";
Connection con = DriverManager.getConnection(url, "sa", "d3v3l0p");
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://dcm613u2\\dcm613u2_dev:1433", "sa", "d3v3l0p");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
Statement stmt2 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
stmt.executeUpdate("USE [myDatabase]");
stmt2.executeUpdate("USE [myDatabase]");
String qGetMessages = "SELECT TOP 250 t1.messageUUID, t1.subjectHeader, t2.emailAddress as toAddress " +
"FROM APP_Messages as t1 JOIN APP_addressBook_contacts as t2 " +
" On t1.toContactID = t2.contactID " +
"WHERE t1.statusID = 'queued'";
ResultSet rs = stmt.executeQuery(qGetMessages);
while (rs.next()) {
String messageUUID = rs.getString("messageUUID");
String subjectHeader = rs.getString("subjectHeader");
System.out.println(messageUUID + " " + subjectHeader);
String updateString = "UPDATE APP_Messages " +
"SET statusID = 'sent' " +
"WHERE messageUUID = '" + messageUUID + "' ";
stmt2.executeUpdate(updateString);
con.close();
Thanks for the help,
Doug Hughes// sorry, ps.close() should be outside of if condition
String sql = "UPDATE APP_Messages SET statusID = 'sent' WHERE messageUUID = ?";
Statement statement = con.createStatement();
PreparedStatement ps = con.prepareStatement(sql);
ResultSet rs = statement.executeQuery("your select SQL");
if ( rs.next() )
ps.clearParameters();
ps.setString(1, rs.getString("your column name"));
ps.executeUpdate();
ps.close();
rs.close();
statement.close(); -
Problem with SQL query region source containing OLAP clauses
Hi team,
I believe I found a bug when HTMLDB validates the SQL Query in a report region.
My query includes an ORDER BY clause within a windowing function and HTMLDB refuses to accept the source owing to the presence of the ORDER BY and the column heading sort preference.
Clearly the order-by in a window function has little to do with the column heading sort, but this error prevents me from updating the conditional display item in the page definition.
Note also that the page was imported smoothly from the 1.5 version, so probably the region source is not checked at that time, but only when you update it "manually".
So, in the end, if I don't change anything the page works because the sql query is assumed to be correct but unfortunately I need to change the condition and I cannot.
The problem shows up in page 126 of app 21670, SQL query region.
Bye,
Flavio
PS: may be I can work around this by using the pl/sql function returning the sql query.Flavio,
We're aware of this problem. For now, your workaround is described in this thread:
HTMLDB 1.6 and "order by" in analytic functions
Sergio -
Hi
I am using Flex to insert data through remoteobject and using
SAVE method generated from CFC Wizard.
My VO contains the following variables where id has a default
value of 0 :
public var id:Number = 0 ;
public var date:String = "";
public var accountno:String = "";
public var debit:Number = 0;
public var credit:Number = 0;
id is set as the primary key in my database.
I have previously used MySQL which automatically generates a
new id if I either omitted the id value in my insert statement or
use 0 as the default value.
However, now I am using MS SQL Server and the insert
generated this error:
Unable to invoke CFC - Error Executing Database Query.
Detail:
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert
explicit value for identity column in table 'Transactions' when
IDENTITY_INSERT is set to OFF.
Strange thing is that I dont see this problem with another
sample application. I compared with that application (it has the
same VO with default value of 0 for id) and everything looks
similar so I can't understand why I have this error in my
application.
This is SQL used to create the table:
USE [Transactions]
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
CREATE TABLE [dbo].[Transactions](
[id] [int] IDENTITY(1,1) NOT NULL,
[date] [datetime] NULL,
[accountno] [varchar](100) NULL,
[debit] [int] NULL,
[credit] [int] NULL,
CONSTRAINT [PK_Transactions] PRIMARY KEY CLUSTERED
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE =
OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Has anyone encountered this problem before with insert
statements dealing with a unique id (with MS SQL Server)?Change "addRecords =
connection.prepareStatement("
to "addRecords =
connection.preparedStatement("
-BIGD -
Problem with SQL Server data on webpage
Hello, we recently 'upsized' from Access to MS SQL Server
2005.
I'm trying to port over my webpages but have run into a very
bizarr
behavior, some data from some fields in my table appear on my
web pages and
some do not. In fact, depending on where I place some of
these fields on the
page can determine whether the data fields show up or not.
For example, I'll place a field
<%=(Recordset1.Fields.Item("Tastings").Value)%> above
the phone field
<%=(Recordset1.Fields.Item("Phone").Value)%> and the
phone field disappears,
i.e. the phone number was displaying on the page and after I
place the
Tasting field above it the phone number no longer displays on
the page.
Many of the fields on the webpage are just blank even though
I know the code
is right and I know there is data in that db record. I also
know the pages
work without a problem since if I use a connection string to
the Access db
(which is linked to the SQL db!) everything works perfectly.
I don't know if this matters, but the table has about 95
fields in it many
of which are 'True' 'False'. There are only about 400 records
though.
I'm stumped, so any ideas would be greatly appreciated.
-JoeHey Lionstone, you're the best!
That fixed my problem and I would have never figured that
out.
If you're ever in the Napa Valley give me a ring, I have a
couple bottles of
Napa's finest for you.
-Joe
707-968-4205
"Lionstone" <[email protected]> wrote in
message
news:[email protected]...
> You've used columns with the data type of "text." This
is not the right
> data type for you.
> In SQL Server 2005, you should use strictly VARCHAR
columns to hold text.
> Anything up to 8000 bytes of text (8000 characters using
standard ANSI
> encoding) should use VARCHAR(X), where X is a reasonable
maximum length;
> for instance, VARCHAR(50) is a reasonable length for a
title. "Text" is
> actually intended for very large amounts of information
(say, a research
> paper or long news article), but in SQL Server 2005, you
should use
> VARCHAR(MAX) instead (and I literally mean MAX, not a
numeric value).
>
> Shorter version of everything I said: Use VARCHAR([some
number]) up to
> 8000 characters and VARCHAR(MAX) for more than 8000
characters. Text is
> kept for mainly for backward compatibility.
>
> There are several things you can do in the interim. The
best would be to
> put all "text", "ntext", and "image" columns at the end
of your select
> list (you shouldn't be using SELECT * in production code
anyway) and, if
> you have more than one, list them in the order they're
defined in your
> table.
>
> Solutions that involve changing the cursor type or
location have a
> performance penalty, and they aren't even possible using
the DW 8.02-style
> recordsets.
>
>
> "Joe" <[email protected]> wrote
in message
> news:[email protected]...
>> Hello, we recently 'upsized' from Access to MS SQL
Server 2005.
>>
>> I'm trying to port over my webpages but have run
into a very bizarr
>> behavior, some data from some fields in my table
appear on my web pages
>> and some do not. In fact, depending on where I place
some of these fields
>> on the page can determine whether the data fields
show up or not.
>>
>> For example, I'll place a field
>>
<%=(Recordset1.Fields.Item("Tastings").Value)%> above the
phone field
>> <%=(Recordset1.Fields.Item("Phone").Value)%>
and the phone field
>> disappears, i.e. the phone number was displaying on
the page and after I
>> place the Tasting field above it the phone number no
longer displays on
>> the page.
>>
>> ???
>>
>> Many of the fields on the webpage are just blank
even though I know the
>> code is right and I know there is data in that db
record. I also know the
>> pages work without a problem since if I use a
connection string to the
>> Access db (which is linked to the SQL db!)
everything works perfectly.
>>
>> I don't know if this matters, but the table has
about 95 fields in it
>> many of which are 'True' 'False'. There are only
about 400 records
>> though.
>>
>> I'm stumped, so any ideas would be greatly
appreciated.
>>
>> -Joe
>>
>
> -
Problem running SQL PLUS in Oracle 8i and 9i on Windows XP
I've tried installing both Oracle 8.17 Personal Edition and also 9i in Windows XP Professional (each on a different occassion). I have run into the same problem each time. The installation itself goes fine in both cases, but when I run SQL PLUS, the Log On screen appears for 1-2 seconds then whole thing just closes automatically, so I can't ever access that application which is the only thing I need to work with. Any ideas on what's going wrong? Thanks.
Patrick,
Well a few things. Did you try TNSPING to see if the listener is up? If it's ok, can you connect with FREE toad? Download Oracle OEM and install that (the SQL net and sql plus portions). If you can't get tnsping to work, sqlplus isn't going too either. I don't know why the sqplus is actually shutting down, but I'm guessing the TNS NAMES entry isnt there (in the tnsnames.ora file). If the tnsnames entry is there then tnsping should work. Get tnsping to work first.
Tyler.
Maybe you are looking for
-
DVD Studio Pro won't accept my H.264 QT asset
Hi, I want to import my HDV 1080i FCP project into DVD Studio Pro v.4.2.1 to create a SD Disc. I exported the FCP project in Compressor using H.264 10.3mbps in the HD DVD: H.264 60 minutes folder. I was able to import the audio asset but not the vide
-
Creative zen not detected and freeze at creative l
I got firmware problem and tried to reload firmware.when i was doing it, my zen vision got freeze at creative logo and now i can't excess anything. i can't see that recovery option,firmware update option, format option too...and my mp3 player is not
-
In CS6, why the file size remains same after croping? And how do I reduce the size after each croping? Thx
-
Window Handle getHWND() for jdk 5.0
Does the following getHWND() method works for jdk 5.0? public int getHWND () { DrawingSurfaceInfo drawingSurfaceInfo; Win32DrawingSurface win32DrawingSurface; int hwnd = 0; drawingSurfaceInfo = ((DrawingSurface)(getPeer())).getDra
-
Content generation error. [Error: exportArticleFolio]
Hi guys! I'm getting the error "Content generation error. [Error: exportArticleFolio]" when trying to update an article (yesterday it was successfully uploaded and updated). The same issue when try to upload it as a new article. No errors are display