exp and imp in a sql script

Hello

I want to develop a sql script contains both code for the creation and insertion on a table and the exp command to export this table.
Do you have an idea how integrate the command exp and imp in the sql script.

Thank you.

Edited by: Andrew1 Nov. 11. 2009 02:33

This should be easy under Windows.

Put the #1 and #2 in separate text files (.sql as use ending), for example create_table_web_enfants1.sql

Create a batch (.cmd use as ending) file when you call these sql files, for example setup.cmd

sqlplus /@ @create_table_web_enfants1.sql
...

Add your exp returns to your command file

and STI test.

BTW: I'm going to assume that you post any real names of user/passwords to a production company database in your example, if not, you have broken some rules concerning the said database access security.

C.

Tags: Database

Similar Questions

  • Create jobs and positions via PL/SQL script

    Hi, it is recommended to insert new jobs and positions via PL/SQL Script?

    I know it's possible, I'm not sure if it is recommended. especially when it's via a direct insertion.

    Is there an API for it?

    I have about 200 + positions I need to set in our Instance of the EBS Test.

    Thank you!

    The APIs are the best way to do it in batches of charges-

    Job: HR_JOB_API

    Position: HR_POSITION_API

    To know that all the seeds API, add the responsibility of integrated SOA gateway

  • problems of exp and imp

    Hello world

    I need to export and import in a SID for a user to another.

    My export config file looks like:

    UserID=Name/Pass@Orka
    BUFFER = 1500000
    FILE = 'C:\backup\xxx. DB.bkp ".
    JOURNAL = 'C:\backup\xxx. "DB - exp.log.
    GRANTS = Y
    INDEX = Y
    LINES = Y
    CONSTRAINTS = Y
    CONSISTENT = Y
    OWNER = povilasora

    My import config looks like:
    UserID=Name/Passs@orkanew
    BUFFER = 1500000
    FILE = 'C:\backup\xxx. DB.bkp ".
    JOURNAL = 'C:\backup\xxx. "DB - imp.log.
    INDEX = Y
    LINES = Y
    CONSTRAINTS = Y
    fromuser = povilasora
    TOUSER = povilasora

    Export was successful. Import with error:

    Import: Release 10.2.0.1.0 - Production on a lie 26 11:47:42 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Release 10.2.0.1.0 - Production
    Export file created by EXPORT: V10.02.01 by conventional means

    CAUTION: objects have been exported by POVILASORA, not by you

    import in BLT8MSWIN1257 and AL16UTF16 NCHAR character set
    . import of objects of POVILASORA in POVILASORA
    IMP-00003: ORACLE error 1435
    ORA-01435: user does not exist
    Import completed successfully with warnings.

    And I did not understant what the user will not end? User does not question.
    Fromuser and touser, can I write the same thing? POVILASORA? Because in orkanew is where no user such as POVILASORA.

    Do an export of user level exports only the objects for this user.

    When you import, it does not create the user that you are stating in your touser clause.

    You must create the povilasora user manually on your destination database. Your import will run successfully.

    Only if you perform a full export import create users that you then try to import as is the importation of system level that creates the users.

  • 9i exp and Imp to 10g

    Hello

    I updated my version of DB from 9i to 10g. Now I need to export data from the Database 9i to 10 DB g. IM afraid if I have to add in some conditions to the export and import of order. Here is the command I want to make a request, if it's not good, could you correct me please.

    Journal/password system exp = $EXPORTS_LOG full = y direct buffer = y = 1000000 COHERENT = Y

    Thank you

    As you perform a FULL export, you need an account with DBA privileges or permission. Therefore, you must connect as a SYSTEM to export.

    If you were doing an export of a single SCHEMA, you would do an export of the USER. In this case, you can connect as a SYSTEM or the real user who is to be exported.

  • Exp and Imp are very slow

    We have a system in version 9.2.8 leagcy and export and import are very slow. It takes almost 3 hours to 30 GB of data. Is there a way we can do it quickly? HELPPP me.

    EXPORT:

    Set the buffer setting to a high value (e.g. 2Mb - entered as an integer "2000000")
    Set the RECORDLENGTH parameter to a high value (e.g. 64 KB - entered as an integer "64000")
    Use DIRECT = yes (direct mode export)
    Stop unnecessary applications to free resources for your work.
    If you run multiple sessions of export, ensure the different physical disks, write.
    Do NOT export to a mounted NFS filesystem. It will take forever.

  • Other new lines in SQL script file and problem with SQL * more

    Hi all


    I would like to ask a question on the characters of new line inside files SQL scripts. I have a very long SQL query, stored in a file txt (ANSI encoding). Because query instructions are very long (several table joins and WHERE conditions) tried to separate, WHERE and ORDER BY clauses by inserting several new characters of lines (just hit the entrance) among them in order to improve the clarity of the source code. Now the problem is, whenever these newline characters are inserted in the file, apparently SQL * Plus cannot parse the file properly and gives me the following error message:
    SP2-0042: unknown command "FROM" - rest of line ignored.
    SP2-0734: unknown command beginning "myenterpri..." - rest of line ignored.
    The problem is definitely related to these new line because characters that when I remove them, the scripts runs without any problem. I would appreciate that you could kindly guide me how should I deal with this problem. Is there any SQL * Plus command to run to correctly interpret the new line characters?


    Thanks in advance,


    Kind regards
    Dariyoosh

    Hello

    In [SQL * Plus 9 | http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1013073] (and), you can tell

    SET     SQLBLANKLINES   ON
    

    allow to completely empty rows in an SQL statement.

  • Update SQL script

    Hi friends,

    I started this thread yesterday, but for some reason that I'm not able to answer/continue on this old thread. Here are the details from the old thread

    I need help with a sql script to update sid_no_new column with values based on sid_no for about 6000 + records.

    Here is an example below...

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

    --------------------         --------------------           --------------------

    2000                                                          unit1

    2000                                                          unit3

    2000                                                          unit4

    2002                                                          unit16

    4500                                                          unit22

    In the example above, there are 3 sid_no consecutive '2000'. Sid_no_new must be 2000_1, 2000_2, 2000_3, respectively.

    It should be like:

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

    --------------------      --------------------           --------------------

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    I ran the script (thanks to the experts who have contributed to) below, it works very well for the above documents, but I get ORA-30926 error when I run on the table with 6000 records...

    Fusion IN test1 tgt USING

    (SELECT sid_no,

    sid_no_new,

    unit_no,

    Count (sid_no) over (partition BY sid_no) cnt,

    ROW_NUMBER() over (partition BY order of sid_no to unit_no) rn

    OF test1

    ) CBC ON(tgt.sid_no=src.sid_no AND tgt.unit_no=src.unit_no)

    WHEN matched THEN

    UPDATE SET Sid_no_new = CASE WHEN cnt > 1 THEN sid_no |' _'. RN ELSE sid_no END;

    ERROR on line 1:

    ORA-30926: failed to get a stable set of rows in the source tables

    Please give your suggestions... Thank you very much

    In fact, this could be done easier:

    SQL > select *.

    test1 2

    3.

    SID_ SID_NO UNIT_N

    ---- ------ ------

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

    ---------- --- ----------

    RAF 2000 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    SQL > fusion

    2 in d of test4

    3 use)

    4 with as t4)

    5. Select uid_no,

    6                               type,

    7                               rule_due,

    8 rowid RID,

      9                               uid_no || '_' || ROW_NUMBER() over (partition by uid_no by 1 order) sid_no_new

    10 of test4

    11                      )

    12. Select t1.sid_no_new,

    T4.type 13,

    T4.rule_due 14,

    15 cases

    16 when t1.sid_no = t1.sid_no_new then t4.rid

    17 when t4.sid_no_new = t1.sid_no_new then t4.rid

    18 end rid

    19 of t4,

    Test1 20 t1

    21 where t1.sid_no = t4.uid_no

    22          ) s

    23 on)

    24 d.rowid = s.rid

    25       )

    26 when matched

    27 then

    Update 28

    29 set d.uid_no = s.sid_no_new

    30 when no match

    31 then

    32 insert

    33 values)

    s.sid_no_new 34,

    s.type 35,

    36 s.rule_due

    37                )

    38.

    3 lines merged.

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

    ---------- --- ----------

    2000_1 RAF 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    2000_3 RAF 90

    2000_2 RAF 90

    6 selected lines.

    SQL >

    SY.

  • How to run multiple parallel sql scripts?

    I try to execute multiple sql scripts parallel to the short run of the process via sqlplus. Are there opportunities to do? LINUX ORACLE 5. XX

    I do it too via Scheduler, but now I need to do this via sqlplus or shell + sqlplus?

    How do I start using shell script several xterminals and ech session begins all the sql scripts?

    nohup./SQL1.sh &

    nohup./sql2.sh &

    nohup./SQL3.sh &

    The '&' causes the script1.sh to run in the background so that the command prompt is returned immediately.  This means that sql2.sh can start immediately and at the same time as sql1.sh.  It doesn't have to wait for sql1.sh.   This assumes that there are no dependencies between scripts!  This meets your need to run scripts in parallel.

    The nohup untie your shell script.  So, even if you disconnect, the script continues to run.  Without the nohup, if you were to close your session before the end of the scripts running, they would get fired.

    Hemant K Collette

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • passage OEM "SQL Script" job name in lowercase as proxy database

    Hello

    I have a SQL script that requires the name of the database in lower case to be passed when running - she uses it as a substitution variable to create database directories that point to the UNIX file system (which is why they are case sensitive). I want to be able to configure this script as work in OEM (12 c version 3) so that I can run on several databases (11.2.0.3), but at the creation of employment, the % DBName parameter returns only the name of the database uppercase. I tried to change the % DBName parameter and run the script in a PL/SQL block, but the variable I spend it is interpreted as a literal string. I also tried to run in a shell script, but because of the way the user operating system is set up that I can't get that to work either.

    Does anyone have any ideas how this can be done? Ideally, I wish I could just run @script lower (%DBName%) or something similar.

    Thanks in advance,

    Robin

    In case anyone else has trouble with this, I worked on that I was able to use a PL/SQL block to convert the variable substitution for lower case, then create the directory with the variable:

    DECLARE

    v_lowerSID varchar2;

    BEGIN

    Select lower ('& 1') in the double v_lowerSID;

    run immediately ' create the db_dir as directory "/ [path] /' | v_lowerSID | '/' || v_lowerSID | ' _directory1 "';

    END;

    /

  • Running SQL scripts on different databases

    Hello!

    At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

    So my question may be separated into 2 sections:

    1 - is possible to let users SQL scripts run directly from the application?

    I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

    is 2 - possible to let users choose what database to run these scripts?

    Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

    Thank you!

    Fallen_Kaede wrote:

    Thanks for the quick response. I confirm that we are talking about databases on a server.

    The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

    It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

    1 - is possible to let users SQL scripts run directly from the application?

    Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

    The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

    is 2 - possible to let users choose what database to run these scripts?

    The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

  • Several Windows local sql scripts to run automatically.

    Hi Experts, here's my dillemma.

    Oracle DB version: 10G

    Installed in: Sun solaris Sparc Unix machine.

    Customer used in local machine: PLSQL developer version 10

    I'm going to get a set of .sql files every week on my local machine to windows 7 especially recreate tables, insert data, and perform other actions of DB.

    Our project aims to automate the process of sql executions.

    Whatever the State of execution of the 1 file, execution should continue with the rest of the sql files & save errors and other messages.

    But the problem here is

    (1) we don't have access to the Unix machine where DB is installed to write a shell script and run these files.

    (2) we have only customer plsql developer which interfaces with DB.

    My life I worked with scripts Unix & plsql, but not having don't access Unix is a newthing to me & its driving me crazy.

    Please give me advice on how to approach it.

    (1) can use us plsql developer for pickthe local files & run them?

    (2) can write us that all back base program in order to recover and run the local sql files.

    Assumptions:

    I think that PLSQL programming in itself is not a way to access the files stored in the local computer (my system and not the box Pb, in that it is installed).

    Thank you for your time and response.

    Tip:

    use customer sqlplus to connect to db. and run your scripts in the bat file

  • Where is CMCLEAN. SQL script now?

    Hello

    I think I should find the cmclean.sql script in the following note:

    Simultaneous treatment of - CMCLEAN. SQL - Script Non-destructive to clean the simultaneous Tables Manager [ID 134007.1]


    But when I searched Doc ID 134007.1 I was surprised to see that the Doc ID is present but cmclean.sql script is not available here as it was:


    Now the title of the Doc has also changed to:

    Simultaneous - treatment simultaneous Recovery Manager Troubleshooting Wizard (Doc ID 134007.1)

    Can you please let me know what happened to the original note and help me get to the script cmclean.sql on MOS.

    Thank you

    Armande

    Florent,

    cmclean. SQL script is so more exist and you should use the "Competitor Assistant Manager of recovery".

    Thank you

    Hussein

  • Backingup database using SQL script

    Hello

    Let me start by saying I am new to Oracle and I'm learning how to do a project where I have to write a SQL script that allows you to back up all data files (i.e. control, redo log and data files).  Assuming that all the files are stored in a folder, the source locations and the destination of these files must be provided as 'substitution variables.  The script must implement the following tasks (directions)


    1. Log in as the SYS user with SYSDBA role
    2. Closing the database
    3. Copy the files to the location of the source database and store it in the destination location
    4. Restart the database
    5. Log in the user SCOTT

    In addition, the script must use the "HOST" command to publish the operating system command to perform the copy task.


    * Since this is just a learning project and not a real scenario, I can't run my script in SQLplus to verify if it is correct. That's why I ask for professional advice. I am currently working with Oracle 11 g Enterprise running on a client Windows XP OS.


    Here's what I decided, it's a cold backup, please let me know if what I do is correct so far, and if not can you please steer me in the right direction.


    connect SYS / < password > have SYSDBA

    Shutdown;

    Copy of HOST of & source_file to & destination_file;       -It is the line that confuses me.

    connect SYS / < password > have SYSDBA

    start-up;

    Connect scott/tiger


    Thanks in advance for your time and input.

    I currently have the free version of 11g Oracle Enterprise downloaded on my computer, running on VB with the client Windows XP OS. But being new to this that I find myself afraid of bad script execution that can break my DB. I know that I can just reload and try again, but I try to approach the question as carefully as possible. Although the error codes help me understand what I am doing wrong much of the time.

    Break things (and their fixation) is how to learn.  Because you are running in VBox, simply take a snapshot of vbox system before testing.  So if it is irrevocably broken, you just restore the snapshot system.

    But give what you're trying to do, what do you think might happen this may break your db?  As far as the db is concerned, everything you do connect, stop and commissioning.  Nothing can go off of the truth of that.

  • Running PL/SQL scripts...

    Hello:

    I'm new to PL/SQL and am learning by writing that a few basic Queries.I using TOAD as a tool to write queries I got stuck in this query I posted below.

    Here I have a table with data.

    EMPLOYEE_ID SALARY BONUS

    ----------- ---------- ----------

    90-1000

    100 2000

    110 1890

    130 2132

    120 1255

    I wrote a query which take the value from the table (of particular employee_id) salary and multi with 0.01 and once again will store in the variable bonus (so far everything works fine).

    but when I execute the script with the function to update its time consuming process (ends without result).

    DECLARE

    bonus NUMBER (8.2);

    emp_id NUMBER (6): = 100;

    BEGIN

    SELECT salary * 0.10 IN bonus

    Employees

    WHERE employee_id = emp_id;

    dbms_output.put_line (bonus);

    update set employees.bonus = bonus employees where employee_id = emp_id;

    END;

    I tried the same thing through the sql-plus tool.


    I stored the file above in note ++ (.sql extension) and through sql-plus I tried to run

    SQL > @[path] [file]


    but this does not work please help me in this. Please help me solve both ways...



    See you soon...

    It shouldn't take long at all.

    SQL > create table emp2 in select * from emp;

    Table created.

    SQL > ed c:\give_bonus.sql

    In my case, I have...

    >
    declare
    number of bonuses;
    emp_id number: = 7788;
    Start
    Select sal * 1.1
    as a bonus
    from emp2
    where empno = emp_id;

    dbms_output.put_line ('Sal with bonus: ' | bonus);

    Update emp2
    Sal value = give_bonus.bonus
    where empno = emp_id;

    commit;
    end;
    /

    And then again in SQL * more I call it...

    SQL > set timing on
    SQL > @c:\give_bonus.sql
    SAL with bonus: 3300

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:00.03

    Very fast.

    Perhaps you lack the ' / ' the end of your script that tells SQL * Plus to run the code?  And he's sitting there waiting for input?

