Please provide me unix shell script (export and import of database schema)

please i am new in unix
\please give me sample unix shell script (export and import of database schema)

please i am new in unix
\please give me sample unix shell script (export and import of database schema)Instead of providing you the readymade unix shell script for your requirement, I will give you the hints to prepare the same at your own.
Create a file with .sh extension.
# Specify and set all required Environment variables.
ORACLE_HOME, PATH, NLS_LANG, etc.,
# Use the export command with all clauses
export scott/tiger@orcl file=scott.dmp log=scott_emp.log
# Compress it.
compress scott.dmp
Refer any unix/linux documents for scripting basics.
http://www.bijoos.com/ora7/oracle_unix.htm
Regards,
Sabdar Syed.

Similar Messages

  • Export and import of a schema

    Hi all,
    I'm having some trouble doing a simply export than import of a schema (data + structure, tables, sequences, triggers, indexes) from 10g XE to a same version server on another machine.
    I follow different ways:
    1) Export from "script sql" both as file as sql commands. Trying to import I get this error:
    Not found
    The requested URL /apex/f was not found on this server2) (traduction from italy language sorry if it is not exact in english) Loading/Downloading data -> Download -> I tryed both file and xml format. In this case I must select one table a time... but only the structure is exported, no data... fortunately I have only 3 table to export, but if I got many tables?
    In short, which is the best practice to export schema with inside data from a server to another with same version??
    Thankyou

    get this message from command line:
    C:\Documents and Settings\user>expdp unime
    Export: Release 10.2.0.1.0 - Production on Giovedý, 26 Febbraio, 2009 12:48:08
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Password:
    Connesso a: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    ORA-39002: operazione non valida (operation not valid)
    ORA-39070: Impossibile aprire il file di log. (impossibile to open log file)
    ORA-39145: il parametro oggetto directory deve essere specificato e diverso da null (the directory object parameter must be specified and different from null)
    C:\Documents and Settings\user>get the same from sqlplus:
    C:\Documents and Settings\user>sqlplus
    SQL*Plus: Release 10.2.0.1.0 - Production on Gio Feb 26 12:41:48 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Immettere il nome utente: unime
    Immettere la password:
    Connesso a:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CONN sys/**** as SYSDBA
    Connesso.
    SQL> ALTER USER unime IDENTIFIED BY **** ACCOUNT UNLOCK;
    Utente modificato.
    SQL> GRANT CREATE ANY DIRECTORY TO unime;
    Concessione riuscita.
    SQL> CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';
    Creata directory.
    SQL> GRANT READ, WRITE ON DIRECTORY test_dir TO unime;
    Concessione riuscita.
    SQL> host expdp unime
    Export: Release 10.2.0.1.0 - Production on Giovedý, 26 Febbraio, 2009 12:44:40
    Copyright (c) 2003, 2005, Oracle.  All rights reserved.
    Password:
    Connesso a: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    ORA-39002: operazione non valida
    ORA-39070: Impossibile aprire il file di log.
    ORA-39145: il parametro oggetto directory deve essere specificato e diverso da null
    SQL> quit
    Disconnesso da Oracle Database 10g Express Edition Release 10.2.0.1.0 - ProductionEdited by: Silicio on 26-feb-2009 12.47

  • Export and import entire database

    hi.
    when I did export all database to a file , and then i import it to unix machine with oracle 8.1.7 , it didn't gave me error messages, and all user were created as well. in unix (or maby in oracle 8.1.7) i didn't have to create all the users, tablespaces and grants. the import did it all.
    when i did the same thing on NT with oracle 8.1.5, it gave me error messages that user does not exists. can i export all database , including users and tablespaces without create all these users one by one ?
    null

    Mehul Mehta wrote:
    Apologies for the delay in response.
    I have found Directory, i can even export data in that, but the problem is that we have database on other pc, and we are connected through network. When i run expdp command from command line it creates the dump file in the default PC and not in my pc. If i use old export utility file is created in my pc. Is there any way i can create file in my pc.
    No.The result of expdp(dmp) file will create in the server (directory).
    I used the below command.
    expdp test1/test1@abc123:1521/XE directory=datadump dumpfile=c:\oraclexe\app\oracle\admin\XE\dpdump:test1latest.dmp
    abc123 is the pc where my database in installed
    c:\oraclexe\app\oracle\admin\XE\dpdump in my pc's path where this file should be created and stored.
    I want to load this data in new schema, which is at my pc.
    XE is our database name as we are using ExpressEdition of Oracle 10g.
    I want to load the exported data in my database in my Schema.
    To export through remote database to local database you can use expdp network_link option.See below link
    http://download.oracle.com/docs/cd/B13789_01/server.101/b10825/dp_import.htm

  • Exporting and Importing Statistics for Schema objects.

    Hello All,
    I am trying to gather stats for optimization using, gather_schema_stats for all objects under schema. The manual what i am reading says it covers both Tables and Indexes and we can also include the all partions too. For the safety reasons i was informed by a friend that we should take a back up of old stats into a table (user defined), so as in case of messing up with new stats for performance issue we can use it as an backup copy. So, i have created a user table and exported the stats from existing schema. My Question is, do i have to create one for the indexes too. Or its all in one table. I hope my question is clear.
    Generally manuals don't teach all this kind of stuff until unless we learn it by ourselves by trial and error Or getting solutions from great resolvers like you people.
    Hope to hear soon.
    Thanks in Advance.

    One table for table and indexes stats is enough, a little test for you :
    SCOTT@demo102> exec DBMS_STATS.CREATE_STAT_TABLE('SCOTT','MYTBL');
    PL/SQL procedure successfully completed.
    SCOTT@demo102> desc mytbl
    Name                                      Null?    Type
    STATID                                             VARCHAR2(30)
    TYPE                                               CHAR(1)
    VERSION                                            NUMBER
    FLAGS                                              NUMBER
    C1                                                 VARCHAR2(30)
    C2                                                 VARCHAR2(30)
    C3                                                 VARCHAR2(30)
    C4                                                 VARCHAR2(30)
    C5                                                 VARCHAR2(30)
    N1                                                 NUMBER
    N2                                                 NUMBER
    N3                                                 NUMBER
    N4                                                 NUMBER
    N5                                                 NUMBER
    N6                                                 NUMBER
    N7                                                 NUMBER
    N8                                                 NUMBER
    N9                                                 NUMBER
    N10                                                NUMBER
    N11                                                NUMBER
    N12                                                NUMBER
    D1                                                 DATE
    R1                                                 RAW(32)
    R2                                                 RAW(32)
    CH1                                                VARCHAR2(1000)
    SCOTT@demo102> create table mytable_obj as select * from all_objects;
    Table created.
    SCOTT@demo102> create index myindex on mytable_obj(object_id);
    Index created.
    SCOTT@demo102> exec dbms_stats.gather_table_stats(ownname=>'SCOTT',tabname=>'MYTABLE_OBJ',cascade=>true);
    PL/SQL procedure successfully completed.
    SCOTT@demo102> select last_analyzed from all_tables where table_name='MYTABLE_OBJ';
    07/06/06
    SCOTT@demo102> select last_analyzed from all_indexes where table_name='MYTABLE_OBJ';
    07/06/06
    SCOTT@demo102> exec dbms_stats.export_table_stats('SCOTT','MYTABLE_OBJ',stattab=>'MYTBL')
    PL/SQL procedure successfully completed.
    SCOTT@demo102> exec dbms_stats.delete_table_stats('SCOTT','MYTABLE_OBJ');
    PL/SQL procedure successfully completed.
    SCOTT@demo102> select last_analyzed from all_tables where table_name='MYTABLE_OBJ';
    -->No value
    SCOTT@demo102> select last_analyzed from all_indexes where table_name='MYTABLE_OBJ';
    -->No value
    SCOTT@demo102>  exec dbms_stats.import_table_stats('SCOTT','MYTABLE_OBJ',stattab=>'MYTBL');
    PL/SQL procedure successfully completed.
    SCOTT@demo102> select last_analyzed from all_tables where table_name='MYTABLE_OBJ';
    07/06/06
    SCOTT@demo102> select last_analyzed from all_indexes where table_name='MYTABLE_OBJ';
    07/06/06
    SCOTT@demo102> Nicolas.

  • Unix Shell Scripts with Oracle

    Any body who can give me the link where I can find the Unix Shell Scripts to access the Oracle database and execute the stored procedures and cursors.

    Your unix script will contain (at appropriate places):
    sqlplus -s username/pasword@server @your_sql_Script_that_calls_the procedure.SQLor
    sqlplus -s / @your_sql_Script_that_calls_the procedure.SQL

  • Automate exports and imports (file names)

    Hi all,
    I will like to do a simple export and import into another schema in another database.
    I am very comfortable with the process but all i require is how to set the dump file and log file names to be the date and name of the database being exported and imported.
    For example when I do the export I want the dump file and logfile names to be exp_ORCL_230805.dmp and exp_ORCL_230805.log for database ORCL exported on 230805.
    For the import I want the logfile name to be imp_TEST_230905.log.
    I am doing this export and import on a windows xp client but the database reside on UNIX AIX boxes.
    Thanks alot

    Set up ORACLE_SID before you start the imp/exp session on the client, then you can use file=exp_%ORACLE_SID%_%DATE%.dmp etc. (Note that if your windows locale has a date format w/ whitespace you might have to write a script to get rid of it..)

  • Query on Database Export and Import

    Hi Techies,
    Currently we are running our Database on Oracle 10g and SAP on4. and OS is HP UX 11.11.
    We have a plan to migrate our HW from PA-RISC to Itanium and at the time of Production migration we are planning to use Export and Import method to get free space.
    Our plan is as below:
    We will not touch the original Production, Just restore the DB into new server.
    And post restore we will create the space on new server equallent to our DB size.
    Then will perform DB export from the new system to the null space
    Then Import the DB into same system.
    Here my queries are:
    1) Is it possible to export and Import the Database from/to null space?
    2) We have 2T size of DB, And good resources like 32G Ram, 12 CPUs etc. How much time can be expected to perform Export and Import?
    3) What are the challenges we can expect?
    4) Minimum how much of free space we can expect with this option?
    Regards,
    Nick Loy

    So with test runs I can expect rapid speed in DB export and Import (1T/H)........If I have good system then Database export and Import gets complete within 2 hrs (Database size is 2T).
    Well 1tb is at the very top of expectations here, you should be careful. I did an export/import of a 1.5tb database of an ERP system lately. We did parallel export (40 processes) / import (20 processes) using distmon, source was HP IA64, target Linux x64_64. The disks were midrange SAN storage systems on both sides.  After tuning we managed to do in 6-7hrs.
    But in your case, if you only have one system, this could mean you have to drop the source db first and then recreate the target db on the same disks. The creation of the 1-2tb database files alone can take up more than 1 hour , besides that you don't have an easy fallback.
    If you have a test system that is comparable from size and hardware perspective, then i suggest you try a test export to get a feeling for it.
    What about the Online re-org of database? What would be the best way to get free space within minimum downtime?
    Theoretically you should be able to gain more or less the same amount of space doing online reorgs. The advantage is less downtime, the downside is the reorgs will be running over a longer time period and put additional load on the system.
    Cheers Michael

  • How to export and import database from command line?

    I am trying to export my old database into new server.
    However, I want to export and import that database from command line.
    Is it possible?
    Thanks.
    SZ

    I used this command
    exp username/password@database full=y
    my export log file is as follwing:
    Connected to: Oracle8i Enterprise Edition Release 8.1.5.0.0 - Production
    With the Partitioning and Java options
    PL/SQL Release 8.1.5.0.0 - Production
    EXP-00037: Export views not compatible with database version
    EXP-00000: Export terminated unsuccessfully

  • How to wrap import and export in a Unix shell script?

    Hi all,
    I want to write a simple korn shell Unix script to kick off export and import
    for our Oracle 10g refresh databases. Do any of you have a script to do this?
    The goal would be:
    1. Take export using exp of 10 tables in PROD database on database server1
    for the prod schema user
    2. Use sftp or scp to copy over the export dump file to database server 2
    3. Use a shell script to import the dump file into TEST database server for schema
    test
    4. use nohup to run the export and import in background through cron job
    We are running Oracle 10g Release 2 on Red Hat Linux.
    Thanks,
    Ben Prusinski

    Wouldn't it be easier to have both databases in your tnsnames.ora file. Then you can export and import on the same server without copying the files to another server.
    script:
    exp <username>/<password>@PROD file=<file>.dmp log=<explog>.log owner=prod
    imp <username>/<password>@TEST file=<file>.dmp log=<implog>.log fromuser=prod touser=test
    run this script as: nohup <scriptname> &
    Since you are on oracle10g you can also use datapump (expdp and impdp) for faster exporting and importing, but I do not know the syntax by heart

  • RFC_REMOTE_PIPE is Returning 1 alwasys and not able to execute Unix shell script

    Hello All,
    I am trying to execute a simple unix shell script from ABAP.
    What I did so far..
    1. created a test.sh file  with single command echo "Hello".
    2.  placed this file on application server /Usr/sap/test.sh
    3. executing ABAP program which as FM RFC_REMOTE_PIPE
    CODE:
    CALL FUNCTION 'RFC_REMOTE_PIPE'
       DESTINATION 'SERVER_EXEC'
    EXPORTING
       command  = lv_command
       read          = 'X'
    TABLES
       pipedate    =  lt_stdout
    EXCEPTIONS
    system_failure  = 1
    communication_failure = 2.
    if i populate lv_command  = echo "hello" it works fine
    if i give .sh file path in lv_command it is not working. it returns 1.
    Please help...
    I was searching SDN i found that rfcexec service should be enabled... how do i check that..
    i checked t code  \SMGW , i don't see any output...
    i checked FM GWY_READ_CONNECTED_SYSTEMS, i don't hsee anyting related to unix...
    Please suggest.

    I resolved the issue.
    It was issue with permission.
    Script file should have full permission ( Mode 777)..
    Thanks everyone.

  • How to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also

    032ee1bf-8007-4d76-930e-f77ec0dc7e54 wrote:
    how to run 3 job(a,b,c) parallel in unix shells script and after will complete d will start  and we have to handle the error also
    Please don't overwhelm us with so many details!  
    Just off the top of my head ... as a general approach ... something like
    nohup proca
    nohup procb
    nohup procc
    while (some condition checking that all three procs are still running ... maybe a ps -ef |grep  )
    do
    sleep 2
    done
    procd
    But, we'd really need to know what it is you are really trying to accomplish, instead of your pre-conceived solution.

  • Want to create unix shell script for  Clone procedure in 11i and r12

    Want to create unix shell script for Clone procedure in 11i and r12 .Can anyone help me on this as I m new to oracle apps and scripting.
    Thanks in advance .

    user11958935 wrote:
    Thanks but I want it for application cloning ie adcfgclone and autoconfig etc .Please see old threads for similar topic/discussion.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Automate+AND+Rapid+AND+Clone&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Automate+AND+AutoConfig&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Shell Script For Export And Import Of Table Records

    Hello,
    We have production and test instances and for constant testing we need to copy data from production to test or development environment.
    At the moment what we do is manually doing export and import table records. At times this could be very tedious as we may need
    to do this exercise a couple of times in a day.
    Is it a good idea to do this exercise using shell script? If so how could I do this? If this is not a good idea what are the best alternatives?
    Any input is highly appreciated.
    Thanks

    Ah I see, your company prefers stupidity over efficiency. It would be possible to do it in a controlled environment, wouldn't it? Also the test database would be allowed to select only.
    So the non-allowance is just plain stupid.
    To the second question: do you use hard-coded passwords in shell scripts?
    Don't you think that poses a security risk?
    Don't you think that is a bigger risk than a database link, properly set up?
    In my book it is!
    Sybrand Bakker
    Senior Oracle DBA

  • PLSQL job and unix shell scripting

    I want to be a plsql developer, now reading job ads for the technical requirement.
    This is a typical plsql job ad:
    "Technically those applying MUST have a minimum 5 years Oracle PL/SQL design and development experience combined with 3 years Informatica/ ETL exposure. You should be comfortable working off Unix platforms and associated *Shell Scripting* and database performance tuning. Experience with vendor products surrounding the compliance area such as Mantas or Actimize is highly beneficial. "
    Generally, do plsql developers work with shell scripting on a basic level, like echoing, saving files, looping etc, well, this level? : Unix Programming for dummies [http://www.amazon.com/Programming-Dummies-James-Edward-Keogh/dp/0764500619|http://www.amazon.com/Programming-Dummies-James-Edward-Keogh/dp/0764500619] . Er...this kind of of shell programming is very easy, why bother even putting the requirement in the ad? It's like saying you need to know primary school maths for the job.
    Or plsql developers work with unix programming at this kernel programming level, like semaphores, signal, UNIX Systems Programming: Communication, Concurrency and Threads? [http://www.amazon.com/UNIX-Systems-Programming-Communication-Concurrency/dp/0130424110/ref=sr_1_6?ie=UTF8&s=books&qid=1256350650&sr=1-6|http://www.amazon.com/UNIX-Systems-Programming-Communication-Concurrency/dp/0130424110/ref=sr_1_6?ie=UTF8&s=books&qid=1256350650&sr=1-6]
    I got plsql and sql tuning requirement under control, now need your help to know what level of expertise is required for unix shell scripting. What plsql developers generally do with unix shell scripting? Can you recommend a book to read?
    Many advance thanks.

    Generally, do plsql developers work with shell scripting on a basic level, like echoing, saving files, looping etcYes.
    Or plsql developers work with unix programming at this kernel programming level, like semaphores, signal, UNIX Systems Programming: Communication, Concurrency and Threads? Generally speaking, No.

  • Error while executing unix shell script from java program

    Hi All,
    I am trying to execute unix shell script from a java program using Runtime.execute() method by passing script name and additional arguments.
    Code snippet :
    Java Class :
    try{
         String fileName ="test.ksh";
         String argValue ="satish"; // value passed to the script
         String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
         Process proc = Runtime.getRuntime().exec(exeParam);
         int exitValue = proc.waitFor();
         sop("Exit Value  is : "+exitValue);
    catch(Exception e)
    e.printStackTrace();
    }Test.ksh
      export -- application realated paths..
      nohup  abc.exe 1> test.log 2>&1;
      $1
      exit.By running the above java class , i am getting exit Value: 139 and log file test.log of 0 bytes.
    when i am running the same command (/usr/bin/ksh test.ksh satish) manually, it's calling abc.exe file successfully
    and able generate the logs properly.
    Pls let us know where exactly i am stuck..
    Thanks in advance,
    Regards,
    Satish

    Hi Sabre,
    As per the guidelines provided by the article, i had done below changes..
    InputStream is = null;
    InputStreamReader iStreamReader = null;
    BufferedReader bReader = null;
    String line = null;
    try{
    String fileName ="test.ksh";
    String argValue ="satish"; // value passed to the script
    String exeParam = "/usr/bin/ksh "+fileName+" "+argValue;
    Process proc = Runtime.getRuntime().exec(exeParam);
    is = proc.getErrorStream();
    iStreamReader = new InputStreamReader(is);
    bReader = new BufferedReader(iStreamReader);
    System.out.println("<ERROR>");
    while((line = bReader.readLine()) != null)
    System.out.println("Error is : "+line);
    System.out.println("</ERROR>");
    int exitValue = proc.waitFor();
    sop("Exit Value is : "+exitValue);
    catch(Exception e)
    e.printStackTrace();
    Now , it's showing something like..
    <ERROR>
    </ERROR>

Maybe you are looking for

  • Iphone 4 not recognized by Itunes after uninstallation, installation... Anyone help pls ?

    I'd like to synchronise my phone because of a pbm with an app. But it is not recognized at all by ITunes... I uninstalled, repaired, installed ITunes, Quicktime, turned off several time the phone... and the pbm still be... Anyone knows what to do pls

  • Invoice on wrong PO - how to void from FI

    Hello, My problem is that we have  invoice which was vouchered on the wrong PO and now weu2019re trying to reverse it and voucher it on the correct PO and repost a manual payment. Just not sure if once we reverse the clearing document, we can void th

  • How to Debug the RFC when the call is made from XI

    Hi I will give the brief about the problem this call is from Webservice >XI-> R/3 BW (RFC) Some transaction were failed with error 'Reason Code not valid ..e.t.c " this error returning from the RFC of the BW system, but as per the inputs from the bus

  • Making iWeb movies friendly to windows

    Here is the deal- I have been in touch recently with 4 different windows users who frequent my website. 2 of them have no trouble with the QT movies but 2 of them do. One has no video but sound and one gets nothing but the progress bar but nothing pl

  • ASA 8.2 Global Outside works, but static NAT mappings fail

    Hello, I'm usually not stumped by issues, but this one I cannot seem to figure out. I have an older Pix and I've mirrored the config on a new ASA with 8.2(5) OS. It's a pretty basic config with one ACL for a few inbound port forwards to servers. The