Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

about "session cursor cache hits" and "parse count(total)" statistics

872581Nov 15 2012 — edited Dec 7 2012
Hi, all.

The database is 11.2.0.3 on a linux.

The following is from v$sysstat.
select * from v$sysstat
where name in
('session cursor cache hits',
'parse count (total)',
'parse count (hard)')

session cursor cache hits : 346468246
parse count (total) :        184787866
parse count (hard) :          35299555
---------------------

* "session cursor cache hits" definition :

Number of hits in the session cursor cache. A hit means that the SQL statement did not have to be reparsed. Subtract this statistic from "parse count (total)" to determine the real number of parses that occurred.

which means that (parse count(total) - session cursor cache hits = real number of parses.

-------------------

The value of "session cursor cache hits" is bigger than "parse count (total)".

How does it possibile?

Thanks in advance.

Best Regards.

Comments

Prodipto Tokder

Can you check UTL_FILE.FOPEN it is able to read from a file... but check if it will work in your case or not ... also using SQL Loader program and Control file approach should also work ..

Sergei Krasnoslobodtsev

You have some  possibile of way of solutions.

For an example :

1) use  utl_file | external tables  and  as transport layer ( external  jobs/shell script  ,  NFS...)

2) use a ready-made/external tools   solution,  as ODI ,SQLLoder, and etc...

P.S. on java/pl_sql , ftp , sftp

N.B. But, you can write the simplest solution, because all information is  available.(documents,forums...) and  at internet many..many of pattern-blanks.

Anton Scheffer

Just google and you will a find a plsql package capable of doing FTP, for instance https://oracle-base.com/articles/misc/ftp-from-plsql

SFTP you can't find with google, you have to write it yourself, or use some java or external  solutions.

BluShadow

As Anton says, there's already people who have written FTP packages out there for PL/SQL.

Whilst the code you've posted is the right starting point, using UTL_TCP, there's a lot more involved to FTP than just opening a connection and trying to read data.  FTP requires a connection down which you send the commands, and then (typically) a further passive connection opened on the port the initial communication returns to you, down which you then read the data etc.

For full details of the protocol you'd need to implement yourself see: https://tools.ietf.org/html/rfc959

SFTP on the other hand is a completely different protocol and is far more complex, due to the nature of how it deals with secure transmissions.

e.g. https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13 is just one of the specifications for it...

You can see a more complete list given by the FileZilla team on their wiki site: https://wiki.filezilla-project.org/SFTP_specifications

3413742

Thanks for your reply. I tried this but it's not working showing TNS connection closed error

Anton Scheffer

If your "FTP-server" only serves the SFTP-protocol that might happen

3413742

Thanks for your reply. IF i use UTL_FILE.FOPEN it throws an error like follows:

ORA-29280: invalid directory path

ORA-06512: at "SYS.UTL_FILE", line 41

ORA-06512: at "SYS.UTL_FILE", line 478

ORA-06512: at line 25

3413742

So could you please help me with some other solution if possible ?

BEDE

Well, utl_file.fopen is to be used only for opening files that are in a filesystem in a directory accessible to user oracle. So, the first thing is to get the file to such a directory using the ftp package (or some other means - which I know not for I never did such). Only afterwards use ftp or select from external table that you have previously created.

3413742

Thank you very much for your reply. Could you please share the oracle pl sql script to copy csv file from SFTP server to Oracle Database local directory, if you have any ?

BluShadow

Have you actually read the previous replies?

BEDE

It's not actually PL/SQL code, but here's something you may have found yourself:

https://dbashavefeelingstoo.wordpress.com/2011/07/22/sftp-with-plsql/

user11440683

Hi,

writing plsql is typically like eating an elephant, you don't expect to solve the entire thing in one sitting, you need to split the problems up into its discrete steps.

In your case there is; -

1. Can I connect to the remote site sftp

2. Does Oracle have rights to read the file

3. Can utl_file read read the file

Only when each step is complete do you move on to the next problem.

You may find that on 3 - utl_file can never have rights because of the sites policies, in which case then you might consider

1. Can I connect to the remote site using sftp

2. Does Oracle have rights to sftp the file to a local directory

3. sftp get the file

4. Can utl_file read the file locally

Billy Verreynne

Robert Angel wrote:

writing plsql is typically like eating an elephant, you don't expect to solve the entire thing in one sitting, you need to split the problems up into its discrete steps.

Not a fair statement about PL/SQL the language, as the size of the meal is determined by the complexity of the problem - and not by the language.

Eating an elephant in any other language, e.g. C or Java, requires the exact same approach of breaking the large complex problem into smaller and simpler problems.

user11440683

Agreed.

I was not comparing pl/sql itself to an elephant, I was just trying to get the end user to move beyond 'X' did not work, when 'X' is more like 'A' worked, 'B' worked, 'C' failed....

No slight intended or implied by the elephant analogy.

Billy Verreynne

Robert Angel wrote:

I was not comparing pl/sql itself to an elephant.

I should hope not. PL/SQL is no elephant.

It is more like a squirrel.

But not an ordinary squirrel.

More like..

images?q=tbn:ANd9GcRTtRN7LnEn4c1Eo80lUYVfCPXflDMnKcuibLmFHjvXKfx7Jot_

user11440683

lol.

I would not touch his nuts....

1 - 17
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 4 2013
Added on Nov 15 2012
3 comments
1,294 views