Oracle 10.2.0.4 vs 10.2.0.5 SQL optimizer
Hello,
Recently we upgraded from Oracle 10.2.0.4 to 10.2.0.5 deployed on AIX 5. Immediately we could see slowness for a particular SQL which used partition as well as indexed column in predicate clause.
e.g.
SELECT COL1, COL2
FROM TAB1 PARTITION (P1)
WHERE TAB1.COL3 = 123;
There is an index created on COL3. However explain plan for this SQL showed that this index was not getting used. Surprisingly, when we removed partition from SQL, itused the index
SELECT COL1, COL2
FROM TAB1
WHERE TAB1.COL3 = 123;
There is one more observation - When we reverted back to 10.2.0.4 optimization strategy on Oracle 10.2.0.5. The original SQL that had partition clause used the index as it should have been and explain plan matched to what was before the Oracle upgrade.
I have few questions based on these observations. Any help will be appreciated.
1. Are there any changes in the 10.2.0.5 optimizer that is making SQL becoming slow?
2. Is there any problem in SQL that is making it slow?
3. I believe moving to 10.2.0.4 optmizer on Oracle 10.2.0.5 is a short-term solution. Is there any permanent fix to this problem?
4. Does Oracle 11g support 10.2.0.4 optimizer?
Please let me know if more details are needed.
Thank you!
Onkar Talekar wrote:
1. Are there any changes in the 10.2.0.5 optimizer that is making SQL becoming slow?There are always changes with the CBO happening, it's a complicated bit of software. Some bugs will be fixed, others introduced. You may have been unfortunate enough to hit a bug, search MOS or raise a SR with Oracle support if you feel that is the case.
Onkar Talekar wrote:
2. Is there any problem in SQL that is making it slow?Entirely possible you have a poorly written SQL statement, yes.
Onkar Talekar wrote:
3. I believe moving to 10.2.0.4 optmizer on Oracle 10.2.0.5 is a short-term solution. Is there any permanent fix to this problem?Yes, raise a SR with Oracle.
Onkar Talekar wrote:
4. Does Oracle 11g support 10.2.0.4 optimizer?Yes, but i wouldn't recommend running an 11 instance with optimizer compatibility set to less than the current version without a very compelling reason (the one you've posted doesn't seem to be compelling to me at the moment).
What happens if you specify the partition column in the WHERE clause instead of the actual partition in the FROM clause ... Oracle should use partition elimination to visit only that partition and utilize the local index on COL3 (i am assuming there is a local index in play here).
I would guess, a very speculative guess, that you hit a bug pertaining to specifying the partition name, and that if you can get Oracle to do a partition elimination on it's own (instead of 'hard coding' the partition name) that it will smarten up and you'll get the execution plan you want / expect ... just a guess.
Similar Messages
-
Oracle 10.2 on AIX -- need to connect to remote SQL server by dblink
oracle 10.2 on AIX -- need to connect to remote SQL server by dblink
i didn't see a odbc diectory in our oracle home path. how do i know odbc driver is installed in the oracle on our AIX server.
If it is there, do i just need to modify the odbc.ini and then the inithsodbc.ora, linster.ora, tnsnammes.ora files, or am I missing something
Appreciate your response
Edited by: user10876711 on May 12, 2011 9:18 AM
Edited by: user10876711 on May 12, 2011 9:18 AMwhen you want to connect from Oracle to a SQl Server you need the Oracle Gateway (HSODBC or even better Dg4ODBC) and a FOREIGN ODBC DRIVER for your foreign database - a SQL Server ODBC driver. You have to get this driver from a 3rd party vendor - Oracle does not offer any foreign ODBC drivers.
So before being able to use DG4ODBC/HSODBC you need to install from a 3rd paryt vendor a SQL Server ODBC driver. Commercial vendrs are for example Data Direct, Openlink or Easysoft.
On Unix ODBC drivers commonly also require a driver manager. If the ODBC driver vendor does not ship one with the ODBC driver you can get it from www.unixodbc.org -
So I have a chunk of data that only resides in Oracle. So I need to capture that information from Oracle. Now before you get over zealous, I did try with an OPENQUERY and it took FOREVER! And I don't know why the OPENQUERY took FOREVER but if I run the same
query directly against Oracle it runs very quickly...like 20 seconds.
So now I'm wondering...can I build a dataset in my SSRS Report that uses an Oracle Data source and an Oracle Stored Procedure in its Dataset that I'll create to aggregate this subset of data and then utilize its result set back in my main reporting
Dataset that will utilize SQL Server? And how can I do that? Can I make my main Dataset reference, say, a #TemporaryTable that is created from my Oracle Dataset in its
I'll continue to Google a few things as I await your review and hopefully a reply.
Thanks in advance for your help.Hi ITBobbyP,
According to your description you want to use data from a Oracle data source into a DataSet which retrieving data from SQL Server. Right?
In Reporting Services, we can have multiple data sources in one project pointing to different database. And we can use separated dataset to retrieve data from different data source. However, it's not supported to combine the two datasets together
directly. We can only use Lookup(), LookupSet() function to combine fields from different dataset into one tablix when there are common columns between two datasets. This is the only way to make tow result sets together in SSRS.
Reference:
Lookup Function (Report Builder and SSRS)
LookupSet Function (Report Builder and SSRS)
Best Regards,
Simon Hou
TechNet Community Support -
Issue with oracle.odi.sdk.invocation package to run scenario through PL/SQL
Hi,
I am new to call ODI scenario through PL/SQL.
Actually just to test I tried following code-
1. create or replace and compile java source named "Run_Scen_DCP"
as
import oracle.odi.sdk.invocation.*;
public class Run_Scen_DCP
public static void Run_Scen()
OdiCommandScenario cmd = new OdiCommandScenario();
Output- Warning: execution completed with warning
and compile Compiled.
2. create or replace procedure run_scen as language java name 'Run_Scen_DCP.Run_Scen()';
Output- procedure run_scen Compiled.
3. EXECUTE run_scen;
Output- Error starting at line 1 in command:
EXECUTE run_scen;
Error report:
ORA-29541: class TEST_JAVA.Run_Scen_DCP could not be resolved
ORA-06512: at "TEST_JAVA.RUN_SCEN", line 1
ORA-06512: at line 1
29541. 00000 - "class %s.%s could not be resolved"
*Cause: An attempt was made to execute a method in a Java class
that had not been previously and cannot now be compiled
or resolved successfully.
*Action: Adjust the call or make the class resolvable.
I am getting the error in calling the wrapper PL/SQL procedure.
I have set the classpath for SDK jar files C:\oracle\product\11.1.1\Oracle_ODI_1\oracledi.sdk\lib\*.jar
Please help me understand what I am doing wrong in this.
Regards,
VipinWaiting for the solution....
-
Install Oracle 11g on window 7 but unable to login to sql developer.
I have installed Oracle 11g from Oracle site but once oracle has been installed I am unable maintain connection as a New user in Sql developer.
Although while installing I have kept both the password blank but when i am login to it keeping User name and password as blank it says as Invalid username/password.
And same is the case with Sql plus it says your password has been locked but suggest any suggestive reasons for that.
Thanks and Regards
Addi
Edited by: 959982 on Sep 18, 2012 10:40 PM959982 wrote:
I have installed Oracle 11g from Oracle site but once oracle has been installed I am unable maintain connection as a New user in Sql developer.
Although while installing I have kept both the password blank but when i am login to it keeping User name and password as blank it says as Invalid username/password.Since you must log on as a user, how do you expect to log on without a username (username as blank)?
And please be aware that Oracle does NOT certify its products on any "home" edition of Windows.
And same is the case with Sql plus it says your password has been locked but suggest any suggestive reasons for that.
Thanks and Regards
Addi
Edited by: 959982 on Sep 18, 2012 10:40 PM -
How to UpLoad the Diffent type of files Through Oracle Pl/Sql...?
Hi TOM,
I want one reusable component to be developed, My requirement is as follows...
We get .CSV,.XML,.DOC.PDF files on the N/w drive. One Batch Job will be running every night and this job should upload all the files present in that N/w drive to the database (Each File should be stored in one row with unique ID) and after loading of each file is done , move the uploaded file to the backup directory.
Note : Average file size is 10-15 MB.
Loading of files in database should be done only using Oracle procedure/function.
Already return this process in Pro*C. But I don't know How to write in Oravle Pl/Sl...?
Functionality of this FUNCTION(In Pro*C):
===================================
*****set_item_blob
*****Input:
*****======
*****1. Path of the file in Windows folder which contains the part number's content
*****2. Item number in the T_ITEM table
*****3. Revision level in the T_ITEM table
*****Processing:
*****===========
*****1. Get the BLOB pointer for the ITM_BLOB column,
***** for the corresponding item number and revision level
*****2. Update the ITM_BLOB column with the content of the input file
***** ( using the EXEC SQL LOB WRITE function )
*****Output:
*****=======
*****1. ITM_BLOB column updated with the content of input file
int set_item_blob (char chr_item_number,int revision_level,char file_path)
exec sql begin declare section;
OCIBlobLocator *blob_locator;
varchar vc_item_number[12];
long file_length=0;
varchar alert_message [500+1];
int plsql_err_code = 0;
exec sql end declare section;
FILE *fp_input_file;
char *blob_buffer;
EXEC SQL VAR blob_buffer IS RAW(BUFFER_LENGTH);
EXEC SQL ALLOCATE :blob_locator;
memset ( vc_item_number.arr, '\0', 12 );
strcpy ( vc_item_number.arr, chr_item_number );
vc_item_number.len = strlen ( vc_item_number.arr );
fp_input_file = fopen( file_path, "rb" );
if( fp_input_file == NULL)
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Failure in opening the file to be uploaded [%s]", chr_item_number, revision_level , file_path );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
else
(void) fseek(fp_input_file, 0L, SEEK_END) ;
file_length = (unsigned int)ftell(fp_input_file) ;
(void) fseek(fp_input_file, 0L, SEEK_SET) ;
if ( file_length > BUFFER_LENGTH )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. Length of the file to be uploaded(%ld) is more than the supported length(%ld)", chr_item_number, revision_level , file_length, BUFFER_LENGTH );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
EXEC SQL
UPDATE T_ITEM
SET ITM_BLOB = EMPTY_BLOB()
WHERE ITM_NUMBER = :vc_item_number
AND ITM_REVISION_LEVEL = :revision_level
RETURNING ITM_BLOB INTO :blob_locator;
if ( sqlca.sqlcode != 0 )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to get the BLOB locator", chr_item_number, revision_level , sqlca.sqlcode );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
blob_buffer=(char *)malloc(BUFFER_LENGTH); // Dynamic Memory Allocation for Itm_Blob
fread((void *)blob_buffer, (size_t)BUFFER_LENGTH, (size_t)1, fp_input_file);
EXEC SQL LOB WRITE ONE :file_length FROM :blob_buffer INTO :blob_locator;
if ( sqlca.sqlcode != 0 )
sprintf ( alert_message.arr, "ngetupld BLOB upload failed for item_number = [%s], rev_level = [%d]. SQL error %d occured while trying to update the BLOB content", chr_item_number, revision_level , sqlca.sqlcode );
alert_message.len = strlen ( alert_message.arr );
EXEC SQL EXECUTE
BEGIN
P_INSERT_INTO_INFO_MESSAGES('AL',:alert_message,'BLB',NULL,NULL,:plsql_err_code);
END;
END-EXEC;
exec sql commit;
return 1;
exec sql commit;
fclose(fp_input_file);
free(blob_buffer);
return 0;
Can Possible to do in Oacle Pl/Sql...?> Hi TOM,
This is not asktom.oracle.com.
> Can Possible to do in Oacle Pl/Sql...?
Yes it can be done. Simply consult the applicable manuals that contains all of the details on how to do it. The manuals are:
- Oracle® Database Application Developer's Guide - Large Objects (refer to Chapter 6 section on Using PL/SQL (DBMS_LOB Package) to Work with LOBs)
- Oracle® Database PL/SQL Packages and Types Reference (refer to the chapter on DBMS_LOB) -
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
Report Builder 10.1.2.0.2
ORACLE Server Release 10.1.0.4.2
Oracle Procedure Builder 10.1.2.0.2
Oracle ORACLE PL/SQL V10.1.0.4.2 - Production
Oracle CORE 10.1.0.4.0 Production
Oracle Tools Integration Services 10.1.2.0.2
Oracle Tools Common Area 10.1.2.0.2
Oracle Toolkit 2 for Windows 32-bit platforms 10.1.2.0.2
Resource Object Store 10.1.2.0.2
Oracle Help 10.1.2.0.2
Oracle Sqlmgr 10.1.2.0.2
Oracle Query Builder 10.1.2.0.2 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle ZRC 10.1.2.0.2
Oracle XML Developers Kit 10.1.0.4.2 - Production
Oracle Virtual Graphics System 10.1.2.0.2
Oracle Image 10.1.2.0.2
Oracle Multimedia Widget 10.1.2.0.2
Oracle Tools GUI Utilities 10.1.2.0.2
I have enclosed sample data and also table structure. I need help in getting the query.
select dept_id,proc_code,override_goal,goal_override_date
from table2
where goal_override_date between '02-jan-2014' and '11-jan-2014'
and dept_id = 10
and proc_code = 'CP'
select DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY,
DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
DAY_FRIDAY, DAY_SATURDAY
from table1
where dept_id =10
and proc_code = 'CP';
Table1 is kind of maintenance table.
In Table2 values can be overridden.
Requirement
Check to see if there is data in table 2 for the date range . If table2 has no value then take value from table1 for that day the date falls into. Any more clarification please ask me.
Sundays are all zeros.
I want this data. and the sum for the date range.
2-jan-2014 - 3
3-jan-2014 - 3
4-jan-2014 - 3
5-jan-2014 - 0
6-jan-2014 - 1
7-jan-2014 - 3
8-jan-2014 - 5
9-jan-2014 - 5
10-jan-2014 - 3
11-jan-2014 - 3
Sum for the date range has to be 29
Sample table and data
CREATE TABLE TABLE1
DEPT_ID NUMBER NOT NULL,
PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
DAY_SUNDAY NUMBER(4) NOT NULL,
DAY_MONDAY NUMBER(4) NOT NULL,
DAY_TUESDAY NUMBER(4) NOT NULL,
DAY_WEDNESDAY NUMBER(4) NOT NULL,
DAY_THURSDAY NUMBER(4) NOT NULL,
DAY_FRIDAY NUMBER(4) NOT NULL,
DAY_SATURDAY NUMBER(4) NOT NULL
Insert into TABLE1
(DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY,
DAY_WEDNESDAY, DAY_THURSDAY, DAY_FRIDAY, DAY_SATURDAY)
Values
(10, 'CP', 0, 3, 3,
3, 3, 3, 3);
COMMIT;
CREATE TABLE TABLE2
DEPT_ID NUMBER NOT NULL,
PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
OVERRIDE_GOAL NUMBER(4),
GOAL_OVERRIDE_DATE DATE NOT NULL
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 1, TO_DATE('01/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 3, TO_DATE('01/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 5, TO_DATE('01/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 5, TO_DATE('01/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 3, TO_DATE('01/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
Insert into TABLE2
(DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
Values
(10, 'CP', 3, TO_DATE('01/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
COMMIT;
Help is highly appreciated.SELECT dates,
override_goal,
SUM(override_goal) OVER()
FROM(SELECT dates,
CASE WHEN EXISTS(SELECT 1
FROM table2 t2
WHERE t2.goal_override_date = qry1.dates
AND t2.dept_id = 10
AND t2.proc_code = 'CP')
THEN (SELECT override_goal
FROM table2 t2
WHERE t2.goal_override_date = qry1.dates
AND t2.dept_id = 10
AND t2.proc_code = 'CP')
ELSE (SELECT DECODE(days,'SUN',day_sunday,
'MON',day_monday,
'TUE',day_tuesday,
'WED',day_wednesday,
'THU',day_thursday,
'FRI',day_friday,
'SAT',day_saturday )
FROM table1)
END as override_goal
FROM (SELECT in_dt1+(LEVEL-1) dates,
TO_CHAR(in_dt1+(LEVEL-1),'DY') days
FROM(SELECT TO_DATE(&from_date,'DD-MON-YYYY') in_dt1,
TO_DATE(&to_date,'DD-MON-YYYY') in_dt2
FROM dual)
CONNECT BY LEVEL <= (in_dt2 - in_dt1)+1) qry1);
Now run the query it will prompt you for the inputs. You can pass the date values and check the result. Otherwise replace &from_date,&to_date with user inputs -
Oracle 10g on HP-UX, Terrible Poor Performance!!
Hi All,
I setup an Oracle 10g on HP-UX 11iv1. Server is a HP 9000, 4 CPUs (750
MHZ). It is connected to Disk System 2405 (Virtual Array 7110). Fiber
Channels are connected at 2 GB speed.
I installed a cluster 10g database. First I installed CRS and after
that I installed oracle database. ( I want to test clustered database
with one instance)
I installed every thing line by line as oracle document wrote.
All the things, kernel parameters, patches, are like oracle wrote in
its document.
I installed Golden quality package June 2004.
I increased shmmax to 2.3 G . My SGA is 1.7 G And change some other
parameters as Sandy Gruver wrote in Best Practices for Oracle on HPUX.
I used oracle new storage system called ASM for this case.
When I put the system under the load, I was monitoring the system
carefully.
I started gmp. When we sent some quarries to database (It is not heavy
load, I tested it with a Linux system on proliant ML570 without any
problem), suddenly DISK section in gpm changed to red (critical ) I
read the warning. It said "Disk bottleneck probability = 100%". I
changed the output of disk report to "Report IO by Disk"
"DISK%" was 100% and "RAW IO RT" was about 1000 for two disks ( This
two disks dedicated for ASM). In this situation CPU idle time was 1% or
2% for all the CPUs but load average was about 1. Performance is not
acceptable at all ( In comparison with Oracle that installed on Linux).
Glance reported Disk was in Critical situation.
I think the problem is IO or something about Disks
I used HP Disk System 2405. Fibber channels on both server side and
Disk Array side are configured at 2 Gb and topologies are
PTTOPT_FABRIC.
Is it ok that RAW IO RT about 1000 for each LUN?
Why Disk% in glance/report IO BY Disk/ was 100%?
I found an error in STM logs about I/O.It said:
Entry type: I/O error
Product: Fiber Channel Interface
Logger: td
It logged this error about 12 times during the test.Any comment?
Regards,
HasanSorry, I have not a solution for your problem, but similar things happen on our installation on Solaris 5.8 with Oracle 10:
I have a banking business solution from Windows/SQL Server 2000 to Sun Solaris/ORACLE 10g migrated. In the test environment everything was working fine. On the production system we have very poor DB performance. About 100 times slower than SQL Server 2000!
Environment at Customer Server Side:
Hardware: SUN Fire 4 CPU's, OS: Solaris 5.8, DB Oracle 8 and 10
Data Storage: Em2
DB access thru OCCI [Environment:OBJECT, Connection Pool, Create Connection]
Depending from older applications it's necessary to run ORACLE 8 as well on the same Server. Since we have running the new solution, which is using ORACLE 10, the listener for ORACLE 8 is frequently gone (or by someone killed?). The performance of the whole ORACLE 10 Environment is very poor. As a result of my analyse I figured out that the process to create a connection to the connection pool takes up to 14 seconds. Now I am wondering if it a problem to run different ORACLE versions on the same Server? The Customer has installed/created the new ORACLE 10 DB with the same user account (oracle) as the older version. To run the new solution we have to change the ORACLE environment settings manually. All hints/suggestions to solve this problem are welcome. Thanks in advance.
Anton -
Can Oracle view refer a table in Sql Server Database
Can a view created in Oracle database refer a table created in SQL Server database. If yes, how do we do it. Code will be very help full.
Again, if yes does it require any special software and what would be price of that software.
Thanks for your response in advance.
Venkat SathiamurthyYou would need to configure Oracle Heterogeneous Connectivity to create a database link to the SQL Server system. This can either be done via the Oracle Transparent Gateway for Microsoft SQL Server, which retails for $15,000 per server at http://store.oracle.com or by configuring Oracle Generic Connectivity and using ODBC to go after the SQL Server data. Depending on the operating system you run Oracle on, there may be a free (or cheap) ODBC driver for SQL Server that could be used.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Oracle 10gR2 WebService Call-In & Call-Out via PL/SQL (Step-by-Step Guide)
Hi Everyone,
This guide is for those of you who tried to Call-In and Call-Out WebService via Oracle 10gR2 using PL/SQL but failed a couple of times, re-installed a couple of times and retry, got it to work but don't know what made it work scenarios.
Hope this helps ;-)
Thanks,
Henry Wu
Instructions on how to use Oracle10gR2 Webservice Call-Out feature (Oracle JAX-RPC DII - Dynamic Invocation (DII) APIs)
PREREQUISITE
=================================================================
1. Download Oracle Database 10g Release 2 (10.2.0.1.0) (ZIP, ~655MB)
http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html
http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
1.1 Choose Enterprise Edition
2. Download 10.1.3.1 Callout Utility for 10g (R1 +R2) RDBMS (ZIP, ~13MB)
http://download.oracle.com/technology/sample_code/tech/java/jsp/dbws-callout-utility-10131.zip
2.1 Extract to C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131
3. Download OC4J Standalone - Oracle Containers for J2EE (OC4J) 10g Release 3 (10.1.3.3) (ZIP, ~93MB; Pure Java—runs on all certified platforms)
http://www.oracle.com/technology/software/products/ias/index.html (Download Site)
http://download.oracle.com/otn/java/oc4j/101330/oc4j_extended_101330.zip
3.1 Extract to C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
STEP-BY-STEP PROCEDURES
=================================================================
1. Prepare the database
1.1 Connect to SYS account (or any account that can connect as SYSDBA)
1.2 alter system set shared_pool_size=96M scope=both
1.3 alter system set java_pool_size=80M scope=both
1.4 ALTER USER SCOTT ACCOUNT UNLOCK;
1.5 ALTER USER SCOTT IDENTIFIED BY "tiger";
1.6 ALTER USER SCOTT QUOTA UNLIMITED ON USERS;
1.7 GRANT PUBLIC TO SCOTT;
1.8 GRANT Create Public Synonym TO SCOTT;
2. Load Oracle SOAP client to SCOTT (for Oracle 10g Release 2 Database)
2.1 Commands
2.1.1 Open command prompt (cmd.exe)
2.1.2 loadjava -u scott/tiger -r -v -f -genmissing -s -grant public C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\webservices\lib\soap.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\lib\dms.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\jlib\javax-ssl-1_1.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\servlet.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\mail.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\activation.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\http_client.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\ejb.jar
2.1.3 It will take around 3 minutes and you will see "something" like the following when it completes (count may not be exact) :
Classes Loaded: 909
Resources Loaded: 75
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 984
Errors: 0
2.1.3 Close this command prompt
3. Load Oracle JAX-RPC client to SYS (for Oracle 10g Release 2 Database)
3.1 Commands
3.1.1 Open command prompt (cmd.exe)
3.1.2 loadjava -u sys/oracle -r -v -f -genmissing -s -grant public C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\dbwsclientws.jar C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\dbwsclientdb102.jar
3.1.2.1 It will take around 15 minutes and you will see "something" like following when it completes (count may not be exact) :
Classes Loaded: 4027
Resources Loaded: 81
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 61
Classes skipped: 0
Synonyms Created: 4108
Errors: 0
3.1.3 Close this command prompt
4. Execute UTL_DBWS packages to SYS (for Oracle 10g Release 2 Database)
4.1 Commands
4.1.1 Connect to SYS account only
4.1.2 Execute the following (in TOAD you should execute them as Script, press the "thunder" button)
4.2.1 @"C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\utl_dbws_decl.sql"
4.2.2 @"C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\utl_dbws_body.sql"
4.2.3 CREATE PUBLIC SYNONYM utl_dbws FOR sys.utl_dbws;
5. Call-out a free Web Service using SCOTT
5.1 Commands
5.1.1 Connect to user SCOTT with password of TIGER
5.1.2 Copy and Paste the following "Anonymous Block" (sample #1) and execute it :
5.1.2.1 It sould return "PL/SQL DII client return ===> Redwood City"
declare
service_ utl_dbws.SERVICE;
call_ utl_dbws.CALL;
service_qname utl_dbws.QNAME;
port_qname utl_dbws.QNAME;
operation_qname utl_dbws.QNAME;
string_type_qname utl_dbws.QNAME;
retx ANYDATA;
retx_string VARCHAR2(1000);
retx_double number;
retx_len number;
params utl_dbws.ANYDATA_LIST;
l_input_params utl_dbws.anydata_list;
l_result ANYDATA;
l_namespace VARCHAR2(1000);
begin
-- open internet explorer and navigate to http://webservices.imacination.com/distance/Distance.jws?wsdl
-- search for 'targetNamespace' in the wsdl
l_namespace := 'http://webservices.imacination.com/distance/Distance.jws';
-- search for 'service name' in the wsdl
service_qname := utl_dbws.to_qname(l_namespace, 'DistanceService');
-- this is just the actual wsdl url
service_ := utl_dbws.create_service(HTTPURITYPE('http://webservices.imacination.com/distance/Distance.jws?wsdl'), service_qname);
-- search for 'portType name' in the wsdl
port_qname := utl_dbws.to_qname(l_namespace, 'Distance');
-- search for 'operation name' in the wsdl
-- there will be a lot, we will choose 'getCity'
operation_qname := utl_dbws.to_qname(l_namespace, 'getCity');
-- bind things together
call_ := utl_dbws.create_call(service_, port_qname, operation_qname);
-- default is 'FALSE', so we make it 'TRUE'
utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
-- search for 'operation soapAction' under <wsdl:operation name="getCity">
-- it is blank, so we make it ''
utl_dbws.set_property(call_, 'SOAPACTION_URI', '');
-- search for 'encodingstyle' under <wsdl:operation name="getCity">
utl_dbws.set_property(call_, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
-- search for 'binding style'
utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
-- search for 'xmlns:xs' to know the value of the first parameter
-- under <wsdl:message name="getCityResponse"> you will see the line <wsdl:part name="getCityReturn" type="xsd:string" />
-- thus the return type is 'string", removing 'xsd:'
string_type_qname := utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
-- in the line <wsdl:operation name="getCity" parameterOrder="zip">
-- the parameterOrder is 'zip', thus we put in 'zip'
-- the 'ParameterMode.IN' is used to specify that we will be passing an "In Parameter" to the web service
-- the 'ParameterMode.IN' is a constant variable in the sys.utl_dbws package
utl_dbws.add_parameter(call_, 'zip', string_type_qname, 'ParameterMode.IN');
utl_dbws.set_return_type(call_, string_type_qname);
-- supply the In Parameter for the web service
params(0) := ANYDATA.convertvarchar('94065');
-- invoke the web service
retx := utl_dbws.invoke(call_, params);
-- access the returned value and output it to the screen
retx_string := retx.accessvarchar2;
dbms_output.put_line('PL/SQL DII client return ===> ' || retx_string);
-- release the web service call
utl_dbws.release_service(service_);
end;
5.1.3 Copy and Paste the following "Anonymous Block" (sample #2) and execute it :
5.1.3.1 It should return "PL/SQL DII client return ===> twelve thousand three hundred and forty five"
declare
service_ utl_dbws.SERVICE;
call_ utl_dbws.CALL;
service_qname utl_dbws.QNAME;
port_qname utl_dbws.QNAME;
operation_qname utl_dbws.QNAME;
string_type_qname utl_dbws.QNAME;
retx ANYDATA;
retx_string VARCHAR2(1000);
retx_double number;
retx_len number;
params utl_dbws.ANYDATA_LIST;
l_input_params utl_dbws.anydata_list;
l_result ANYDATA;
l_namespace VARCHAR2(1000);
begin
-- open internet explorer and navigate to http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL
-- search for 'targetNamespace' in the wsdl
l_namespace := 'http://www.dataaccess.com/webservicesserver/';
-- search for 'service name' in the wsdl
service_qname := utl_dbws.to_qname(l_namespace, 'NumberConversion');
-- this is just the actual wsdl url
service_ := utl_dbws.create_service(HTTPURITYPE('http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL'), service_qname);
-- search for 'portType name' in the wsdl
port_qname := utl_dbws.to_qname(l_namespace, 'NumberConversionSoap');
-- search for 'operation name' in the wsdl
-- there will be a lot, we will choose 'NumberToWords'
operation_qname := utl_dbws.to_qname(l_namespace, 'NumberToWords');
-- bind things together
call_ := utl_dbws.create_call(service_, port_qname, operation_qname);
-- default is 'FALSE', so we make it 'TRUE'
utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
-- search for 'operation soapAction' under <operation name="NumberToWords">
-- it is blank, so we make it ''
utl_dbws.set_property(call_, 'SOAPACTION_URI', '');
-- search for 'encodingstyle'
-- cannot find xml tag 'encodingstyle', so we just use the following as the generic encoding style
utl_dbws.set_property(call_, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
-- search for 'binding style'
-- although 'document' was used, it produced an error, thus we will use 'rpc'
-- this value is generally only 'document' or 'rpc'
utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
-- search for 'xmlns:xs' to know the value of the first parameter
-- under <xs:element name="NumberToWords"> you will see the line <xs:element name="ubiNum" type="xs:unsignedLong" />
-- thus the return type is 'unsignedlong', removing 'xs:'
-- however, upon testing, using 'unsignedlong' produced an error, while 'string' did not, so we will use 'string'
string_type_qname := utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
-- under <xs:element name="NumberToWords"> you will see the line <xs:element name="ubiNum" type="xs:unsignedLong" />
-- the element name is 'ubiNum', thus we put in 'ubiNum'
-- the 'ParameterMode.IN' is used to specify that we will be passing an "In Parameter" to the web service
-- the 'ParameterMode.IN' is a constant variable in the utl_dbws package
utl_dbws.add_parameter(call_, 'ubiNum', string_type_qname, 'ParameterMode.IN');
utl_dbws.set_return_type(call_, string_type_qname);
-- supply the In Parameter for the web service
params(0) := ANYDATA.convertvarchar('12345');
-- invoke the web service
retx := utl_dbws.invoke(call_, params);
-- access the returned value and output it to the screen
retx_string := retx.accessvarchar2;
dbms_output.put_line('PL/SQL DII client return ===> ' || retx_string);
-- release the web service call
utl_dbws.release_service(service_);
end;
NOTES AND REFERENCES
=================================================================
This detailed step-by-step guide was produced with the following guide http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm
I could still not load Oracle JAX-RPC client to SCOTT (step 4) as it produces an error. See the following for more details :
http://forums.oracle.com/forums/thread.jspa?threadID=633219&tstart=0
Also, I could not consume some of the other free Web Services out there for reasons I don't know, hope someone can help clarify. See the following for more details :
http://forums.oracle.com/forums/thread.jspa?threadID=630733&tstart=0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Instructions on how to use Oracle10gR2 Webservice Call-In feature
PREREQUISITE
=================================================================
1. Download Oracle Database 10g Release 2 (10.2.0.1.0) (ZIP, ~655MB)
http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html
http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
1.1 Choose Enterprise Edition
2. Download OC4J Standalone - Oracle Containers for J2EE (OC4J) 10g Release 3 (10.1.3.3) (ZIP, ~93MB; Pure Java—runs on all certified platforms)
http://www.oracle.com/technology/software/products/ias/index.html (Download Site)
http://download.oracle.com/otn/java/oc4j/101330/oc4j_extended_101330.zip
2.1 Extract to C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
STEP-BY-STEP PROCEDURES
=================================================================
1. Connect to SYS account and create user STORE
CREATE USER store IDENTIFIED BY store;
GRANT connect, resource TO store;
2. Connect to Oracle using the user STORE and password STORE
CONNECT store/store;
3. Execute the following objects for this excercise
CREATE SEQUENCE order_sq;
CREATE TABLE product_types (
product_type_id INTEGER
CONSTRAINT product_types_pk PRIMARY KEY,
name VARCHAR2(10) NOT NULL
CREATE TABLE products (
product_id INTEGER
CONSTRAINT products_pk PRIMARY KEY,
product_type_id INTEGER
CONSTRAINT products_fk_product_types
REFERENCES product_types(product_type_id),
name VARCHAR2(30) NOT NULL,
description VARCHAR2(50),
price NUMBER(5, 2)
CREATE TABLE customers (
customer_id INTEGER
CONSTRAINT customers_pk PRIMARY KEY,
first_name VARCHAR2(10) NOT NULL,
last_name VARCHAR2(10) NOT NULL,
dob DATE,
phone VARCHAR2(12)
CREATE TABLE orders (
order_id INTEGER
CONSTRAINT orders_pk PRIMARY KEY,
product_id INTEGER
CONSTRAINT purchases_fk_products
REFERENCES products(product_id),
customer_id INTEGER
CONSTRAINT purchases_fk_customers
REFERENCES customers(customer_id),
quantity INTEGER NOT NULL
INSERT INTO customers (
customer_id, first_name, last_name, dob, phone
) VALUES (
1, 'John', 'Brown', '01-JAN-1965', '800-555-1211'
INSERT INTO product_types (
product_type_id, name
) VALUES (
1, 'Book'
INSERT INTO products (
product_id, product_type_id, name, description, price
) VALUES (
1, 1, 'Modern Science', 'A description of modern science', 19.95
COMMIT;
CREATE OR REPLACE PACKAGE dbfunc AS
FUNCTION place_order (
p_product_id INTEGER,
p_customer_id INTEGER,
p_quantity INTEGER
RETURN VARCHAR2;
END dbfunc;
CREATE OR REPLACE PACKAGE BODY dbfunc AS
FUNCTION place_order (
p_product_id INTEGER,
p_customer_id INTEGER,
p_quantity INTEGER
RETURN VARCHAR2 IS
v_customer_count INTEGER;
v_product_count INTEGER;
v_order_id INTEGER;
BEGIN
-- count the number of products with the
-- supplied p_product_id (should be 1 if the product exists)
SELECT COUNT(*)
INTO v_product_count
FROM products
WHERE product_id = p_product_id;
IF v_product_count = 0 THEN
RETURN 'No such product';
END IF;
-- count the number of customers with the
-- supplied p_customer_id (should be 1)
SELECT COUNT(*)
INTO v_customer_count
FROM customers
WHERE customer_id = p_customer_id;
IF v_customer_count = 0 THEN
RETURN 'No such customer';
END IF;
-- get the next value from orders_sq
SELECT order_sq.nextval
INTO v_order_id
FROM dual;
-- place the order
INSERT INTO orders (
order_id, product_id, customer_id, quantity
) VALUES (
v_order_id, p_product_id, p_customer_id, p_quantity
COMMIT;
RETURN 'Order placed with id of ' || v_order_id;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RETURN 'Order not placed';
END place_order;
END dbfunc;
4. Install and Configure OC4J
4.1 Change Directory
4.1.1 Open command prompt (cmd.exe)
4.1.2 CD C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\bin
4.2 Configure Environment variables (type in command prompt)
4.2.1 set JAVA_HOME=C:\oracle\product\10.2.0\db_1\jdk
4.2.2 set ORACLE_HOME=C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
4.3 Starting OC4J for the first time
4.3.1 oc4j -start
4.3.2 If this is not your first time to "start" oc4j, go to step 4.3.4
4.3.3 Set oc4jadmin password (use the password "oracle" w/o the quotation marks)
08/03/21 17:13:54 Set OC4J administrator's password (password text will not be displayed as it is entered)
Enter password:
Confirm password:
Confirm password: The password for OC4J administrator "oc4jadmin" has been set.
08/03/21 17:14:01 The OC4J administrator "oc4jadmin" account is activated.
4.3.4 OC4J has started if you see the message :
08/03/21 17:14:16 Oracle Containers for J2EE 10g (10.1.3.3.0) initialized
4.3.5 Leave this command prompt open
4.4 Configure Data Source
4.4.1 Open a new command prompt via the cmd.exe command
4.4.2 type "hostname" and then press enter
4.4.3 Keep this command prompt open for later use
4.4.4 Open Windows Explorer and navigate to the folder C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config
4.4.5 Open the file data-sources.xml
4.4.6 Modify and Save the file so that it will look something like the following :
4.4.6.1 Note that "hpv2710us" is my hostname found in step 4.4.2
4.4.6.2 Note that "ORCLDEV" is the name of my Oracle Instance. (Default installation uses ORCL only)
<connection-pool name="Example Connection Pool">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
user="store"
password="store"
url="jdbc:oracle:thin:@//hpv2710us:1521/ORCLDEV">
</connection-factory>
</connection-pool>
4.4.7 Close the text editor
4.4.8 Close the Windows Explorer
4.4.9 Close this command prompt (type exit)
5. Publishing a PL/SQL Package as a Database Web Service
5.1 Create the config.xml file
5.1.1 Open Notepad.exe
5.1.2 Copy and Paste the following :
5.1.2.1 Note that "hpv2710us" is my hostname found in step 4.4.2
5.1.2.2 Note that "ORCLDEV" is the name of my Oracle Instance. (Default installation uses ORCL only)
<web-service>
<display-name>PLSQL Web Service</display-name>
<description>PLSQL Sample</description>
<destination-path>./dbfunc.ear</destination-path>
<temporary-directory>/tmp</temporary-directory>
<context>/plsqlsample</context>
<stateless-stored-procedure-java-service>
<jar-generation>
<schema>store/store</schema>
<db-url>jdbc:oracle:thin:@hpv2710us:1521:ORCLDEV</db-url>
<prefix>db.func.place.order</prefix>
<db-pkg-name>dbfunc</db-pkg-name>
</jar-generation>
<uri>/dbfunc</uri>
<database-JNDI-name>jdbc/OracleDS</database-JNDI-name>
</stateless-stored-procedure-java-service>
<wsdl-gen>
<wsdl-dir>wsdl</wsdl-dir>
<option name="force">true</option>
<option name="httpServerURL">http://localhost:8888</option>
</wsdl-gen>
<proxy-gen>
<proxy-dir>proxy</proxy-dir>
<option name="include-source">true</option>
</proxy-gen>
</web-service>
5.1.3 Save file as config.xml in the directory C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config
5.1.3.1 Note it should be config.xml and not config.txt
5.1.4 Close the text editor
5.2 Publish dbfunc Oracle Package as a Web Service
5.2.1 Open a new command prompt via the cmd.exe command
5.2.2 CD C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home
5.2.3 mkdir ear
5.2.4 CD ear
5.2.5 set ORACLE_HOME=C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
5.2.6 set CLASSPATH=.;%ORACLE_HOME%\webservices\lib\wsdl.jar;%ORACLE_HOME%\lib\xmlparserv2.jar;%ORACLE_HOME%\soap\lib\soap.jar
5.2.7 java -jar %ORACLE_HOME%\webservices\lib\WebServicesAssembler.jar -config C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config\config.xml
Please wait ...
STORE.DBFUNC
5.2.8 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -deploy -file C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\ear\dbfunc.ear -deploymentName dbfunc
08/03/21 17:46:23 Notification ==>Application Deployer for dbfunc COMPLETES. Operation time: 296 msecs
5.2.9 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -bindWebApp -appname dbfunc -webModuleName dbfunc_web
5.2.10 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -bindAllWebApps -appname dbfunc
5.2.11 Close this command prompt (type exit)
6. Test dbfunc Web Service
6.1 Restart OC4J
6.1.1 Open the command prompt you used to start OC4J in step 4.1.1/4.3.1
6.1.2 In the keyboard, hit Ctrl+C
6.1.2.1 Type "Y" and then hit Enter
08/03/21 18:02:51 Shutting down OC4J...
Terminate batch job (Y/N)? Y
6.1.2.2 Note that the command prompt should still be open
6.1.2.2.1 If you accidentally closed the command prompt just do the following
6.1.2.2.1.1 Do 4.1.1 to 4.2.2 and then proceed to 6.1.3
6.1.3 oc4j -start
Starting OC4J from C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home...
08/03/21 18:07:57 Oracle Containers for J2EE 10g (10.1.3.3.0) initialized
6.1.4 Leave this command prompt open
6.2 Use the Web Service to "Order an Item"
6.2.1 Connect to Oracle using the user STORE and password STORE
6.2.2 select * from orders
6.2.2.1 Zero row should return
6.2.3 Open Internet Explorer
6.2.4 Navigate to http://localhost:8888/plsqlsample/dbfunc
6.2.5 Input the following :
6.2.5.1 param0 value: 1
6.2.5.2 param1 value: 1
6.2.5.3 param2 value: 10
6.2.6 Click the Invoke button
6.2.7 A pop-up window will appear having the following contents :
<?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <ns1:placeOrderResponse xmlns:ns1="http://db.func.place.order/dbfunc.wsdl" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:string">Order placed with id of 1</return>
</ns1:placeOrderResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
6.2.8 Go back to SQLPLUS or Toad and execute "select * from orders" again
6.2.8.1 There should be one row
ORDER_ID, PRODUCT_ID, CUSTOMER_ID, QUANTITY
1, 1, 1, 10
NOTES AND REFERENCES
=================================================================
This detailed step-by-step guide was produced with the following article by Jason Price http://www.oracle.com/technology/pub/articles/price_10gws.htmlSuccess!!!
I had to grant this permissions:
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'getClassLoader', '' );
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'accessClassInPackage.sun.util.calendar', '' );
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'setFactory', '' )
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.util.PropertyPermission', 'HTTPClient.socket.idleTimeout', 'write' );
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.net.SocketPermission', 'localhost', 'resolve' );
call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.net.SocketPermission', '127.0.0.1:8084', 'connect,resolve' );
As I wrote earlier, WS_TEST is my user into which I load JAX-RPC client. Note that, if you load JAX-RPC client into user another than SYS, you have NOT to use -s -grant public option (wassam wrote about this too). Another thing is that I (finally) didn't load OC4J. To consume WebService I use utl_dbws.invoke(call_Handle CALL, request SYS.XMLTYPE) function.
voytec001 -
Hi all,
In the middle of the last week for my final year project and having to convert to an Oracle database due to compatibility problems with university Tomcat Server and MS Access. I'm having trouble connecting to the Oracle database and would appreciate some help please.
Running on Windows 98 in the lab here, and the Oracle 9i, release 9.2.0.2.0, J2SDK1.4.0, Classes12.zip installed OK.
Code for connection looks like this inside the constructor of my class:
Class.forName("oracle.jdbc.driver.OracleDriver");
cardSaleConnexion = DriverManager.getConnection("jdbc:oracle:[email protected]:1521:sid","user_name","pwdt");
System.out.println("Connection Successful ");
And I'm getting the following error when calling the constructor in a driver program:
java.sql.SQLException: Invalid Oracle URL specified
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:188)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at CardSale.<init>(CardSale.java:30)
at Driver.main(Driver.java:11)
Exception in thread "main"
Please reply on a very urgent basis.
Kind regards,
PeterTry ojdbc14.jar as the JDBC driver instead of classes12.zip.
Refer:
http://otn.oracle.com/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
http://docs.sun.com/source/817-5603-10/index.html
Database Driver
This section describes the known database driver issues and associated solutions.
ID Summary
4700531 On Solaris, an ORACLE JDBC driver error occurs.
This new Java Database Connectivity (JDBC) driver is for Oracle (R) working with JDK1.4. The problem is caused by a combination of the Oracle 9.1 database and ojdbc14.jar. Applying the patch will fix the problem on Solaris 32-bit machine, running an Oracle 9.0.1.3 database.
Solution
Obtain and apply the patch to your server from the Oracle Web site for Bug 2199718. Perform the following steps:
1.��Go to the Oracle web site.
2.��Click the 'patches' button.
3.��Type 2199718 in the patch number field.
4.��Click the 32-bit Solaris OS patch.Go to Metalink.oracle.com.
5.��Click patches.
6.��Under patch number, enter 2199718.
7.��Click the 32 bit Solaris OS patch.
4707531 On Solaris, accessing an Oracle 9.1 database with an Oracle 9.2 Client may cause data corruption.
If you use an Oracle (R) 9.2 client to access an Oracle 9.1 database, data corruption might occur when a number column follows a timestamp column.
The problem might be caused by using the ojdbc14.jar file with an Oracle 9.1 database. Applying the patch might assist in addressing the situation on Solaris 32-bit machines, running an Oracle 9.1 database. This JDBC driver is for Oracle working with JDK1.4.
Solution
Obtain the patch that Oracle might make available from the Oracle web site for Bug 2199718 and apply it to your server.
Regards,
Pankaj D. -
Manually Migrating from Oracle 10g to 11g
Hello, I'm currently a student in an Oracle DBA class. I'm totally new to the Oracle world.
One of our final assignments concerns upgrading Oracle instances without the use of DBUA.
I've currently got Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 and am trying to upgrade to 11.1.0.7.0
This is all inside of VirtualBox, running Windows Server 2008. I've been using 10g with absolutely no issues for the duration of this class.
I successfully installed 11g, choosing to install the software only and not use dbua.
I changed my environment variables to point towards the 10g installation; ORACLE_HOME, ORACLE_SID, PATH, and LD_LIBRARY_PATH.
Then logged into 10g's SQLPlus and ran utlu111i.sql, which ran successfully. I issued a shutdown immediate and exited SQLPlus.
Changed my environment variables to point towards the 11g home and set ORACLE_SID as the 10g database name. I was able to log into 11g's SQL plus, was told I was connected to an idle instance, which I expected. I issued a startup upgrade command, and then attempted to run catupgrd.sql, but got an error stating that I had to run the script from 11g.
If I don't set the environment variables then when I try to log into 11g's sqlplus, I get an ORA-12560: TNS:protocol adapter error... I've tried reinstalling 11g from scratch, but to no avail. My instructor and I have been emailing back and forth frequently over the past few days but we have not been able to reach a solution, so I thought I would see if I could pick your brains.
Here's all of the terminal output from the process:
C:\Users\Administrator>sqlplus
SQL*Plus: Release 10.2.0.3.0 - Production on Fri Apr 29 20:15:09 2011
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Enter user-name: connect /as sysdba
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @?
SP2-0310: unable to open file "C:\270Oracle.sql"
SQL> @C:\NewCIS270\product\11.1.0\db_1\rdbms\admin\utlu111i
Oracle Database 11.1 Pre-Upgrade Information Tool 04-29-2011 20:16:16
Database:
--> name: KYLMAN
--> version: 10.2.0.3.0
--> compatible: 10.2.0.3.0
--> blocksize: 8192
--> platform: Microsoft Windows IA (32-bit)
--> timezone file: V4
Tablespaces: [make adjustments in the current environment]
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 729 MB
.... AUTOEXTEND additional space required: 249 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 417 MB
.... AUTOEXTEND additional space required: 352 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 455 MB
.... AUTOEXTEND additional space required: 215 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 61 MB
.... AUTOEXTEND additional space required: 33 MB
--> EXAMPLE tablespace is adequate for the upgrade.
.... minimum required size: 78 MB
Update Parameters: [Update Oracle Database 11.1 init.ora or spfile]
-- No update parameter changes are required.
Renamed Parameters: [Update Oracle Database 11.1 init.ora or spfile]
-- No renamed parameters found. No changes are required.
Obsolete/Deprecated Parameters: [Update Oracle Database 11.1 init.ora or spfile]
--> "background_dump_dest" replaced by "diagnostic_dest"
--> "user_dump_dest" replaced by "diagnostic_dest"
--> "core_dump_dest" replaced by "diagnostic_dest"
Components: [The following database components will be upgraded or installed]
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Data Mining [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
Miscellaneous Warnings
WARNING: --> Database contains stale optimizer statistics.
.... Refer to the 11g Upgrade Guide for instructions to update
.... statistics prior to upgrading the database.
.... Component Schemas with stale statistics:
.... SYS
.... OLAPSYS
.... SYSMAN
.... CTXSYS
.... XDB
WARNING: --> Database contains schemas with objects dependent on network
packages.
.... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
WARNING: --> EM Database Control Repository exists in the database.
.... Direct downgrade of EM Database Control is not supported. Refer to the
.... 11g Upgrade Guide for instructions to save the EM data prior to upgrade.
PL/SQL procedure successfully completed.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
C:\Users\Administrator>set ORACLE_HOME=C:\NewCIS270\product\11.1.0\db_1
C:\Users\Administrator>set ORACLE_SID=KYLMAN
C:\Users\Administrator>set PATH=%ORACLE_HOME%\bin
C:\Users\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Apr 29 20:22:49 2011
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup upgrade;
ORACLE instance started.
Total System Global Area 440401920 bytes
Fixed Size 1291072 bytes
Variable Size 146803904 bytes
Database Buffers 289406976 bytes
Redo Buffers 2899968 bytes
Database mounted.
Database opened.
SQL> @?
SP2-0310: unable to open file "C:\NewCIS270\product\11.1.0\db_1.sql"
SQL> @?/rdbms/admin/catupgrd
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC> The first time this script is run, there should be no error messages
DOC> generated; all normal upgrade error messages are suppressed.
DOC>
DOC> If this script is being re-run after correcting some problem, then
DOC> expect the following error which is not automatically suppressed:
DOC>
DOC> ORA-00001: unique constraint (<constraint_name>) violated
DOC> possibly in conjunction with
DOC> ORA-06512: at "<procedure/function name>", line NN
DOC>
DOC> These errors will automatically be suppressed by the Database Upgrade
DOC> Assistant (DBUA) when it re-runs an upgrade.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the user running this script is not SYS. Disconnect
DOC> and reconnect with AS SYSDBA.
DOC>######################################################################
DOC>######################################################################
DOC>#
no rows selected
DOC>######################################################################
DOC>######################################################################
DOC> The following statement will cause an "ORA-01722: invalid number"
DOC> error if the database server version is not correct for this script.
DOC> Shutdown ABORT and use a different script or a different server.
DOC>######################################################################
DOC>######################################################################
DOC>#
SELECT TO_NUMBER('MUST_BE_11_1') FROM v$instance
ERROR at line 1:
ORA-01722: invalid number
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
C:\Users\Administrator>
Edited by: 855732 on Apr 29, 2011 6:59 PMHi,
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
Your instance is started from the 10g ORACLE_HOME. You mentioned you started it from the 11g ORACLE_HOME but it's not the case.
Here is an example with a 10gR2 database started from a 11gR2 ORACLE_HOME :
SQL> startup upgrade pfile =/u01/app/oracle/product/10.2.0/db_1/dbs/initP102.ora
ORA-32006: BACKGROUND_DUMP_DEST initialization parameter has been deprecated
ORA-32006: USER_DUMP_DEST initialization parameter has been deprecated
ORACLE instance started.
Total System Global Area 167387136 bytes
Fixed Size 1335248 bytes
Variable Size 88080432 bytes
Database Buffers 75497472 bytes
Redo Buffers 2473984 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsNotice the Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 part.
In your case it was Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
To solve the issue follow the official documentation, you have specific actions with oradim etc. to do (it's always a bit more complicated than with Unix/Linux but it's documented) :
http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm#insertedID8
Best regards
Phil -
Oracle SQL-92 Non compliance: When will oracle support empty strings?
Oracle is the only database on the planet that equates an empty string to a null value. For several major versions, Oracle has said "Make sure you don't rely on null and empty string equivalency because it could go away in the future." When will Oracle get with it and support this aspect of the SQL-92 standard (not to mention mathmatical logic)?
You log enhancement requests through Metalink.
The procedure is documented in Metalink document 166650.1 as follows:
How to Log an Enhancement Request:
Create a new Service Request in MetaLink.
On the Create a SR - Brief Description screen, in the Type of problem field, select Enhancement Request.
Important factors to remember when filling out the Enhancement Request Service Request template and creating the Service Request:
Fully describe why the current product functionality does not meet your needs.
Explain in detail the enhancement you would like implemented
If possible, describe how the product can be changed to achieve the desired results.
Describe your business expectations. Include key milestone dates and justifications as to why this request is so important and the benefits your organization stands to gain should this request be accepted.
Once your Service Request has been created, it will be assigned to a Support Engineer who will validate your information. In some cases, your request may be a new or known product defect that the Support Engineer can either provide a fix, a workaround, or introduce to Oracle Development for resolution. In other cases, you may be presenting a valuable product enhancement that can improve Oracle product functionality. In all cases, the Support Engineer will be able to qualify your request and pass along the information to Oracle Development.
Once the Support Engineer validates your request, and an agreed upon action plan is created, your Support Engineer will create a new Enhancement Request and provide you with an Enhancement Request tracking number. The BUG search tool on MetaLink can then be used to receive status updates.
Please note that the Support Engineer will close the SR once the enhancement has been logged.
Also, see document 214168.1 -
Procedure compiles on Oracle 10g but fails to do so on Oracle 9i
Hi,
We have an application which supports both Oracle 9i and Oracle 10g dbs, recently we added a new procedure to get a report from the applications statistics schema, the procedure uses two other schemas also to get the report and uses a query which does not use any Oracle specific feature (pure ANSI SQL), it compiled successfully on Oracle 10g but gives the following error on 9i db
SQL> show err
Errors for PROCEDURE SPGETNONCOMPLOGBASEDONEMP:
LINE/COL ERROR
22/8 PL/SQL: SQL Statement ignored
31/37 PL/SQL: ORA-00907: missing right parenthesis
the 9i version
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
10g version
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
If any body knows the soln, please help
Thanks in advance
Gibs
Procedure
CREATE OR REPLACE PROCEDURE Spgetnoncomplogbasedonemp (
in_emp_id IN VARCHAR,
in_start_date IN DATE,
in_end_date IN DATE,
non_complog OUT Types.ref_cursor
IS
BEGIN
OPEN non_complog
FOR
SELECT end_date AS end_date, employee_id AS emp_id, NAME AS emp_name,
vcname AS plan_name, start_date, nid AS nid
FROM (SELECT *
FROM ((SELECT employee_id, NAME
FROM hrsample_bridge.ath_employee
WHERE ( (in_emp_id IS NULL AND 1 = 1)
OR (in_emp_id IS NOT NULL
AND employee_id = in_emp_id
)) CROSS JOIN (SELECT vcname
FROM orahrsamplecore.athobjectinstance
WHERE compliance_status = 1
AND ( (in_start_date IS NULL
OR (dtcompreissue
BETWEEN in_start_date
AND in_end_date
)))) LEFT OUTER JOIN COMPTRACKLOG c ON c.emp_id =
employee_id
AND c.plan_name =
vcname
WHERE c.emp_id IS NULL
AND ( ( (in_emp_id IS NULL)
OR ( in_emp_id IS NOT NULL
AND NOT EXISTS (
SELECT 1
FROM COMPTRACKLOG
WHERE plan_name = vcname
AND c.emp_id = in_emp_id )
AND ( (in_start_date IS NULL)
OR ( (in_start_date IS NOT NULL)
AND c.end_date BETWEEN in_start_date AND in_end_date
ORDER BY c.emp_id, c.plan_name ASC;
END;
/Hi,
We have an application which supports both Oracle 9i and Oracle 10g dbs, recently we added a new procedure to get a report from the applications statistics schema, the procedure uses two other schemas also to get the report and uses a query which does not use any Oracle specific feature (pure ANSI SQL), it compiled successfully on Oracle 10g but gives the following error on 9i db
SQL> show err
Errors for PROCEDURE SPGETNONCOMPLOGBASEDONEMP:
LINE/COL ERROR
22/8 PL/SQL: SQL Statement ignored
31/37 PL/SQL: ORA-00907: missing right parenthesis
the 9i version
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
10g version
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
If any body knows the soln, please help
Thanks in advance
Gibs
Procedure
CREATE OR REPLACE PROCEDURE Spgetnoncomplogbasedonemp (
in_emp_id IN VARCHAR,
in_start_date IN DATE,
in_end_date IN DATE,
non_complog OUT Types.ref_cursor
IS
BEGIN
OPEN non_complog
FOR
SELECT end_date AS end_date, employee_id AS emp_id, NAME AS emp_name,
vcname AS plan_name, start_date, nid AS nid
FROM (SELECT *
FROM ((SELECT employee_id, NAME
FROM hrsample_bridge.ath_employee
WHERE ( (in_emp_id IS NULL AND 1 = 1)
OR (in_emp_id IS NOT NULL
AND employee_id = in_emp_id
)) CROSS JOIN (SELECT vcname
FROM orahrsamplecore.athobjectinstance
WHERE compliance_status = 1
AND ( (in_start_date IS NULL
OR (dtcompreissue
BETWEEN in_start_date
AND in_end_date
)))) LEFT OUTER JOIN COMPTRACKLOG c ON c.emp_id =
employee_id
AND c.plan_name =
vcname
WHERE c.emp_id IS NULL
AND ( ( (in_emp_id IS NULL)
OR ( in_emp_id IS NOT NULL
AND NOT EXISTS (
SELECT 1
FROM COMPTRACKLOG
WHERE plan_name = vcname
AND c.emp_id = in_emp_id )
AND ( (in_start_date IS NULL)
OR ( (in_start_date IS NOT NULL)
AND c.end_date BETWEEN in_start_date AND in_end_date
ORDER BY c.emp_id, c.plan_name ASC;
END;
/ -
Question regarding Oracle and Linux on VMware
Hello,
I carefuly read the paper on Oracle and Linux on Your Own VMware and I'm missing a point.
The paper explains how to start a cluster on a single host in a single Linux VM on VMware.
So, there are 2 instances of Oracle 10g DB on the same Linux VM inside VMware. What does allow that?
Is it possible to run 2 instances on any (single) Linux box, or is VMware required? If VMware is not required, why this complication in that paper? If VMware is required, what does it bring that make running 2 cluster instances on the same host possible?
Many thanks for your help.userLynx wrote:
I have an oracle database (10.2) and I have a query that needs to compare data on the Oracle database to data on a MS SQL server DB. I'm using a DB Link between the two databases.
How would I compare the date fields?
I have a table that has a date as one of the fields and I need to restrict the records where the date is equal to the date on SQL, however the formats are different:
My query is as follows:
SELECT mkt_css_name,
pmv_rqst_corp_id,
pmv_rqst_source,
'G',
pmv_css_acct_no,
eq.start_date
FROM power_move@cmdt,
enroll_que@tcis eq,
marketer@cmdt
WHERE eq.css_account_number = pmv_css_acct_no
AND eq.requestor_type = 'P'
AND eq.status IN ('A','P','G','S')
AND eq.marketer_id = mkt_seq_no
AND pmv_service_type IN ('G','D')
And Pmv_Gas_Mktr_No = Eq.Marketer_Id
AND pmv_received_timestamp= eq.enroll_date ;
The problem is that the date is stored in Oracle in the following format: DD-MON-YYYY and in SQL as 'YYYY-DD-MM HH:MI:SSSSSS'
for example: Data in Oracle would be 27-JAN-2012 and in SQL as 2012-01-27 00:00:00.000
I get an error when I compile.
How do you reconcile the formats when the syntax is different between databases?
Thanks, SeanDATE datatypes do NOT have any "format"
DATE datatype is stored in internal binary notation.
use TO_CHAR to display, present & compare the DATE datatypes
Maybe you are looking for
-
IPhone won't Stay connected to Wifi, please help
i will connect to wifi, and everything will be ok when im on the phone. but when i lock it and set it down for awhile then go to unlock it the 3G is there and not the wifi symbol. i am wanting to know why that is. it hasn't done it before until now.
-
BI 4.1 installation in Red hat Linux 6.5
Hi Experts, we are planning to have one cluster environment in Red hat Linux 6.5. 1) Two nodes in cluster ( two red hat Linux 6.5 servers) 2) 1 server with Websphere as a web application server. From the last two years i am completely working on wind
-
ADF Not Working HP Officejet 7610
When trying to scan or copy multiple pages it only signals the glass to copy or scan. Went through all troubleshooting found here http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01728503&tmp_task=solveCategory&cc=id&dlc=en&lc... It does the make
-
Can we force JOptionPane to show all possible selections?
Hey all, I'm trying to create a JOptionPane which will allow multiple selections. Not much of a problem. String[] options = { "1", "2", "3" }; String selectedValue = (String)JOptionPane.showInputDialog(null, "Message", "Title", JOptionPane.OK_CANCEL_
-
Disable password for privileged Exec mode via Telnet
I've looked around for an answer for this specific issue but haven't been able to find one yet. Hoping this is easy and someone can point me in the right direction. When logging into a 2950 switch via Telnet, I'm prompted for a password when attemp