SFTP using PL/SQL [message #650920] |
Fri, 06 May 2016 10:21  |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
Hi to all,
How can I execute sftp file transfer directly from the oracle database using pl/sql?
Any assistance will be helpful.
Thanks,
Lucky A
|
|
|
|
Re: SFTP using PL/SQL [message #650922 is a reply to message #650920] |
Fri, 06 May 2016 10:51   |
John Watson
Messages: 8966 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Note that sftp is nothing to do with FTP. It is ssh.
What do you want to do? Copy files? Rather than writing (or finding) a whole heap of code to use ssh from PL/SQL, you might be better off using the Scheduler to create an external script job. Much simpler.
|
|
|
|
|
Re: SFTP using PL/SQL [message #651437 is a reply to message #650920] |
Tue, 17 May 2016 21:56   |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
Hi Folks,
Please, this is an update to my previous post. The requirement has changed and has gotten challenging. The client has daily XML files transferred to the SFTP server - thousands of XML files everyday. The client wants the ability to read the files from the SFTP server directly into the Oracle database using PL/SQL. How can this task be accomplished.
Thanks,
Lucky
|
|
|
|
Re: SFTP using PL/SQL [message #651443 is a reply to message #651438] |
Wed, 18 May 2016 01:04   |
John Watson
Messages: 8966 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I've already suggested that you use the Scheduler to launch your scp (or sftp, as you insist using that interface to ssh) commands. Did you try that?
|
|
|
Re: SFTP using PL/SQL [message #651480 is a reply to message #651443] |
Wed, 18 May 2016 22:35   |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
I am researching the most viable option as the client doesn't want to make use of external table. I am also considering using third party tools...
|
|
|
|
|
Re: SFTP using PL/SQL [message #651536 is a reply to message #651516] |
Thu, 19 May 2016 14:23   |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
1) What is the objection to external tables? Why can't it be considered?
Because of the share volume of the files.
2) What's the the business requirements?
Want to load the data.
3) Where do these files come from - third party? Multiple third parties? Or from within?
From a third party.
4) How does one of these files relate to another?
All are related.
5) And very important: What is the desired end-state of the data in these files?
Take the data and load it into a LOB column of a table within an Oracle database and extrapolate the data.
Thanks to all for your guidance and assistance.
Lucky
|
|
|
|
Re: SFTP using PL/SQL [message #651538 is a reply to message #651536] |
Thu, 19 May 2016 14:44   |
John Watson
Messages: 8966 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Quote:1) What is the objection to external tables? Why can't it be considered?
Because of the share volume of the files. The volume of files would not present any problem that I can see. You may well have a better DBA than me, I would be interested in knowing his reasoning.
--
John Watson
Oracle Certified Master DBA
|
|
|
|
Re: SFTP using PL/SQL [message #651664 is a reply to message #651582] |
Sun, 22 May 2016 23:38   |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
Based on your inputs and suggestions, it's apparent that what the client wants is not easily doable, if at all. You guys have demonstrated that you are experienced and knowledgeable DBAs. If I go by the strict requirements from the client, I would pluck out my full head of hair before the task is completed.
Please, if you have any code that is written with Oracle in mind that will pull files (thousands per day) from an SFTP server (pushed to the client from 3rd party's), that will be a good start. External table is also an inclusive option...
Thank you,
Lucky
|
|
|
Re: SFTP using PL/SQL [message #651668 is a reply to message #651443] |
Mon, 23 May 2016 01:10   |
John Watson
Messages: 8966 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
John Watson wrote on Wed, 18 May 2016 07:04I've already suggested that you use the Scheduler to launch your scp (or sftp, as you insist using that interface to ssh) commands. Did you try that?
|
|
|
|
Re: SFTP using PL/SQL [message #651768 is a reply to message #651698] |
Tue, 24 May 2016 21:47   |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
Hi All,
To answer the concern raised and to provide feedback:
The client uses RD Web Access to copy the XML files from a third party server to a local SFTP server.
I was asked on this forum why External Table is not an option. Because the client thinks if the use of External table is considered, then they either have to join all of the XML files or create thousands of external tables. Remember they have thousands of XML files been transferred daily. Also, do I know the content of the files or how they are related to one another? The answer at this preliminary stage, is no.
Using DBMS_Scheduler to launch scp creates security risk to the database - using the database to call an external procedure violates STIG requirements. The database is put at risk to unauthorized access to the procedure from outside of the database process...
The objective of the client is to be able to read the data of the XML files directly from the SFTP server, parse it and then load it into the database. They want to bypass the step of getting the XML files to a local server.
I came to this forum for guidance and to find out the possibility of achieving the client's objective - to find out whether the means of achieving this objective exist and how it can be achieved. After hearing your expert opinions and directives, it seems that the client's objective is implausible or if remotely possible, it will be time consuming and convoluted at best to achieve.
To beg the question; I am looking at what's plausible to get the XML data from the SFTP server onto the database. If it means pulling, on a daily basis, thousands of files unto a local machine and using External Table, then I'm open to such solution. But please give me example(s) on how to achieve what you suggest...
Thanks and best regards,
Lucky
|
|
|
|
Re: SFTP using PL/SQL [message #651885 is a reply to message #651774] |
Thu, 26 May 2016 13:47  |
Lucky A
Messages: 68 Registered: October 2007
|
Member |
|
|
With all of your inputs and having a clearer understanding of what the client wants and presenting the various options attainable, the best method is to use JSch API which is Java based to accomplish the task.
Thank you,
Lucky
|
|
|