Maybe you are looking for

  • getting data from a web site

    I have a device that has a built in web server that I need to write a program of LV I need to read the date, that the web server is producing and compare it to the data measured actcual. Now, the measurement and the comparison is easy but I do not kn

  • The update wants to do a net framework 1.1 SP1 on Windows XP, Vista and windows server 2008 x 86. KB2656353 but can not. Why not?

    The update wants to do a net framework 1.1 sp1 on Windows xp, vista and windows swrver 2008 x 86 (KB2656353), but can not.  Why not?  He simply has it again and again without updating.

  • HP pavilion g6 bluetooth problem

    Hello. I have hp pavilion 2211et g6 I installed win 8.1. and installed all the drivers. But I can not activate bluetooth device. Wi - fi device does not work correctly. In the list of devices, a device is "unknown device". Perhaps this bluetooth devi

  • Request for map lookup table

    I would like to map table with look up table B, how can I write a query on ORACLE 10 G?Table AID SITE_ID NAME112345THE, switch124567HONG KONG, switch136789TOKYO, 2Table BSITE_ID NETWORK2345MPLS2345NORTH AMERICA4567ASIA6789ASIA6798MPLSOutputID SITE_ID

  • 11.1.2.3 JDEV 'All' remove choicelist multiselect in af:query

    Hi allWe use JDEV 11.1.2.3. I have an attribute in the criteria of view which has a control of choicelist type. and I've activated support of the functionality of multiple values in it in the view criteria. So when it is returned to the execution on