Automatic import process through shell script

Hi all,
oracle 10.2.0
RHEL 4
I have many export dump files in one directory exported from different schemas and different databases.
I have to import them in different schemas in a single database.Ofcourse, I can manually import each file but to avod tedious work,i want to automate the task.I want linux do it for me.I wrote the below script but it works only for the first time.
USR=system
PWD=******
for $i in `ls *.dmp`;do
imp $USR/$PWD file=$i fromuser=test touser=`basename` $i
done
What else should i include in the script os that automatically oracle navigates through every dump file and import the database in the respective schema?
Thanks

Before trying a solution I have to understand something more...
Are your dump file names <schema name>.dmp, e.g. user1.dmp, user2.dmp and so on, and you want to import into those schemas ? If so, is "fromuser=test" correct ? If not so, please clarify.
And why "basename" ?

Similar Messages

  • Random SP2 error when starting oracle process through SHELL script

    Hi All,
    I am trying to process data in n-Number of tables through a package. The package is called through a shell script to create start data processing. All calls to the package are in a sql script which is basically exec calls-
    exec package.process ('T1','some param');
    exec package.process ('T1','some param');
    exec package.process ('T..n','some param');
    I have a shell script which I use to execute commands from the sql script. There is a reason behind using shell script. For some strange reason, I keep on getting -
    ERROR: logon denied - check for valid user with valid privileges
    SP2-0640: Not connected
    SP2-0641: "EXECUTE" requires connection to server
    SP2-0640: Not connected
    for some EXEC calls. Problem is, errors are generated at random. So in one run, I get error for T10,T11 and then in next run I might get for some other tables.
    However, when I am running the sql script from the sql prompt, all calls to the package are executed without any problem.
    This makes me think, it is something to do with the way database connection being initiated through UNIX.
    Has anyone faced similar issue? Your help/gudence is much appreciated.
    DB: Oracle 10.2.0.5
    OS: SUN Solaris 10
    Thanks in advance.

    Login credentials are provided inside the shell script.
    I did put a sleep(10) after EOF but no help. As mentioned if I run script file from sql promt, it runs without any hiccup. So it is the connection through the UNIX that is causing issue.
    As pointed out by Sybrand, I agree that it does not make a sense to connect and commit after every sql statement. So decided to change the shell script and so far, the result from my initial tests on a sample data is quite encouraging. Hopefully I will have a solution.
    But it will be nice to know why SHELL is doing what it is doing!!
    Legacy prog are sometime big time eye-openers..;)

  • Importing thru a shell script

    I want to import thru a shell script..in oracle 10g rel 2. on RHEL4
    Is there any way thru which i can mimic the file open dialog box in windows in Linux here.
    So that i can call the file open dialog and browse for the particular file to import.
    which will be concatenated in a string in ...imp command in shell script..
    Else how do i input the file name (to import) in a shell script from the user..

    I want to import thru a shell script..in oracle 10g
    rel 2. on RHEL4
    Is there any way thru which i can mimic the file open
    dialog box in windows in Linux here.
    So that i can call the file open dialog and browse
    for the particular file to import.
    which will be concatenated in a string in ...imp
    command in shell script..You would just to use the database control which comes with 10g, and has all this functionality,and can generate a script on the fly.
    >
    Else how do i input the file name (to import) in a
    shell script from the user..In what scripting language? This rather not an Oracle question but an Unix question. You would just need to type
    man read
    on the command prompt, and you should be set.
    Sybrand Bakker
    Senior Oracle DBA

  • Creating user account and setting password in Solaris9 through shell script

    I need to create and set password of user through shell scripts.
    User can be added successfully through "useradd" command but password cant be set through "passwd" command in script.
    Is there any other alternative for the same.

    Hi,
    Did you get the answere for this ? I have the same problem as urs , like I want to creat the users by using useradd and want to hardcode there password in one script.
    But I cant use expect utility which would have made my work easier

  • Reading contents of asm through shell script

    How to read contents of asm through shell script?
    Please paste one small example also.
    Thanks
    Bala

    Hello Bala,
    The ASM contents is not visible from the operating system or its utilities. Only visible to database instances, RMAN, and other Oracle-supplied tools.
    Please see http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/glossary.htm#sthref4105
    Regards,
    Rodrigo Mufalani
    http://mufalani.blogspot.com

  • Calling sql through shell script

    How do i call a sql file through shell script in unix ?

    Rahul India wrote:
    export ORACLE_HOME=$ORACLE_BASE/product/10g
    cd $ORACLE_HOME
    set `sqlplus -s <SCHEMA_NAME>/<SCHEMA_PASSWORD> <<EOF
    @r_100.sql
    exit;   
    EOF`THIS SCRIPT IS OK?You'll also need to set ORACLE_SID
    And I don't know why everyone is putting the reference to sqlplus inside a "set" valuation, nor why they are putting the reference to the script in a redirected input stream. All you need is
    sqlplus -s user/password  @r_100.sqlAnd to insure the invironment is correctly set:
    export ORACLE_SID=whatever
    export ORAENV_ASK=NO
    . oraenv
    unset ORAENV_ASK=NO
    sqlplus -s user/password  @r_100.sql

  • How to execute sql-queries through shell scripting in linux?

    How to execute sql-queries through shell scripting in linux?

    http://www.oracle.com/technology/pub/articles/saternos_scripting.html
    Two simple examples:
    #!/usr/bin/env bash
    set_orafra () {
       orafra=`echo 'set heading off
       select name from v$recovery_file_dest;
       exit' | sqlplus -s / as sysdba`
    set_orafra
    echo $orafra
    #!/usr/bin/env bash
    export ORACLE_SID=instance_name
    export ORACLE_HOME=/path_to_oracle_home_directory
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=/$ORACLE_HOME/bin/$PATH
    $ORACLE_HOME/bin/sqlplus -s <<EOF
    connect scott/tiger@my_instance_name
    INSERT INTO table VALUES (sysdate);
    exit
    EOFEdited by: Markus Waldorf on Sep 17, 2010 12:19 AM

  • Import through Shell Scripts

    Hi Friends ,
         I have run shell scripts for importing from my local system through TELNET It was running fine on the server.But now I need to import the same dump file into my local database.The ORACLE_SID refering to the database in the server is same as the database in my local system.
    So how to tell through the scripts that I need to connect to my local system.
    If anyone could explain this it could be of great help.
    Regards
    Marlon.

    Hi
    It depends on how your script is taken care on syntax of import/export. I can tell you exaxtly if you can past me your import/export shell script. However for your knowlege, you can specify ORACLE_SID with export/import with following ways
    1) exp user/pass@ORACLE_SID file=<file_name> log=<logfile>
    imp user/password@ORACLE_SID file=<dumpfile> fromuser=<username> touser=username
    if you are at same box where oracle server is intalled then you need not to mention oracle_SID but make sure that ORACLES_SID is configured in environment variable.
    All the best
    Alok

  • Automatic Payment Process through IDOC and Receive Message Acknowledgement and BANST file format

    Hi Experts,
    We are implementing payment process to our client through Idoc.
    Normally the process will go like below. Once Payment Initiated --> IDoc will generate --> This Idoc process through PI system and send to Bank.--> Once payment data received bank --> it will generate acknowledgement receipt and Bansta file and send it PI system --> This PI system system again send it --> SAP system. Here I want to know the required configuration from PI system to SAP system while receiving acknowledgement and Bansta file. And let me know if u guys have steps...
    Thanks,
    Raviram

    Hi,
    >is possible using the fileadapter to read this file and with pass it throug PI to IDOC receiver adapter without any mapping?
    yes
    >In that case what should the Message Type we are using in the file-sender adapter look like?
    If you have no mapping it doesnt matter, the message type will not be validated during runtime. You can take the IDoc type imported from the SAP system
    Regards,
    Udo

  • Calling sql script through shell script

    Hi All
    I am trying to run one shell script it will execute the sql file which is in UNIX box. Problem here i am facing is
    when i submit the program through front end it taking time to execute and the status in running even for hours and hours. Manually i am terminating the concurrent program.
    But when same shell script when i tried to execute in putty it generating the output with in seconds
    Can you help what may be the error? I used the syntax like this
    Can you help what may be the error? need to change any syntax
    Thanks
    Prem Raj Dasari
    Edited by: Sravprem on Sep 20, 2012 12:43 AM

    Pl post details of OS, database and EBS versions. In your shell script, insert this line as the first line
    set -xthen run the concurrent program and paste the contents of the log of the concurrent program here
    HTH
    Srini

  • How to Call Multiple Sessions through Shell scripting

    Dear Members,
    I have a scenario where I load data into target table from 20 different source tables.
    For this I have written three procedures where there exists an bulk insert executed on a same table in every procedure. Now I have to call these procedures simultaneously so that
    all three bulk loads are executed at once in different sessions.
    For this I have to write a shell script which opens 3 different sessions and execute all these packages at once.
    Can you guide me through.

    When you call sqlplus in your shell script, put a & at the end so that it runs the SQL scripts in the background. For instance:
    #!/bin/bash
    ...oracle home stuff
    $ORACLE_HOME/bin/sqlplus user/pass @script.sql &
    $ORACLE_HOME/bin/sqlplus user/pass @script2.sql &
    $ORACLE_HOME/bin/sqlplus user/pass @script3.sql &

  • BPEL processes and shell scripts

    Hi,
    I wish to invoke BPEL processes from a shell script so that it could be regulated from a typical Control-M environment. Can anybody let me know if its possible...?
    Regards,
    Roy

    Some kind-of Java interface would just be fantastic. Is there anything like that...?
    Well, I intend to execute some batch processes which would be scheduled and administered by Control-M; If i opt to use ws-clients within the same then auditing and monitering the status of my executing process would be an obvious overhead that i might need to hard wire in my implementation. Therefore, should it be possible to execute a BPEL process from a Java like interface, which i'd then wrap in a shell script; then Control-M on itself would be capable of monitoring the process status and all other performance parameters around the same.
    Suresh - Thanks for your suggestion, will definately post the message on those groups as well.

  • Fle import the unix shell script

    hi all
    I want to develop unix shell script & cron job to read ftp file and call an oracle procedure to import the data in an oracle database
    can any one tell me how to go about it ?
    also does any one have some documentation related to the topic
    plzzz help me
    mandar

    Hi,
    I want to develop unix shell script & cron job to read ftp file and call
    an oracle procedure to import the data in an oracle databaseYou can
    1/ use ftp to get the file to Oracle Instance host then call a Proc/Package that'll parse the file.
    2/ write/find on google a FTP package using UTL_TCP then create a procedure using the package to open the ftp file and parse it.
    You don't give much details on what the actual aim is, si I can't be more specific.
    can any one tell me how to go about it ?There might be other possibilities, describe what you want to achieve globally and we'll give you more advices.
    also does any one have some documentation related to the topicTahiti: http://tahiti.oracle.com
    maybe AskTom: http://asktom.oracle.com
    Regards,
    Yoann.

  • Automatic Database Backup using Shell script

    Hi,
    Can anybody share a sample shell script to take automatict backup of database.So, that It help preparing the same in our enviroment.
    Thanks,
    Sami

    Hi,
    Thanks for your inputs. But here are the details
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
    Platform 86_64 linux.-redhat-release-4ES-7.
    Can you please suggest taking automatic backup as a sample script. so that a demo can be created and tested in development environment.
    --sami                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Automatic Payment Process through Schedule Manager

    Dear Experts,
    I am an infant in SAP..just started my foot steps by formally taking up a sap course from siemens. I would like to get a complete configuration details for the scheduling automatic payment process. The scenario I could think of is a weekly payment run for a company code at 7.30 pm..Please help.
    Thanks,
    Aspirant

    Hi,
    In FBZP you need to do the config. for the automatic payment.
    1All co codes:fill the paying co code.
    2)Paying co codes :give Min and Max amount for payment and form payment advise.
    3)Payment methods in country :In country creat the p.method
    eg: for cheque :pay method 'c',select outgoing payments,check and give document type for paymentand under apyment medium program 'rffous_c'
    4)payment methods in co code:give the same pay method (c)in your co code here and amt lmt and form for payment medium
    5)bank determination:give the bank details i.e crcy,paymethod,house bank,account id,bank sub account,available amts etc.
    6)house banks:give the detials of your bank account.
    there will be no schedule job for f110.
    Further you need to configure check lot,house banks for this.
    regards

Maybe you are looking for