DBMS_METADATA carraige returns in generated script problem

Hi,
does anyone know how to change the line length of the ddl generated by the DBMS_METADATA package. I'm trrying to generate ddl for a set of tables but when its generated i get the following problem
CREATE TABLE "MYUSER"."APP_SEARCH"
(     "USER_ID" NUMBER(5,0) NOT NULL ENABLE,
     "SEARCH_ID" NUMBER(5,0) NOT NULL ENABLE,
     "COMMENTS" VARCHAR2(100),
     "CRITERIA" LONG,
     "SEARCH_NAME" VARCHAR2(60),
     "DATE_CREATED" DATE,
     CONSTRAINT "PK_APP_SEARCH" PRIMARY KEY ("USER_ID", "SEARCH_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 TABLESPACE "TS_PK_INDEX_APPLIC
ATION_SMALL" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 LOGGING TABLESPACE "TS_APPLIC
ATION_SMALL"
The problem being the TS_APPLICATION_SMALL table space name goes across 2 lines, since I am generating this into a script to be run later, the script doesn't work as it thinks the tablespace name is TS_APPLIC. I think the DBMS_METADAT package uses a fixed varchar2 width when createing the ddl inside the returned CLOB. Any ideas on how to get around this?
Many Thanks,
Trev.

Joel,
thanks for the feedback,
I'm using the following script to generate the required create table script:
set linesize 4000
set heading off;
set echo off;
Set pages 0;
set long 90000;
spool createdummytable.sql
execute DBMS_METADATA.SET_TRANSFORM_PARAM( DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
select dbms_metadata.get_ddl('TABLE','APP_SEARCH')||';' from dual;
execute DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');
spool off
set heading on
set feedback on
exit
But even with the linesize set to 4000 I get the same problem. I wanted to generate the script on the client not on the server using DBMS_OUTPUT, any ideas and many thanks again,
Trev

Similar Messages

  • Sql developer database diff - generate script not working

    Using SQL devleloper 2.1. Database diff generate script gives errors making it completely non-usable
    ORA-31600: invalid input value 0 for parameter SEGMENT_ATTRIBUTES in function SET_TRANSFORM_PARAM
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 8150
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9270
    ORA-06512: at "SYS.DBMS_METADATA", line 4757
    ORA-06512: at line 1
    and
    Illegal Lock State: executeOracleQuery requires connection lock to be held. oracle.dbtools.raptor.diff.oracle.table.DiffTableRefConstraints.setup(DiffTableRefConstraints.java:215) called oracle.dbtools.db.DBUtil.executeQuery(DBUtil.java:681) without it
    I do get the differences visually (yes, I am bugged that constraints are not smart enough to compare on content of the constraint....problem when the contstraint names are sys-nnnnnn generated). Just cannot create the script.
    Any ideas to solve this issue? Thanks in advance, Kelly

    Can reproduce same issue in 11gR1.. DIFF works fine in 10gR2.
    I noticed that 10gR2 allows something like:
    DBMS_METADATA.SET_TRANSFORM_PARAM(th,'SEGMENT_ATTRIBUTES',0);
    and 11GR2 returns error similar to error SQLNAVIGATOR returns while running diff:
    DBMS_METADATA.SET_TRANSFORM_PARAM(th,'SEGMENT_ATTRIBUTES',0);
    end;
    Error report:
    ORA-31600: invalid input value 0 for parameter SEGMENT_ATTRIBUTES in function SET_TRANSFORM_PARAM
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 8424
    ORA-06512: at "SYS.DBMS_METADATA_INT", line 9484
    ORA-06512: at "SYS.DBMS_METADATA", line 3950
    Its safe to assume that this is SQLDEVELOPER bug. Hope it will be addressed sometime.
    Edited by: user5420304 on Jun 15, 2010 10:29 AM

  • Runtime-Error after deploying a mapping with the generated script

    For example a very easy scenario:
    1. Create a table and a view in a DB-schema, witch ist registered as WB-target-schema with the following scripts:
    create view v1(c1) as select 'a' c1 from dual;
    create table t1(c1 varchar2(1));
    2. Import the table and the view into a OWB-module
    3. Create a mapping ‘m1’
    4. Drag and drop view and table into the mapping
    5. Draw an arrow from the view-column to the table-column
    6. Save and close the mapping
    7. Mark the mapping in the ‘Design Center’ and klick the ‘Generate’-Button
    8. Save the generated script ‘M1.pls’ to file
    9. Run the script in SQL*Plus, connected with the target-schema (without using the Control Center Manager)
    => very easy right now ;-)
    10. Start the mapping with the following script will produce the following error
    SQL> declare
    2 v_status varchar2(100);
    3 begin
    4 m1.main(v_status);
    5 end;
    6 /
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at "OWB_OWN.WB_RT_MAPAUDIT_UTIL", line 1027
    ORA-06512: at "SCOTT.M1", line 2048
    ORA-06512: at line 4
    If i delete or comment the four WB_RT_MAPAUDIT_UTIL-calls - it work´s fine!
    But is this a good advise?
    What exactly does the wrapped package ‘WB_RT_MAPAUDIT_UTIL do?
    Thanks
    jwehner

    I just ran into the same problem myself. I used the same technique of saving the generated OWB script to file and then compiling it through sqlplus. When I used the "Deploy" option for the mapping, then the problem went away. So when OWB is deploying the code it seems to be setting something internally that doesn't get set when you simple compile the PL/SQL. I don't know of any workaround to this. I will need it eventually, since I don't want to use the UI to deploy to various test environments and production. Maybe the built-in scripting language is the way to go.

  • Adding carraige Return at the end of the file

    The following is my Shell script which will transfer the File from one path to another:
    The file is having /n(Line Feed) at the end of earch line,but the client required a Carraige Return /r along with Line Feed for all the lines in the Output File.
    Please guide me how to add Carraige Return before Line Feed
    The following is the Shell Script:
    #!/bin/bash
    login_usr_pwd=$1
    conc_user_id=$2
    conc_user_name=$3
    requestid=$4
    prev_req_id=$5
    report_type=$6
    batch_name=$7
    file_name="o$prev_req_id.out"
    echo $report_type
    echo $batch_name
    echo $file_name
    if [ "$report_type" = "EFT" ]
    then
    file_1="$batch_name.aba"
    echo "EFT-----------"
    echo $file_1
    echo "-----------"
    tr -d '<#***#>' < $COMMON_TOP/admin/$APPLOUT/$file_name > $XXAP_TOP/out/"$file_1"
    chmod 777 $XXAP_TOP/out/"$file_1"
    else
    file_1="out_1_$prev_req_id.txt"
    echo $file_name
    echo $file_1
    tr -d '<#***#>' < $COMMON_TOP/admin/$APPLOUT/$file_name > $XXAP_TOP/out/$file_1
    chmod 777 $XXAP_TOP/out/$file_1
    fi
    Best Regards,
    Mahi

    add chr(10)+chr(13) (dos/windws line ending): unix2dos <file>remove chr(10)+chr(13), make end of line only chr(10): dos2unix <file>

  • SQL Loader - CSV Data file with carraige returns and line fields

    Hi,
    I have a CSV data file with occasional carraige returns and line feeds in between, which throws my SQL loader script off. Sql loader, takes the characters following the carraige return as a new record and gives me error. Is there a way I could handle carraige returns and linefeeds in SQL Loader.
    Please help. Thank you for your time.
    This is my Sql Loader script.
    load data
    infile 'D:\Documents and Settings\user1\My Documents\infile.csv' "str '\r\n'"
    append
    into table MYSCHEMA.TABLE1
    fields terminated by ','
    OPTIONALLY ENCLOSED BY '"'
    trailing nullcols
    ( NAME CHAR(4000),
    field2 FILLER,
    field3 FILLER,
    TEST DEPT CHAR(4000)
    )

    You can "regexp_replace" the columns for special characters

  • Generate script for filling table

    Hi all,
    I've got table at test Oracle server table1 with columns ID, BTYPE, MYDESCRIPTION. Rows of this table have been inserted manually. Now my need is to write script for creating table (structure + data). I think about writing something like
    CREATE TABLE table 1
    AS
    SELECT 1 AS ID, 'TYPE1' AS BTYPE, 'SOME TEXT' AS MYDESCRIPTION
    UNION ALL
    SELECT 2 AS ID, 'TYPE2' AS BTYPE, 'SOME TEXT 2' AS MYDESCRIPTION
    But rows are too many to type... Could you please suggest some way of generating script for creating table at working server using existing table at test server? The problem is I don't have an access to working server.
    Thanks ahead.

    Use the view user_tab_cols
    say
    declare
    cursor c1 is
    select 'e_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'DEPARTMENTS'
    union
    select 'd_'||column_name ||' '||data_type||' ('||data_length||') ' col
      from user_tab_cols
      where table_name = 'EMPLOYEES';
    v1 varchar2(500);
    begin
    v1 := 'create table new_tabl (';
    for i in c1 loop
    v1 := v1||i.col||',';
    end loop;
    v1 := substr(v1,1,length(v1)-1);
    dbms_output.put_line(v1||')');
    end;
    /i am using employees and departments table of hr schema.
    now as both the tables have some column column so i have used e for employees and d for departments
    just do one thing remove the length for date data type in o/p i dont know why it is not working.
    this will give you structure for data use any sql stmt
    Edited by: 810345 on Jun 9, 2011 9:58 PM

  • Migration Workbench generates scripts that won't run

    If the source db contains objects with names approaching 30 characters, the migration workbench will generate scripts with name clashes for tables, sequences and triggers, e.g
    e.g. In source db, table name = task_deliverables_reviews_data , has one auto-inc field. SQL Developer tries to create a table , sequence and trigger all of the same name. I think this happens because to generate the relevant seq and trg, it appends SEQ and TRG to the object name, but then truncates it back to 30 chars!
    Unfortunately renaming the objects in the 'converted model' section of the workbench has no impact as renaming the objects does not alter the generated code. e.g. rename the sequence, but the trigger will still refer to the original name.

    Okay, I think I found my problem.
    I was trying to run the script created by Oracle Explorer directly from a Database project I added to my Solution in Visual Studio. Visual Studio is probably using some SQL Server specific tool when I select the Run or Run On option on the script.
    When running the same script directly in the Oracle 10g Home Page (Home > SQL > SQL Scripts), I had no problem. Everything executes correctly.
    Is anyone aware of another way to run Oracle scripts directly from Visual Studio? Do I have my project setup incorrectly? This is the first project I've used .NET and Oracle together, so if anyone has any suggestions, I'd really appreciate the help.
    Thanks,
    Mycole

  • Generating Scripts of permissions in Security

    Hi Steven and Sandra,
    How are you ?
    I'm interested in JheadStart too much :-)
    I'm using 10.1.3.3.0 version of JHeadStart.
    I want to customize the jhsPermissionsdata.vm and fileGenerator.vm Velocity Templates.
    Because they are generating scripts for permissions of Group Level only.
    But I want to generate permissions of Item Level also.
    What can i change to be able to generate permissions for Item Level?
    Please, Reply me ASAP
    Thanks alot....
    Rabab Youssef,
    J2EE Developer

    Rabab,
    Currently we have no support for generic item permissions in JHeadstart. The problem is in how to specify in the Application Definition what rendered (or isUpdateable) expression you want for each item. You would have to hard code the expressions for every item.
    For groups, JHeadstart supports $GROUP_NAME$, but there is no item equivalent.
    kind regards,
    Sandra

  • Delete generated script

    hi,
    I'm quite new to APEX and I tried to generate ddl of my schema, which was not a problem at all. But I chose to save it on file, which then generates a script.
    The problem is that I cannot open this script in the editor, beacuse my browser (both mozilla and ie7) hang.
    When I try to delete this generated script, it takes so long, that I canceled the delete option. Is there another way to delete this script?
    tnx in advance!

    Hello
    If you're using Windows, have you tried (SHIFT+DEL)
    This will DELETE a file as opposed to sending it to your Recycling Bin (which may be taking time).
    The only point worth mentioning here is that a SHIFT+DEL really does Delete a file. You won't be able to get it back.
    Kind regards
    Simon

  • How to get feedback messages for schema creation script created by Tasks- Generate Script

    I am using sql server 2008 R2. I created a script file by using Tasks->Generate Scripts. I 
    selected option so only create statements are generated for all objects – tables, indexes, views, functions etc in the database.
    Then when I used this generated  script to create objects in another database in SSMS, it created the objects but did
     not give me any feed back, i.e., table created, view created etc. I thought my script did not run , but when I refreshed left panel 
    of SSMS and I can see all created objects.. So question is what  is needed to get 
    feedback when  sql statements are run..

    You need to add the PRINT statements yourself for that. The wizard will not do it for you.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Question about DBCA generate script o create RAC database 2 node cluster

    Question about creating two node RAC database 11g after installing and configuration 11g clusterware. I've used DBCA to generate script to create a rac database. I've set
    environment variable ORACLE_SID=RAC and the creating script creates instance of RAC1 and RAC2. My understanding is that each node will represent a node, however there should only be one database with a name of 'RAC'. Please advise

    You are getting your terminology mixed up.
    You only have one database. Take a look, there are one set of datafiles on shared storage.
    You have 2 instances which are accessing one database.
    Database name is RAC. Instance names are RAC1, RAC2, etc, etc.
    Also, if you look at the listener configuration and if your tnsnames is setup properly then connecting to RAC will connect you to either one of the instances wheras connecting to RAC1 will connect you to that instance.

  • Generate Scripts in SQL Server 2008 R2 producing Error "Item has already been added.:

    I am trying to run a Generate Scripts Task on a Database to generate a script for every object in the DB including tables, SPs, UDFs, FKs, PKs, with the settings for Schema Only, Script Drop and Create, Script "if not Exists", use database,
    and Object level permissions. 
    I have used generate scripts before to generate this database about 5 months ago and every thing worked fine. 
    Today I first tried to generate it out on a server where I only have "db_Owner" for several databases.  This failed with the error.
    Microsoft.SqlServer.Management.Smo.FailedOperationException: Discover dependencies failed. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name='VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']' Key being added: 'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name='VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']' at System.Collections.SortedList.Add(Object key, Object value) at Microsoft.SqlServer.Management.Smo.DependencyTree..ctor(Urn[] urns, DependencyChainCollection dependencies, Boolean fParents, Server server)
    So I tried tto do this on a local version of the database where I have sa rights.  Same error.
    Can someone advise me on what is going on here and how do I fix it?
    Edward R. Joell MCSD MCDBA

    How do you generate the script via SMO?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL Developer 3.0.04 generated scripts not compatible with Oracle 10g (XE)

    HI,
    I tried to do an export from one XE database (still 10g) to another XE database. (also 10g).
    I tried to do a database copy as well as a separate export and import (by loading the file and running as a script).
    Neither of them work without modifying the files as it seems that SQL Developer generates scripts that are only compatible with Oracle 11g.
    - Create table contains "segment creation automatic"
    - Storage clauses contain parts that are not compatible with 10g
    I ran through the wizard several times but neither can I find an option to choose for compatibility with earlier versions of Oracle.
    Checked the preferences screen as well.
    Is this a well hidden option or is it not possible to make this work for 10g.
    Extra : found workaround by removing the storage clause to the export. Is there another way that does not force me to remove the storage clause?
    Edited by: kcaluwae on 24-jun-2011 6:03

    I'm sure this is far from the supported way to fix this but, seeing that it's apparently an issue with the classpath or something in it, I hacked <sqldeveloper_install>\sqldeveloper\bin\sqldeveloper.bat and added [ORACLE_HOME]\jdbc\lib\ojdbc6.jar to the classpath. At least that gets me started with 3.0 and lets me create TNS connections.
    I'd really appreciate a better solution, if any of you kind folks knows of something.
    Thanks,
    Kelly

  • How to remove carraige return from the field while loading external table

    I am facing an issue of not getting rid of carraige returns present in the fileds of the source .csv file while loading the records into external table.
    I had tried using LRTRIM, but it does not help.
    The error I am getting is:
    KUP-04021: field formatting error for field POPULATION_DESCRIPTION
    KUP-04037: terminator not found
    I am pasting one record out of the .csv file which is causing this error as below:
    "Business Card Accounts
    ",123,7 BizCard - Gamers,Control,"Business Card Accounts
    ",75270,75271
    You can see the carraige return in the 1st field as well as 5th field. Filed are separated by commas & eclosed by double quotes.
    Could anybody help on this please?

    Can you copy the file to an external table only version, and then dos2unix it?
    Alternatively, you can use the ACCESS PARAMETERS area in your external table definition to set that your RECORDS DELIMITED BY carriage returns, instead of the default.
    Check out the example here http://www.psoug.org/reference/externaltab.html

  • To generate Script of  procedures/functions and packages with grants

    Hi
    is there wome way for to generate Source Code Script of the some functions, procedures and Packages in file
    I must to generate Script withall grants
    Tia

    Datapump export with Content=Metadata_only.
    Use SQLFILE option to generate the Schema DDL which
    includes
    tables,indexes,grants,stats,procedures,triggers,views
    etc...Sorry, I'm using 10g , but I don't know to use DataPump, is there other method ?
    Thanks

