LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2017, 07:48 AM   #1
shirin1900
LQ Newbie
 
Registered: Apr 2017
Posts: 3

Rep: Reputation: Disabled
Talking Script for insert a lot of files in oracle database.


Hello everybody,
I have a directory with a lot of log files, i want to insert the logs (*.log and *.trt.log) in database. log files are like this:

11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)

11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter

11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement

11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)

I need a script that select specific files (.log and .trt_.log) and insert them into a table!!!
Any suggestion!!!
thanks for your help...
 
Old 04-25-2017, 07:55 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Hi shirin,

Welcome to LQ.

You question is kind of wide open. Oracle has a plethora of tools to import data into a table. Do you want to put the entire log file in a field, have that field be the entire record, and the table to be single column?
 
1 members found this post helpful.
Old 04-26-2017, 01:59 AM   #3
shirin1900
LQ Newbie
 
Registered: Apr 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
hi AwesomeMachine,
thanks for your reply, i want a table with 5 column, (date_time,num_process,shell,event,comment), and i want insert a lot of file with same structure one after another in the table, something like this(example with two file, but i have more than 1000 file like this):

date_time num_process shell event comment
11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)

11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter

11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement

11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)

12/05/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)

12/05/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter

12/05/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement

12/05/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)

did i answer your question?
 
Old 04-26-2017, 02:00 AM   #4
shirin1900
LQ Newbie
 
Registered: Apr 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
Hi shirin,

Welcome to LQ.

You question is kind of wide open. Oracle has a plethora of tools to import data into a table. Do you want to put the entire log file in a field, have that field be the entire record, and the table to be single column?
hi AwesomeMachine,
thanks for your reply, i want a table with 5 column, (date_time,num_process,shell,event,comment), and i want insert a lot of file with same structure one after another in the table, something like this(example with two file, but i have more than 1000 file like this):

date_time num_process shell event comment
11/04/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)

11/04/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter

11/04/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement

11/04/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)

12/05/2017 12:00:02 11959 trt_ret_tp START Chargement des fichiers HREREC (trt_ret_tp)

12/05/2017 12:00:02 11959 trt_ret_tp Aucun fichier ▒ traiter

12/05/2017 12:00:02 11959 trt_ret_tp Mise a jour de la date de dernier recouvrement

12/05/2017 12:02:42 11959 trt_ret_tp STOP Chargement des fichiers HREREC (trt_ret_tp)

did i answer your question?
 
Old 04-26-2017, 06:28 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,997
Blog Entries: 13

Rep: Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445
Quote:
Originally Posted by shirin1900 View Post
Hello everybody,
I need a script that select specific files (.log and .trt_.log) and insert them into a table!!!
Any suggestion!!!
Hi shirin and welcome to LQ.

Please review the Site FAQ for information related to how to ask an effective question as well as how to prepare the information for your question.

Please note a few things here:
  1. You've stated your problem, updated it with additional information, and you've asked for someone to write code for you in the form of a script
  2. Members at LQ are volunteers, thus they are not paid support.
  3. The LQ site is intended to help you to learn, with the additional, and reasonable point that, it is better to have you be educated on the tools and talents necessary to complete your project. And thus your capabilities are enhanced, and perhaps in the future you can offer some of your expertise to other members in need of assistance. This is a main point of the LQ site.
  4. Therefore what to do here is to indicate what language of script you wished to code this within, and at least attempt your first script, of any nature. Other members need to know what script language you prefer, and also should get an understanding approximately what level of knowledge you have with that script language.
  5. Another part of this is to devise and post your steps to solve your problem. Citing examples and stating what you wish the outcome to be is a good starting idea, however it is best to look at general data which you can expect and write a full description of what you intend to accomplish, citing all possible input criteria, and then listing all possible outcomes you expect from that. From there you can write pseudocode which is a plain language description of the script actions you intend to fulfill.
  6. From this point you can script very effectively, and it does go back to the earlier information where you need to pick a script language and show some effort towards your goal.
  7. I'm quite sure that if you follow these guidelines and illustrate a very clear, organized description of your problem and what you feel the solution should be, as well as your attempts at a script, that LQ members will have very many suggestions to aid you with completing your project.
Best Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to ingest a csv, validate data and insert into Oracle md888 Programming 4 10-01-2015 07:59 PM
LXer: Amazon: DROP DATABASE Oracle; INSERT our new fast cheap MySQL clone LXer Syndicated Linux News 0 11-13-2014 11:11 AM
Shell Script to insert value in database deepu_linux Programming 14 04-25-2013 12:07 PM
Unix script for Oracle database rparthas Programming 4 04-07-2011 05:55 AM
Shell Script: want to insert values in database when update script runs ring Programming 2 10-25-2007 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration