Expdp all the tables execept 3 and filter for those 3 in one script

Hi ,
I want to take export as follows.
1) all tables except table a,b,c
2) Export of table a with filter condition specific to a
3) Export of table a with filter condition specific to b
4)Export of table a with filter condition specific to c
I have to do this in EXPDP Script.
Can we achieve this ??
Thanks,
Pramod.

Hi,
+1) all tables except table a,b,c+
+2) Export of table a with filter condition specific to a+
+3) Export of table a with filter condition specific to b+
+4)Export of table a with filter condition specific to c+
All above in one export command.
anyway
create one script like TABLENAME,TABLENAME, SO ON EXCEPT THREE TABLES
and just copy and paste the ouput after TABLES= parameter in export command
2. use QUERY paramter to specific filter or show us what is your condition.
above both example available in ASKTOM site.
Regards,
Taj

Similar Messages

  • How can I make all the Tables in my spreadsheet to work as one?

    I made a spreadsheet for work in Numbers '09 but do to the computers that we have at work, I have to have it exported to Windows Excel, but when I try to export the spreadsheet since I used more than 1 table to create this spreadsheet, each table is converted to an Excel worksheet, and all other objects are placed on separate worksheets since there's more than one table. and I want to know is there anything I can do, to export everything in one spreadsheet, for all the tables to work as one spreadsheet. PLEASE HELP!!

    You may be able to easily consolidate all your tables into one big table to make it equivalent to an Excel worksheet. You can copy/paste from one table to another and you can drag columns or rows from one table and insert them into another. Note that formulas that use column letters or row numbers instead of specific ranges (i.e., B instead of B2:B10) will now refer to the entire column/row in the destination table.
    Without doing this, all the tables, when exported to Excel into separate worksheets, should still work together just like they did in Numbers. Are you saying that they do not?
    Not much you can do about objects.

  • Can we see all the Technical names and field/common names in one screen

    Hi SAP Gurus,
    Can any one plz. clearify the querry of 'all the technical names, field names, common names, table names in one screen? if so, how?
    Thanks inadvance
    Regards
    Namrata

    Hi,
    For a particular screen,if u want to see all the technical data,
    Go to system->status->screen->double click on the screen->flow logic.
    Regards,
    Manoj.

  • Plz go through the table stucture and query for the desired resultusing pos

    date           timespent project timesheetId
    2008-05-12      7.5000     2-NT 1
    2008-05-13     7.5000     2-0670A     1
    2008-05-14     5.5000     2-0671A     1
    2008-05-15     2.5000     2-0670A     1
    2008-05-15      5.0000     2-NF4 1
    2008-05-16     7.5000     2-0670A     2
    NF:---Non Billable
    NT:-- leave Taken
    Numbers:--- 1 TO 15 represnts date ,for paticular date i need the time spent by an employee for a particular project
    i am using postgre Sql where Decode function will not work,in stead of this i have used this query.but i did not get sesired result.
    num_phase=project
    timespent=temps
    date=jour
    select num_phase,temps, CASE to_char(jour,'dd')
         when '1' then temps
         else '0'
    end as "1" ,
    CASE to_char(jour,'dd')
         when '2' then temps
         else '0'
    end as "2",
    CASE to_char(jour,'dd')
         when '3' then temps
         else '0'
    end as "3",
    CASE to_char(jour,'dd')
         when '4' then temps
         else '0'
    end as "4",
    CASE to_char(jour,'dd')
         when '5' then temps
         else '0'
    end as "5",
    CASE to_char(jour,'dd')
         when '6' then temps
         else '0'
    end as "6",
    CASE to_char(jour,'dd')
         when '7' then temps
         else '0'
    end as "7",
    CASE to_char(jour,'dd')
         when '8' then temps
         else '0'
    end as "8",
    CASE to_char(jour,'dd')
         when '9' then temps
         else '0'
    end as "9",
    CASE to_char(jour,'dd')
         when '10' then temps
         else '0'
    end as "10",
    CASE to_char(jour,'dd')
         when '11' then temps
         else '0'
    end as "11",
    CASE to_char(jour,'dd')
         when '12' then temps
         else '0'
    end as "12",
    CASE to_char(jour,'dd')
         when '13' then temps
         else '0'
    end as "13",
    CASE to_char(jour,'dd')
         when '14' then temps
         else '0'
    end as "14",
    CASE to_char(jour,'dd')
         when '15' then temps
         else '0'
    end as "15",sum(temps) as Total
    from temps_passes_jour where id_feuille_temps =1
    AND num_phase not LIKE '%NF%' AND
    num_phase not LIKE '%NT%'
    GROUP BY num_phase,temps,jour order by num_phase,jour
    Result:---
    Disply form table
    Project 1 2 3 4 5 6 7 8 9 11 12 13 14 15 Total
    2-0670A                              7.5000 2.5000 10.0000
    2-0671A                                   5.5000     5.5000
    Edited by: user10193450 on Aug 27, 2008 9:38 PM
    Edited by: user10193450 on Aug 27, 2008 9:40 PM
    Edited by: user10193450 on Aug 27, 2008 9:43 PM

    And your query will be in this lines.
    select project, for_1, for_2, for_3, for_4, for_5, for_6, for_7, for_8,
                    for_9, for_10, for_11, for_12, for_13, for_14, for_15,
                    (for_1+ for_2+ for_3+ for_4+ for_5+ for_6+ for_7+ for_8+ for_9+ for_10+ for_11+ for_12+ for_13+ for_14+ for_15) total
    from (select project, max(decode(timesheetid, 1, timespent, NULL)) for_1
                  , max(decode(timesheetid, 2, timespent, NULL)) for_2
                  , max(decode(timesheetid, 3, timespent, NULL)) for_3
                  , max(decode(timesheetid, 4, timespent, NULL)) for_4
                  , max(decode(timesheetid, 5, timespent, NULL)) for_5
                  , max(decode(timesheetid, 6, timespent, NULL)) for_6
                  , max(decode(timesheetid, 7, timespent, NULL)) for_7
                  , max(decode(timesheetid, 8, timespent, NULL)) for_8
                  , max(decode(timesheetid, 9, timespent, NULL)) for_9
                  , max(decode(timesheetid, 10, timespent, NULL)) for_10
                  , max(decode(timesheetid, 11, timespent, NULL)) for_11
                  , max(decode(timesheetid, 12, timespent, NULL)) for_12
                  , max(decode(timesheetid, 13, timespent, NULL)) for_13
                  , max(decode(timesheetid, 14, timespent, NULL)) for_14
                  , max(de(timesheetid, 15, timespent, NULL)) for_15
          from your_table
          group by project
    order by projectCheers
    Sarma.

  • List all the table names and no of records in DB.

    Hi,
    How can i write a select query which should give the total tables in the database and the number of records in each table.
    Eg: I have 2 table in the database 1. EMP 2. DEPT . EMP table has 14 records and DEPT has 4 records. Then the out put should come like following.
    TNAME RecCount
    EMP 14
    DEPT 4
    Regards
    Bond.

    Also if Table statistics have been gathered(analyze table or DBMS_STATS) then this can also be used:
    SQL> create table TEST_ABC
      2  (name_ABC varchar2(200));
    Table created.
    SQL> insert into TEST_ABC
      2  values('ABC');
    1 row created.
    SQL> insert into TEST_ABC
      2  values('DEF');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select table_name, num_rows from all_tables where table_name = 'TEST_ABC';
    TABLE_NAME                       NUM_ROWS
    TEST_ABC
    SQL> analyze table TEST_ABC compute statistics;
    Table analyzed.
    SQL> select table_name, num_rows from all_tables where table_name = 'TEST_ABC';
    TABLE_NAME                       NUM_ROWS
    TEST_ABC                                2
    SQL>

  • Search in database in all the tables

    Hi friends,
    I want to search following text in database in all the tables :
    Paris-Murex BO for BNL- Panorama(Roma) / BNL-Panorama for Paris-Murex BO(Roma)
    above text is thr in our client site which is getting retrieved from database, I know the database instance name but but dont know from which table this value (text) is comming from.
    please help it's urgent!!!

    This is a depressingly common request. Why are there so many shonky undocumented applications out there?
    Anyway, the solution for a one-off exercise is this brute force approach. It's not pretty and the performance will be Teh Suck, but it will find the string. If you think that the string might be in more than one column you should remove the EXIT and let the thing grind on for as long as it takes.
    set serveroutput on
    declare
        n number;
    begin
        for r in ( select owner, table_name, column_name
                   from all_tab_columns
                   where owner not in ('SYS', 'SYSTEM')
                   and   data_type in ('CHAR', 'VARCHAR2')
                   and   data_length >= 43 )
        loop
            dbms_output.put_line('checking!!'||r.owner||'.'||r.table_name||'.'||r.column_name);
            begin
                execute immediate 'select 1 from '||r.owner||'.'||r.table_name
                              ||' where '||r.column_name||' like ''%Paris-Murex BO for BNL- Panorama(Roma) / BNL-Panorama for Paris-Murex BO(Roma)%'''
                              ||' and rownum = 1'
                into n;
                dbms_output.put_line('found it!!'||r.owner||'.'||r.table_name||'.'||r.column_name);
                exit;
            exception
                when no_data_found
                then
                    null;
            end;
        end loop;
    end;
    /If you have CLOBs and BLOBs you want to check as well then you'll need to run through a second query using CONTAINS(). Implementing that is left as an exercise for the reader.
    Note that if you want to do this on a regular basis then you need a completely different, more architectural approach.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • How to find out all the tables in a schema with a particular column

    Hi
    Is there a way to find out all the tables in schema1 that has col1 as one of the columns?

    select table_name from dba_tab_cols where owner='schema' and column_name='col1';

  • What are all the tables used for this report:

    hi
    what are all the tables used for this report:
    report:
    •     <b>Stock Report, which will give opening balance, receipt, issue, and closing balance for any given Duration for any material.</b>
    thanks in advance

    Tables: MSEG, MKPF, MARD.
    FOR REFERENCE SEE TRANSACTION : MB5B.
    Message was edited by: Sharath kumar R

  • How to generate test data for all the tables in oracle

    I am planning to use plsql to generate the test data in all the tables in schema, schema name is given as input parameters, min records in master table, min records in child table. data should be consistent in the columns which are used for constraints i.e. using same column value..
    planning to implement something like
    execute sp_schema_data_gen (schemaname, minrecinmstrtbl, minrecsforchildtable);
    schemaname = owner,
    minrecinmstrtbl= minimum records to insert into each parent table,
    minrecsforchildtable = minimum records to enter into each child table of a each master table;
    all_tables where owner= schemaname;
    all_tab_columns and all_constrains - where owner =schemaname;
    using dbms_random pkg.
    is anyone have better idea to do this.. is this functionality already there in oracle db?

    Ah, damorgan, data, test data, metadata and table-driven processes. Love the stuff!
    There are two approaches you can take with this. I'll mention both and then ask which
    one you think you would find most useful for your requirements.
    One approach I would call the generic bottom-up approach which is the one I think you
    are referring to.
    This system is a generic test data generator. It isn't designed to generate data for any
    particular existing table or application but is the general case solution.
    Building on damorgan's advice define the basic hierarchy: table collection, tables, data; so start at the data level.
    1. Identify/document the data types that you need to support. Start small (NUMBER, VARCHAR2, DATE) and add as you go along
    2. For each data type identify the functionality and attributes that you need. For instance for VARCHAR2
    a. min length - the minimum length to generate
    b. max length - the maximum length
    c. prefix - a prefix for the generated data; e.g. for an address field you might want a 'add1' prefix
    d. suffix - a suffix for the generated data; see prefix
    e. whether to generate NULLs
    3. For NUMBER you will probably want at least precision and scale but might want minimum and maximum values or even min/max precision,
    min/max scale.
    4. store the attribute combinations in Oracle tables
    5. build functionality for each data type that can create the range and type of data that you need. These functions should take parameters that can be used to control the attributes and the amount of data generated.
    6. At the table level you will need business rules that control how the different columns of the table relate to each other. For example, for ADDRESS information your business rule might be that ADDRESS1, CITY, STATE, ZIP are required and ADDRESS2 is optional.
    7. Add table-level processes, driven by the saved metadata, that can generate data at the record level by leveraging the data type functionality you have built previously.
    8. Then add the metadata, business rules and functionality to control the TABLE-TO-TABLE relationships; that is, the data model. You need the same DETPNO values in the SCOTT.EMP table that exist in the SCOTT.DEPT table.
    The second approach I have used more often. I would it call the top-down approach and I use
    it when test data is needed for an existing system. The main use case here is to avoid
    having to copy production data to QA, TEST or DEV environments.
    QA people want to test with data that they are familiar with: names, companies, code values.
    I've found they aren't often fond of random character strings for names of things.
    The second approach I use for mature systems where there is already plenty of data to choose from.
    It involves selecting subsets of data from each of the existing tables and saving that data in a
    set of test tables. This data can then be used for regression testing and for automated unit testing of
    existing functionality and functionality that is being developed.
    QA can use data they are already familiar with and can test the application (GUI?) interface on that
    data to see if they get the expected changes.
    For each table to be tested (e.g. DEPT) I create two test system tables. A BEFORE table and an EXPECTED table.
    1. DEPT_TEST_BEFORE
         This table has all EMP table columns and a TEST_CASE column.
         It holds EMP-image rows for each test case that show the row as it should look BEFORE the
         test for that test case is performed.
         CREATE TABLE DEPT_TEST_BEFORE
         TESTCASE NUMBER,
         DEPTNO NUMBER(2),
         DNAME VARCHAR2(14 BYTE),
         LOC VARCHAR2(13 BYTE)
    2. DEPT_TEST_EXPECTED
         This table also has all EMP table columns and a TEST_CASE column.
         It holds EMP-image rows for each test case that show the row as it should look AFTER the
         test for that test case is performed.
    Each of these tables are a mirror image of the actual application table with one new column
    added that contains a value representing the TESTCASE_NUMBER.
    To create test case #3 identify or create the DEPT records you want to use for test case #3.
    Insert these records into DEPT_TEST_BEFORE:
         INSERT INTO DEPT_TEST_BEFORE
         SELECT 3, D.* FROM DEPT D where DEPNO = 20
    Insert records for test case #3 into DEPT_TEST_EXPECTED that show the rows as they should
    look after test #3 is run. For example, if test #3 creates one new record add all the
    records fro the BEFORE data set and add a new one for the new record.
    When you want to run TESTCASE_ONE the process is basically (ignore for this illustration that
    there is a foreign key betwee DEPT and EMP):
    1. delete the records from SCOTT.DEPT that correspond to test case #3 DEPT records.
              DELETE FROM DEPT
              WHERE DEPTNO IN (SELECT DEPTNO FROM DEPT_TEST_BEFORE WHERE TESTCASE = 3);
    2. insert the test data set records for SCOTT.DEPT for test case #3.
              INSERT INTO DEPT
              SELECT DEPTNO, DNAME, LOC FROM DEPT_TEST_BEFORE WHERE TESTCASE = 3;
    3 perform the test.
    4. compare the actual results with the expected results.
         This is done by a function that compares the records in DEPT with the records
         in DEPT_TEST_EXPECTED for test #3.
         I usually store these results in yet another table or just report them out.
    5. Report out the differences.
    This second approach uses data the users (QA) are already familiar with, is scaleable and
    is easy to add new data that meets business requirements.
    It is also easy to automatically generate the necessary tables and test setup/breakdown
    using a table-driven metadata approach. Adding a new test table is as easy as calling
    a stored procedure; the procedure can generate the DDL or create the actual tables needed
    for the BEFORE and AFTER snapshots.
    The main disadvantage is that existing data will almost never cover the corner cases.
    But you can add data for these. By corner cases I mean data that defines the limits
    for a data type: a VARCHAR2(30) name field should have at least one test record that
    has a name that is 30 characters long.
    Which of these approaches makes the most sense for you?

  • Recordcount for all the tables in my user

    How I will get recordcount for all the tables in my user
    with a single query??
    Plz help.
    Thanx in advance.

    Not possible. As there can be any number of tables with any names, this requires dynamic SQL.
    SQL given to the Oracle SQL Engine cannot be dynamic ito scope and references - it must be static. For example, one cannot do this:
    SELECT count(*) FROM :table
    For the SQL Engine to parse the SQL, determine if it is valid, determine the scope and security, determine an execution plan, it needs to know the actual object names. Objects like tables and columns and functions cannot be variable.
    You will therefore need to write a user function (in PL/SQL) that dynamically creates a [SELECT COUNT] SQL for a table, execute that SQL and return the row count - and then use SQL to iterate through USER_TABLES for example and sum the results of this function.
    Note that object tables are not listed in USER_TABLES - thus a more comprehensive list of all table objects in your schema can be found in USER_OBJECTS.

  • What r all the tables used for this report. please reply

    hai,
    what r all the tables used for this report.
    report :
    <b>
    •     Report to display all finished goods that go out-of-stock. Developed a drill down report for materials details (totals and subtotals for material stock values by material group and material type).</b>
    thanks in advance

    hi Ashok,
    Check this out
    http://www.allsaplinks.com/tables.html
    http://www.sapgenie.com/abap/tables.htm
    Regards,
    Santosh

  • All the tables used for Organisation details

    Hi All,
    Kindly request to specify all the tables ( or atleast possible list of tables ) that are updated when we change / insert / modify the organisation details for a transaction number in CRM.
    Thanks and regards.

    Tables updated when you change org in CRM transactions are CRMD_ORDER_INDEX , CRMD_ORGMAN

  • Script to generate all the tables and objects in a schema

    how to write a script to generate all the tables and objects in a schema.
    with toad the no of tables generated is not matching when i check from schema .

    Dear Sidhant,
    Try this script:
    set termout off
    set feedback off
    set serveroutput on size 100000
    spool ddl_schema.sql
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- DROP TABLES --');
    dbms_output.put_line('--');
        for rt in (select tname from tab order by tname) loop
            dbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS;');
        end loop;
    end;
    declare
        v_tname  varchar2(30);
        v_cname  char(32);
        v_type     char(20);
        v_null   varchar2(10);
        v_maxcol number;
        v_virg     varchar2(1);
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- CREATE TABLES --');
    dbms_output.put_line('--');
        for rt in (select table_name from user_tables order by 1) loop
            v_tname:=rt.table_name;
            v_virg:=',';
            dbms_output.put_line('CREATE TABLE '||v_tname||' (');
            for rc in (select table_name,column_name,data_type,data_length,
                                data_precision,data_scale,nullable,column_id
                    from user_tab_columns tc
                    where tc.table_name=rt.table_name
                    order by table_name,column_id) loop
                        v_cname:=rc.column_name;
                        if rc.data_type='VARCHAR2' then
                            v_type:='VARCHAR2('||rc.data_length||')';
                        elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                             rc.data_scale=0 then
                            v_type:='INTEGER';
                        elsif rc.data_type='NUMBER' and rc.data_precision is null and
                                         rc.data_scale is null then
                            v_type:='NUMBER';
                        elsif rc.data_type='NUMBER' and rc.data_scale='0' then
                            v_type:='NUMBER('||rc.data_precision||')';
                        elsif rc.data_type='NUMBER' and rc.data_scale<>'0' then
                            v_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')';
                        elsif rc.data_type='CHAR' then
                             v_type:='CHAR('||rc.data_length||')';
                        else v_type:=rc.data_type;
                        end if;
                        if rc.nullable='Y' then
                            v_null:='NULL';
                        else
                            v_null:='NOT NULL';
                        end if;
                        select max(column_id)
                            into v_maxcol
                            from user_tab_columns c
                            where c.table_name=rt.table_name;
                        if rc.column_id=v_maxcol then
                            v_virg:='';
                        end if;
                        dbms_output.put_line (v_cname||v_type||v_null||v_virg);
            end loop;
            dbms_output.put_line(');');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- PRIMARY KEYS --');
    dbms_output.put_line('--');
        for rcn in (select table_name,constraint_name
                from user_constraints
                where constraint_type='P'
                order by table_name) loop
            dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
            dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
            dbms_output.put_line ('PRIMARY KEY (');
            v_virg:=',';
            for rcl in (select column_name,position
                    from user_cons_columns cl
                    where cl.constraint_name=rcn.constraint_name
                    order by position) loop
                select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.constraint_name;
                if rcl.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            dbms_output.put_line(')');
            dbms_output.put_line('USING INDEX );');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
        v_tname        varchar2(30);
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- FOREIGN KEYS --');
    dbms_output.put_line('--');
        for rcn in (select table_name,constraint_name,r_constraint_name
                from user_constraints
                where constraint_type='R'
                order by table_name) loop
            dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
            dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
            dbms_output.put_line ('FOREIGN KEY (');
            v_virg:=',';
            for rcl in (select column_name,position
                    from user_cons_columns cl
                    where cl.constraint_name=rcn.constraint_name
                    order by position) loop
                select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.constraint_name;
                if rcl.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            select table_name
                into v_tname
                from user_constraints c
                where c.constraint_name=rcn.r_constraint_name;
            dbms_output.put_line(') REFERENCES '||v_tname||' (');
            select max(position)
                    into v_maxcol
                    from user_cons_columns c
                    where c.constraint_name=rcn.r_constraint_name;
            v_virg:=',';
            select max(position)
                into v_maxcol
                from user_cons_columns c
                where c.constraint_name=rcn.r_constraint_name;
            for rcr in (select column_name,position
                    from user_cons_columns cl
                    where rcn.r_constraint_name=cl.constraint_name
                    order by position) loop
                if rcr.position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcr.column_name||v_virg);
            end loop;
            dbms_output.put_line(') );');
        end loop;
    end;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- DROP SEQUENCES --');
    dbms_output.put_line('--');
        for rs in (select sequence_name
                from user_sequences
                where sequence_name like 'SQ%'
                order by sequence_name) loop
            dbms_output.put_line('DROP SEQUENCE '||rs.sequence_name||';');
        end loop;
    dbms_output.put_line('--');
    dbms_output.put_line('-- CREATE SEQUENCES --');
    dbms_output.put_line('--');
        for rs in (select sequence_name
                from user_sequences
                where sequence_name like 'SQ%'
                order by sequence_name) loop
            dbms_output.put_line('CREATE SEQUENCE '||rs.sequence_name||' NOCYCLE;');
        end loop;
    end;
    declare
        v_virg        varchar2(1);
        v_maxcol    number;
    begin
    dbms_output.put_line('--');
    dbms_output.put_line('-- INDEXES --');
    dbms_output.put_line('--');
        for rid in (select index_name, table_name
                from user_indexes
                where index_name not in (select constraint_name from user_constraints)
                    and index_type<>'LOB'
                order by index_name) loop
            v_virg:=',';
            dbms_output.put_line('CREATE INDEX '||rid.index_name||' ON '||rid.table_name||' (');
            for rcl in (select column_name,column_position
                    from user_ind_columns cl
                    where cl.index_name=rid.index_name
                    order by column_position) loop
                select max(column_position)
                    into v_maxcol
                    from user_ind_columns c
                    where c.index_name=rid.index_name;
                if rcl.column_position=v_maxcol then
                    v_virg:='';
                end if;
                dbms_output.put_line (rcl.column_name||v_virg);
            end loop;
            dbms_output.put_line(');');
        end loop;
    end;
    spool off
    set feedback on
    set termout on Best Regards,
    Francisco Munoz Alvarez
    www.oraclenz.com

  • How to move all the tables from one tablespace to other for a whole schema

    Hi,
    Is there any way to move all the tables in a schema from one tablespace to other?
    If so please help me out to do that.
    Thanks
    Regards
    Gatha

    hi,
    here is the steps to move SCOTT's objects from their current tablespace to a NEW_TABLESPACE
    would be:
    1) do an export of all of scott's objects. Make sure no one modifies them after you
    begin this process. You will lose these changes if they do.
    $ exp userid=scott/tiger owner=scott
    2) you would drop all of scotts tables. This will get the indexes as well. I don't
    suggest dropping the user SCOTT but rather dropping scott's objects. Dropping scott
    would cause any system priveleges SCOTT has to disappear and the import would not restore
    them. This script can be used to drop someones tables:
    set heading off
    set feedback off
    set verify off
    set echo off
    spool tmp.sql
    select 'drop table &1..' || table_name || ' cascade constraints;'
    from dba_tables
    where owner = upper('&1')
    spool off
    @tmp.sql
    3) You would modify the user to not have unlimited tablespace (else the IMP will just
    put the objects right back into the tablespace they came from) and then give them
    unlimited quota's on the new tablespace you want the objects to go into and on their
    temporary tablespace (for the sorts the index creates will do)
    alter user SCOTT default tablespace NEW_TABLESPACE
    revoke unlimited tablespace from SCOTT
    alter user SCOTT quota unlimited on NEW_TABLESPACE
    alter user SCOTT quota unlimited on SCOTTS_TEMPORARY_TABLESPACE
    4) you will IMP the data back in for that user. IMP will rewrite the create statements
    to use the users default tablespace when it discovers that it cannot create the objects
    in their original tablespace. Please make sure to review the file imp.log after you do
    this for any and all errors after you import.
    imp userid=scott/tiger full=y ignore=y log=imp.log
    5) you can optionally restore 'unlimited tablespace' to this user (or not). If you do
    not, this user can only create objects in this new tablespace and temp (which in itself
    is not a bad thing)...
    Regards,
    Mohd Mehraj Hussain
    http://mehrajdba.wordpress.com

  • Script for dropping all the tables

    Hello:
    Can somebody share with me a script that will delete all the tables in a schema?
    Thanks.

    I think what Justin was getting at is this: we cannot drop tables that are referenced by foreign keys. So before we can drop all tables weed to drop all referencing constraints. Which makes this script even more dangerous - you may wish to abort if other schemas reference the "droppee".
    Let's be careful out there!
    Cheers, APC
    declare
        cursor fks is
            select owner,table_name, constraint_name
            from all_constraints
            where r_owner='&&schema_to_delete'
            and constraint_type = 'R';
        cursor tables is
            select owner,table_name
            from all_tables
            where owner='&&schema_to_delete';
        begin
            for b in fks
            loop
                dbms_output.put_line( 'drop fk constraint '||b.owner||'.'||b.table_name||'.'||b.constraint_name);
                execute immediate 'alter table '||b.owner||'.'||b.table_name||' drop constraint '||b.constraint_name;
            end loop;
            for c in tables
            loop
                dbms_output.put_line( 'drop table '||c.owner||'.'||c.table_name);
                execute immediate 'drop table '||c.owner||'.'||c.table_name;
        end loop;
    end;
    /

Maybe you are looking for