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

Similar Messages

  • 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

  • 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..;)

  • 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 &

  • Arguments in function passed through shell script

    HI all,
    I have a shell script test.sh
    it contains the following
    A=$1
    B=$2
    C=$3
    D=$4
    sqlplus usr/pwd<<eof
    a varchar2(10);
    b varchar2(10);
    c date;
    d date;
    a:='$A';
    b:='$B';
    c:='$C';
    d:='$D';
    func(a,b,c,d(;
    eof
    func() defbn
    func(name varchar2,trc varchar2,dt1 date,dt2 date)
    end;
    When icall test.sh as
    ./test.sh xyz 0100 01-NOV-09 06-NOV-09
    It appneds dt1 with 06-NOV-09 and dt2 remains null.
    It should be like:
    dt1=01-NOV-09
    dt2=06-NOV-09
    inside function
    Thanks

    Are you sure there is no problem in SQL function *"func"* that you are calling?
    You haven't pasted the function code so can't really comment on that.
    Below test shows that it works really fine:
    kallo:DZHLHFC1> cat 1.ksh
    A=$1
    B=$2
    C=$3
    D=$4
    echo "Shell vars = $A,$B,$C,$D"
    sqlplus -s username/pass<<eof
    alter session set nls_date_format='DD-MON-YY';
    set serverout on size 10000
    declare
    a varchar2(10);
    b varchar2(10);
    c date;
    d date;
    begin
    a:='$A';
    b:='$B';
    c:='$C';
    d:='$D';
    dbms_output.put_line('');
    dbms_output.put_line('SQL vars =' ||a||',' ||b||',' ||c||',' ||d);
    end;
    eof
    kallo:DZHLHFC1> ./1.ksh xyz 0100 01-NOV-09 06-NOV-09
    Shell vars = xyz,0100,01-NOV-09,06-NOV-09
    Session altered.
    SQL vars =xyz,0100,01-NOV-09,06-NOV-09
    PL/SQL procedure successfully completed.

  • Help regarding issue connecting to DB through shell script

    Hi,
    I have a Oracle 8.1.7 Database running on a AIX box. I am trying to truncate one table from within the shell script using here documents.
    Code section of my script -
    succ=`sqlplus -s ${USR} << EOF
    whenever sqlerror exit sql.sqlcode
    set feedback on
    Truncate table abc.xyz;
    exit;
    EOF`
    USR has been set as /. We have ops$ users in the database. So when I run this script using my id it runs fine. The problem seems to be coming when this runs as part of the batch job which runs under a different osuser. The error is -
    + + sqlplus -s /
    + 0< /tmp/sh164108.8
    succ=ERROR:
    ORA-01017: invalid username/password; logon denied
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}] | [INTERNAL]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    I am not sure what is going wrong. I have tried and googled for the issue and it seems that the issue is coming because the osuser under which the job runs may not be setup to use "sqlplus -s /" ? Any help appreciated.
    Regards,
    Saurabh

    This is the forum for Oracle's SQL Developer tool, not for general SQL and PL/SQL questions.Questions like this will get a better response in the PL/SQL forum.
    Having said that, it looks likely that the other user doesn't have an ops$ account.

  • 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" ?

  • Send mail through shell scripts

    hi,
    I am working in oracle9i and solaris 5.8 . i need to send a mail using the following codes
    ORACLE_HOME=/oracle/u01/app/oracle/product/9.2.0; export ORACLE_HOME
    ORACLE_SID=oracle; export ORACLE_SID
    PATH=/oracle/u01/app/oracle/product/9.2.0/bin:/usr/bin:; export PATH
    MAIL=/var/mail/dbacoe; export MAIL
    BASE_SUPPORT_EMAIL=mail [email protected]
    DATA_DIR=/oracle/sunora/
    SHIP_IND=Lynn_FMLA.csv
    uuencode $DATA_DIR/Lynn_FMLA.csv 'Lynn_FMLA.csv' | mailx -s 'Shipping Ind' $BASE_SUPPORT_EMAIL
    me run this file in script.sh and i also give the full permission.. chmod 777 script.sh
    after running this script i didnt get any error...
    but in the mean time i didnt receive any mail...
    please expalin me how to send a mil along with attachments using the scripts above...
    Regs...

    try -
    uuencode $DATA_DIR/Lynn_FMLA.csv Lynn_FMLA.csv | mailx -s 'Shipping Ind' $BASE_SUPPORT_EMAIL
    No single quote around second file name.
    rgds

  • Intermittent error while trying to connect oracle through shell script

    Hi All,
    I am getting following error Intermittently while connecting to oracle database.
    ERROR:
    ORA-03113: end-of-file on communication channel
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0306: Invalid option.
    Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
    where <logon> ::= <username>[<password>][@<connect_string>] | /
    SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
    Please help.
    Thanks in advance.

    I cannot give this file D:\oracle\ora92\network\trace\cli_3932_1.trc (sorry for that) No problem I understant that you don't want post sensitive information.
    You may contact Oracle Support Services (raise a SR along with generated trace files) for problem resolution.
    TNS-12547: TNS:lost contact
    TNS-00517: Lost contact12547, 00000, "TNS:lost contact"
    // *Cause: Partner has unexpectedly gone away, usually during process
    // startup.
    // *Action: Investigate partner application for abnormal termination. On an
    // Interchange, this can happen if the machine is overloaded.
    00517, 00000, "Lost contact"
    // *Cause: Partner has unexpectedly gone away.
    // *Action: Investigate partner application for abnormal termination.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Shell script for mail conf

    Hi all,
    DB oracle 10g
    solaris,
    It is new env ....we are not having grid configuration ....
    Please any one provide to me a script for monitoring threshold limits like >90% critcal alert ....I have written a sql script but I am unable write shell script .......my requirement is I want to call sql script (tbsthershold.sql) these alerts are configure to mail to dba group through shell script when ever tablespace reaches thershold....
    please help me out if any one having any shell scripts.... for that
    thanks,
    kk

    Hi all,
    DB oracle 10g
    solaris,
    It is new env ....we are not having grid configuration ....
    Please any one provide to me a script for monitoring threshold limits like >90% critcal alert ....I have written a sql script but I am unable write shell script .......my requirement is I want to call sql script (tbsthershold.sql) these alerts are configure to mail to dba group through shell script when ever tablespace reaches thershold....
    please help me out if any one having any shell scripts.... for that
    thanks,
    kk

  • Running Plsql procedure using shell script

    Dear All,
    Dear All,
    I have to generate reports weekly by using a plsql procedure.
    For Exapmle : My Proc name is Weekly_report(i number).
    Here i is the argument for which i need to run the proc 7 times as follows
    exec weekly_report(1)
    exec weekly_report(2)
    exec weekly_report(3)
    exec weekly_report(4)
    exec weekly_report(5)
    exec weekly_report(6)
    exec weekly_report(7)
    I need to run them parallely at a time so that time taken will be less. Is there any way doing this through shell script.
    Thanks in asdvance.

    damorgan wrote:
    I can't think of anything in the Oracle world left in the dustbin of history I miss less than shell scripts.
    Why work in another language, why work in a tool that is non-portable, why have to deal with SysAdmins when dbms_scheduler is many times more capable?
    Definitely DBMS_SCHEDULER. Shell scripting is obsolete with perhaps only a few very rare exceptions.+1: shell scripts suck.
    DBMS_Scheduler allows you to setup the report procedures as programs that are executed at the same time in a single job (as steps in a scheduler chain). you can also setup email confirmation based on them successfully completing. All good stuff and not difficult to do.

Maybe you are looking for