Maybe you are looking for

  • 3 questions: 1) I am unable on my Mac Book Pro to enable iCloud Photo sharing in iPhoto preferences, why not? I cannot see my iCloud drive contents.Why not?

    Having a Macbook Pro i have taken and loaded in 569 photos from my cameras and want to share using iCloud. But I simply cannot get iPhoto to enable iCloud photo sharing. What could be the cause? what should I try other than the instructions which I f

  • BDC for Product master

    Hi Gurus, I am implementing CRM 5.0 standalone in a Bank. Here I need to upload product master thru BDC. There is some text in each product master which I am trying to maintain in "Basic Text" in View "Financing" . Now when I am recording thru SHDB b

  • Changing an Attribute Dimension Hierarchy

    I've had problems changing custom attribute hierarchies and I'm wondering if others have had similar problems and have a way to get around this.  I have an attribute (Program) of my entity field that currently looks like: Program Finance P10001 P1000

  • Issue with F.27

    H Gurus, I am executing the transaction F.27 for a Customer master and company code, but system is not generating the print out automatically? Can some one have worked on this requirement where in system will generate the print out automatically afte

  • Proof of Concept Thunderbolt backdoor

    Hello Community, I've red today an Article (http://arstechnica.com/security/2015/01/worlds-first-known-bootkit-for-os-x-can- permanently-backdoor-macs/) that explains an infection about thunderbolt  devices. I know that you need physical access to co