Schema tables extract

Hi Guys...
I want to extract schema tables into .csv files.
I know for one table is as easy as doing this:
set heading off
set space 0
set pages 0
set linesize 0
set colsep '|';
set echo off
set feedback off
spool my_csv.csv
select /*+ PARALLEL(A,6) */ * from csv_tab;
spool off
exit;
How can I use recreate thus script to include to include all the tables in the schema?
Please Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If you want to create a script with all SQL-statements to re-create all tables, you should probably use something like this:
spool yourtables.sql;
declare cursor c1 is select table_name from user_tables;
query varchar2(3000) ;
begin
dbms_output.enable(1000000);
for r1 in c1 loop
query := dbms_metadata.get_ddl('TABLE', r1.table_name);
dbms_output.put_line(query||chr(10)||chr(10));
end loop;
end;
spool off;
HTH
FJFranken

Similar Messages

  • Referencing other schema table in procedure

    Hello All,
    I am writing a stored procedure and within this i have an update statement which updates a table in my own schema based on
    certain condition based on different schema table.
    CREATE OR REPLACE PROCEDURE PROC_UPD(P_TBL_NAME VARCHAR2)
    IS
    V_TBL_NAME VARCHAR2(20) := P_TBL_NAME;
    V_SQL_STMT1 VARCHAR2(9999);
    BEGIN
    V_SQL_STMT1 :=    'UPDATE '||  V_TBL_NAME ||' A '
                               ||'   SET CP   =   (SELECT   CP_I
                                                     FROM  SAM.PROD_TBL
                                                    WHERE  A.PROD_I = PROD_I)
                              WHERE A.PROD_I IN ( SELECT PROD_I
                                                    FROM SAM.PROD_TBL) ';
    EXECUTE IMMEDIATE V_SQL_STMT1 ;
    END; When i execute this by passing a table name as a parameter, it gives me an error that "Table or View does not exists".
    I can access SAM.PROD_TBL in my schema when i query using SELECT statement.
    Also, I can use the same update statement outside the procedure and it works fine without giving me any error.
    Is there something i am missing here and hence the error.
    Kindly suggest how to overcome this error.
    Regards,
    Shane

    Your privilege on this table needs to have been granted directly to the user not via a role.
    In addition, debugging may be made easier by logging or outputting this sql so that you can verify that it's correct and runs correctly via a sql session.

  • To fetch 2 fileds of table TRFCQIN (abap schema table ) through OPEN SQL

    Hi Experts,
    My basis team wants me to write a OPEN sql statement in DB2 . T
    The Open SQL statement for reading data from database tables is:
    SELECT      <result>
      INTO      <target>
      FROM      <source>
      [WHERE    <condition>]
      [GROUP BY <fields>]
      [HAVING   <cond>]
      [ORDER BY <fields>].
    I want to fetch 2 fileds of table TRFCQIN (abap schema table ) through OPEN SQL in report RSORADJV  in PI .
    As per PI basis comment : To use u201CRSORADJVu201D you need write the code in open SQL. If the code had been written in open SQL in the first place you wouldnu2019t be having to translate this from MS SQL.
    Can you pls help in writing open sql with above syntax .
    Initially when I wrote as
    QL statement : select * from SAPDBSR3.XI_AF_MSG, I got the error messege as
    Error : insufficient priviliage to access specified  table.
    Again basis suggested to write this code in OPen SQL statement .
    Please suggest., I dont know open SQL for the same.
    Regards,
    Arnab.

    Hi,
    Well I don't know why you have duplicates, this is a functionnal issue. But you get the dump due the the message number 864 that triggers the abend... Changing the message type to 'E', 'S' or 'I' will prevent the dump but I guess this message has a good reason to be
    Kr,
    Manu.

  • What's the privileges to create foreign key to a different schema.table ?

    Hi
    In my current schema I want to add a new foreign key. But this key is referencing to a table in a different schema, like this:
    Alter table some_table ADD ( Constraint FK_01 Foreign Key (L_ID) References schema.table (LL_ID));
    and getting the error - ORA-01031 insufficient privileges
    Which privileges do I need for this (At this time, I have only GRANT Select)? Any help would be much appreciated
    Best regards
    Remo

    Hi,
    You need GRANT REFERENCES object privilege to the user.
    Cheers

  • How to cancel the alter or delete purview for one's scheme table?

    I want to put down the user of some scheme table that is altered or deleted the field of its. But the scheme has the RESOURCE and CONNECT role for the user. I want to control the user can't delete or alter the table field.
    How can to do ? urgent!!
    Please tell me?
    regard.

    I'm not sure I understand your question correctly. Are you looking to audit the DDL a particular user issues or are you looking to prevent that user from issuing certain types of DDL?
    Justin

  • Query on Custom schema table getting 'Do You want to save changes' message

    Hi all,
    I am getting the error message whenever I query from the custom table. Here is the description of the issue.
    1. I have a button on the first block. When the user clicks on this button , execute_query is called on another block. Then the user getting the message "do you want to save the changes" . Although there are no changes made on the form.
    2. The second block is based on a custom table defined on the custom schema.
    3. Created public synonym for this table and also gave the all the grants to apps schema on this table.
    4. This error was not coming before when the second block is based on Apps schema table.
    Any idea on how to fix this.
    Thanks

    I doubt the problem is related to a schema or public synonym. The message is appearing because the value for an item is being changed after your query executes.
    First check to make sure that the blocks that are not based on a table are set to No. See the Database Data Block Property.
    If that doesn't solve the problem, then run the debugger and watch to see what item is changing. You may be doing something in a trigger.

  • Error in database parameter for star schema table in RSRV

    Hi Experts,
    In RSRV, I executed the following checks in my cube and it is showing me the following error:-
    1)  Check database parameter for star schema table for InfoCube ZMM_MVAL
    564971 units missing from fact table /BIC/FZMM_MVAL; see details
    Message no. RSRV134
    Diagnosis
    In the fact table /BIC/FZMM_MVAL records have been found that contain values other than zero for key figures that have units, but that have no value for the unit of the key figure. Since the value of the unit has to correspond to the value of the key figure, this inidicates an error when the data was loaded. The values of the units have not been loaded into BW correctly. Choose Details to display the incorrect records.
    2)  Consistency of time dimension of InfoCube ZMM_MVAL
    /BIC/FZMM_MVAL PARTITIONED 1878 ( 30 - 50 )
    Please advise me on this.
    Thanks in Advance.
    Aparna

    As mentioned in the log, check the Unit KFs in your cube and make sure that unit is populated for all such values.
    e.g. if Qty is 5 KG, then unit KF will have 5 and unit info object should have KF.
    Regards,
    Gaurav

  • A partition tab is needed in the schema-table browser and it's missing

    After a first sight with the product, I couldn't find a partition tab in the schema-table browser.
    For those having partitions it is absolutely essential.

    It's easy to add,
    create a file that has the following content
    <?xml version="1.0" encoding="UTF-8"?>
    <items>
    <item type="sharedQuery" id="PartSubPartkeys">
    <query minversion="9">
         <sql>
         <![CDATA[ select 'PARTITION KEYS' PARTITION_LEVEL,substr(sys_connect_by_path(column_name,','),2) "PARTITION KEYS"
                   from (select column_name, column_position
                   from all_part_key_columns
                   where owner = :OBJECT_OWNER
                   and name = :OBJECT_NAME
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1
                   union all
                   select 'SUBPARTITION KEYS' ,substr(sys_connect_by_path(column_name,','),2)
                   from (select column_name, column_position
                   from all_subpart_key_columns
                   where owner = :OBJECT_OWNER
                   and name = :OBJECT_NAME
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="PartSubPartkeysFI">
    <query minversion="9">
         <sql>
         <![CDATA[ select 'PARTITION KEYS' PARTITION_LEVEL,substr(sys_connect_by_path(column_name,','),2) "PARTITION KEYS"
                   from (select column_name, column_position
                   from all_part_key_columns
                   where owner = :OBJECT_OWNER
                   and name = (select table_name
                             from all_indexes
                             where index_name=:OBJECT_NAME
                             and owner=:OBJECT_OWNER)
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1
                   union all
                   select 'SUBPARTITION KEYS' ,substr(sys_connect_by_path(column_name,','),2)
                   from (select column_name, column_position
                   from all_subpart_key_columns
                   where owner = :OBJECT_OWNER
                   and name =(select table_name
                             from all_indexes
                             where index_name=:OBJECT_NAME
                             and owner=:OBJECT_OWNER)
                   and object_type='TABLE' )
                   start with column_position=1
                   connect by column_position=prior column_position+1]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="Partitions">
    <query minversion="9">
         <sql>
         <![CDATA[ select partition_name,  num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME order by partition_position]]></sql>
         </query>
         </item>
    <item type="sharedQuery" id="SubPartitions">
    <query minversion="9">
         <sql>
         <![CDATA[ select subpartition_name, partition_name,  num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME order by partition_name,subpartition_position]]></sql>
         </query>
         </item>
    <item type="editor" node="TableNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeys" />
    <subquery>
    <title>Partitions/SubPartition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'SUBPARTITION KEYS' =:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeys" />
    <subquery>
    <title>Partitions/SubPArtition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,
             high_value,compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED
             from all_tab_partitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,
             compression,num_rows,AVG_ROW_LEN, blocks ,LAST_ANALYZED
             from all_tab_subpartitions where table_owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and 'SUBPARTITION KEYS' =:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="IndexNode" >
    <title><![CDATA[Partitions/SubPartitions]]></title>
    <query id="PartSubPartkeysFI" />
    <subquery>
    <title>Partitions/SubPArtition</title>
    <query>
    <sql><![CDATA[select partition_position, partition_name "Partition/Subpartition",  tablespace_name,high_value,compression,
             Leaf_Blocks, Distinct_Keys, clustering_factor ,LAST_ANALYZED
             from all_ind_partitions where index_owner = :OBJECT_OWNER and index_name = :OBJECT_NAME
             and 'PARTITION KEYS'=:PARTITION_LEVEL
             union all
             select subpartition_position, partition_name||'/'||subpartition_name, tablespace_name,high_value,compression,
             Leaf_Blocks, Distinct_Keys, clustering_factor ,LAST_ANALYZED
             from all_ind_subpartitions
             where index_owner = :OBJECT_OWNER
             and index_name = :OBJECT_NAME
             and 'SUBPARTITION KEYS'=:PARTITION_LEVEL
             order by 2]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[Unabridged SQL]]></title>
    <query>
    <sql><![CDATA[select :OBJECT_OWNER OOWNER, :OBJECT_NAME ONAME, 'TABLE' OTYPE from dual union all select owner,index_name,'INDEX' from all_indexes where table_owner= :OBJECT_OWNER and table_name=:OBJECT_NAME ]]></sql>
    </query>
    <subquery type="code">
    <query>
    <sql><![CDATA[select dbms_metadata.get_ddl(:OTYPE,:ONAME, :OOWNER) "SQL Statements" from dual]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[Partition Columns Statistics]]></title>
    <query id="Partitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS
             from all_part_col_statistics where owner = :OBJECT_OWNER
             and table_name = :OBJECT_NAME
             and partition_name= :PARTITION_NAME
             order by column_name]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="TableNode">
    <title><![CDATA[SUBPartition Columns Statistics]]></title>
    <query id="SubPartitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS from all_subpart_col_statistics where owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and subpartition_name=:SUBPARTITION_NAME order by column_name]]></sql>
         </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode">
    <title><![CDATA[Partition Columns Statistics]]></title>
    <query id="Partitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS
             from all_part_col_statistics where owner = :OBJECT_OWNER
             and table_name = :OBJECT_NAME
             and partition_name= :PARTITION_NAME
             order by column_name]]></sql>
    </query>
    </subquery>
    </item>
    <item type="editor" node="MViewNode">
    <title><![CDATA[SUBPartition Columns Statistics]]></title>
    <query id="SubPartitions" />
    <subquery>
    <query>
         <sql>
         <![CDATA[ select COLUMN_NAME, NUM_DISTINCT, LOW_VALUE, HIGH_VALUE, DENSITY, NUM_NULLS from all_subpart_col_statistics where owner = :OBJECT_OWNER and table_name = :OBJECT_NAME and subpartition_name=:SUBPARTITION_NAME order by column_name]]></sql>
         </query>
    </subquery>
    </item>
    <item type="editor" node="SchemaFolder" minversion="10.1">
    <title><![CDATA[Sessions]]></title>
    <query>
    <sql><![CDATA[select sid,serial#,program,last_call_et,machine, status, sql_hash_value shv,sql_child_number scn
             from v$session
             order by 1]]></sql>
    </query>
    <subquery>
    <query>
    <sql><![CDATA[select * from table(dbms_xplan.display_cursor(:SHV,:SCN))]]></sql>
    </query>
    </subquery>
    </item>
    </items>
    and add the following line to your ide.conf file (in jdev/bin directory in the sqldev install dir)
    AddVMOption -Draptor.user.editors=fullpathofthefile(dir and name)
    and restart, you'll get several additional tabs to the ones displayed for tables.
    enjoy

  • How to make a copy of an application with its schema-tables,data and all

    Good day,
    I am looking for the best way to make a copy of an application from one computer to another, including the schema (tables, data and all) in Apex3.2.
    I can only manage to make a copy of the application without the data using the export utility
    Please assist with this difficulty
    Kind Regards
    Thabo
    Edited by: Thabo K on Jun 1, 2009 1:13 AM

    Hello,
    To copy across the data you can use the traditional EXP/IMP or the Datapump utility.
    If you're used to using EXP/IMP I'd encourage you to look at Datapump, if you haven't used EXP/IMP before I'd encourage you to look at Datapump (datapump rocks) -
    http://www.oracle-base.com/articles/10g/OracleDataPump10g.php
    There are a few major differences between Datapump and traditional EXP/IMP (EXP/IMP creates the export file on the client side, Datapump creates it on the server side etc).
    In my book "Pro Oracle Application Express" I have a section on cloning applications/data between instances, which you might find useful.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Where to find Oracle Apps HR schema table structures?

    Hi!
    Can someone guide me to the link where I can find the HR schema table structures for Oracle E-Biz suite 11.5.10?
    Previously, i used to get them under Top Tech Docs on the metalink.
    Thanks and regards,
    Aparna

    Hi Aparna,
    You can also find in http://irep.oracle.com/index.html
    Regards,
    Naga Suresh. Challapalli

  • Create user who can update another schema table

    Hi,
    We have a prod system under which we need to update  the application schema by running different update statement and  create/execute function,procedure,package body. This is very easy if you use the owner schema. But i need to run those activities from another user due to some restriction. How can i do that??
    May u suggested to give update any table privilege..but this would give all the dictionary table access also.
    Is there any privilege that would allow any other user to update another schema table without using the schema name infront of the table name??
    Plss suggest

    John,
    Can we use public synonym for it ?  I don't know the security risk for it though :
    SQL> connect hr/hr
    Connected.
    SQL> select * from scott.emp;
    select * from scott.emp
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> connect scott/tiger
    Connected.
    SQL> create public synonym scotemp for scott.emp;
    Synonym created.
    SQL> connect hr/hr;
    Connected.
    SQL> select * from scotemp;
    select * from scotemp
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> connect scott/tiger
    Connected.
    SQL> grant select on emp to hr;
    Grant succeeded.
    SQL> connect hr/hr
    Connected.
    SQL> select * from scotemp;
    14 rows selected.
    SQL> show user;
    USER is "hr"
    SQL> update scotemp set ename='SMITHX' where empno=7369;
    update scotemp set ename='SMITHX' where empno=7369
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL> connect scott/tiger
    Connected.
    SQL> grant update on emp to hr;
    Grant succeeded.
    SQL> connect hr/hr
    Connected.
    SQL> update scotemp set ename='SMITHX' where empno=7369;
    1 row updated.
    SQL> rollback;
    Rollback complete.
    SQL>
    Regards
    Girish Sharma

  • Sh Schema Tables

    Hi does anybody know where can I download the SH schema tables and the sql demo programs ????
    I cant found it on OTN....
    Thanks

    If you are interested in this tables for demonstration or learning purposes, you might consider the OLAPTRAIN schema. This is the basis for Oracle by Example tutorals and other collateral. OLAPTRAIN can be found on OTN at http://www.oracle.com/technology/products/bi/olap/olap_downloads.html#sample There are versions for both 10.2 and 11.1/11.2 .

  • Script or direction to add sample schema tables to database

    I created a Database at installation time of oracle 10g exempting the sample schema tables to be added later. Iam ready to add it now and I can not find the way. Please, how?

    Hi srideeq,
    The sample schema you can find in
    ORACLE_HOME/demo/schema
    Cheera,
    Kamalesh JK

  • Query to search in all schema tables for a 'filed value'

    Hi,
    Can u help me out on this ?.
    I want a sql query to search for one field value in all the schema table.
    or do we have something in toad to check for this

    Please follow this thread.
    How to select all records from all tables where SCORE = 99
    -aijaz

  • Export schema table structure only- no procedures

    Hi Friends,
    I try to export a schema structure with rows=n option in exp command. As log records show the procedures had exported too.
    Do we have any way to export a schema tables only?
    Thanks for help!
    Jin

    user589812 wrote:
    Database is 10.2.04 I are not able to use data pump based on system configuration.Please elaborate on what you mean by "I are not able to use data pump based on system configuration"
    We have more one hundred tables. that needs to be include tables option.
    Do you have any simple way to export a schema tables structure without list 120 table's name in exp command?
    Edited by: user589812 on Jan 4, 2012 10:19 AMI do not believe you have a choice. One method could be to get a list of all needed tables (SELECT TABLE_NAME FROM USER_TABLES) and create a par file with this list.
    HTH
    Srini

Maybe you are looking for