Using DBMS_METADATA.PUT with large documents
Hi all,
I am using the DBMS_METADATA functions and procedures to programmatically store and re-creating database objects. All was working well until I ran into some large create scripts (particularly on partitioned indexes and tables). If I only have a few partitions, the DBMS_METADATA.PUT successfully creates the index, but if my table has 40 partitions, the DBMS_METADATA.PUT fails.
I came across one post that indicated that this is the result of the EXECUTE_IMMEDIATE being restricted to 32K.
If that is the case, has anyone successfully found a workaround that will allow me to recreate tables and indexes that have large create scripts.
Thanks
Steve
Again a post with no version number so anyone trying to help has to guess.
In 11g Oracle merged NDS and DBMS_SQL so that limit no longer exists. In previous versions back to, probably, 7.3.4 you can use the DBMS_SQL built-in package.
Look at the example "execute_plsql_block" in Morgan's Library at www.psoug.org under DBMS_SQL.
In 10gR2 and 11gR1, and possibly earlier versions but I do not recall, dbms_metadata.put has a clob option. Look at the demo, again, in Morgan's Library under the package's name.
But if the point is partitioned indexes be sure you familiarize yourself with DBMS_PCLXUTIL too.
Similar Messages
-
Using PDF creator with excel documents scanned
Hello,
I´m using for the first time PDF converter and it isn't working as I expected. I'm trying to convert to excel a scanned document (created in excel) but it doesn't recognize all the number, it lefts a lot of blanked lines, unconfigures everything!
Can anyone give me a help?
Thank you.Ok. So after the pending status my problem will be solved? Will I be warned soon as my state changes?
Thank you.
De: florencejohn
Enviada: terça-feira, 21 de Outubro de 2014 13:45
Para: Ascende Lda.
Assunto: Using PDF creator with excel documents scanned
Using PDF creator with excel documents scanned
created by florencejohn <https://forums.adobe.com/people/florencejohn> in Adobe ExportPDF - View the full discussion <https://forums.adobe.com/message/6851076#6851076> -
Not able to create an object using dbms_metadata.put function
Hi,
I have the metadata of an object in one of my database table as xml. I failed to recreate the object in the other schema using metadata api. I developed a stored function to do the above job. My function doesn't throw any error meanwhile it doesn't create the object.
My code snippet is
CREATE OR REPLACE PROCEDURE DDI.move_table(
table_name in VARCHAR2,
from_schema in VARCHAR2,
to_schema in VARCHAR2 )
AUTHID CURRENT_USER
IS
-- Define local variables.
h1 NUMBER; -- handle returned by OPEN
h2 NUMBER; -- handle returned by OPENW
th1 NUMBER; -- handle returned by ADD_TRANSFORM for MODIFY
th2 NUMBER; -- handle returned by ADD_TRANSFORM for DDL
xml XMLTYPE; -- XML document
errs sys.ku$_SubmitResults := sys.ku$_SubmitResults();
err sys.ku$_SubmitResult;
result BOOLEAN;
BEGIN
SELECT REPOS INTO xml from ddi.ddi_repos_t where obj_id = '1801';
-- Specify the object type using OPENW (instead of OPEN).
h2 := DBMS_METADATA.OPENW('TABLE');
-- First, add the MODIFY transform.
th1 := DBMS_METADATA.ADD_TRANSFORM(h2,'MODIFY');
-- Specify the desired modification: remap the schema name.
DBMS_METADATA.SET_REMAP_PARAM(th1,'REMAP_SCHEMA',from_schema,to_schema);
-- Now add the DDL transform so that the modified XML can be
-- transformed into creation DDL.
th2 := DBMS_METADATA.ADD_TRANSFORM(h2,'DDL');
-- Call PUT to re-create the object.
result := DBMS_METADATA.PUT(h2,xml,0,errs);
DBMS_METADATA.CLOSE(h2);
IF NOT result THEN
-- Process the error information.
FOR i IN errs.FIRST..errs.LAST LOOP
err := errs(i);
FOR j IN err.errorLines.FIRST..err.errorLines.LAST LOOP
dbms_output.put_line(err.errorLines(j).errorText);
END LOOP;
END LOOP;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20510,'No xml is available as metadata');
END;
Could you tell me where is the probelm?
The schema where i created and execute my function having dba privilege also.
Regards,
Madhavi.Hi Madhavi,
The below code works for me:
SQL> conn sys as sysdba
Connected.
SQL> select count(*) from dba_objects where object_name = 'DEPT' and owner = 'OE';
COUNT(*)
0
SQL> CREATE OR REPLACE PROCEDURE move_table(
2 table_name in VARCHAR2,
3 from_schema in VARCHAR2,
4 to_schema in VARCHAR2 )
5 AUTHID CURRENT_USER
6 IS
7 -- Define local variables.
8 h1 NUMBER; -- handle returned by OPEN
9 h2 NUMBER; -- handle returned by OPENW
10 th1 NUMBER; -- handle returned by ADD_TRANSFORM for MODIFY
11 th2 NUMBER; -- handle returned by ADD_TRANSFORM for DDL
12 xml clob; -- XML document
13 errs sys.ku$_SubmitResults := sys.ku$_SubmitResults();
14 err sys.ku$_SubmitResult;
15 result BOOLEAN;
16 BEGIN
17
18 select DBMS_METADATA.GET_XML('TABLE','DEPT','SCOTT') into xml from dual;
19
20 -- Specify the object type using OPENW (instead of OPEN).
21 h2 := DBMS_METADATA.OPENW('TABLE');
22
23 -- First, add the MODIFY transform.
24 th1 := DBMS_METADATA.ADD_TRANSFORM(h2,'MODIFY');
25
26 -- Specify the desired modification: remap the schema name.
27 DBMS_METADATA.SET_REMAP_PARAM(th1,'REMAP_SCHEMA',from_schema,to_schema);
28
29 -- Now add the DDL transform so that the modified XML can be
30 -- transformed into creation DDL.
31 th2 := DBMS_METADATA.ADD_TRANSFORM(h2,'DDL');
32
33 -- Call PUT to re-create the object.
34 result := DBMS_METADATA.PUT(h2,xml,0,errs);
35
36 DBMS_METADATA.CLOSE(h2);
37 IF NOT result THEN
38
39 -- Process the error information.
40 FOR i IN errs.FIRST..errs.LAST LOOP
41 err := errs(i);
42 FOR j IN err.errorLines.FIRST..err.errorLines.LAST LOOP
43 dbms_output.put_line(err.errorLines(j).errorText);
44 END LOOP;
45 END LOOP;
46 END IF;
47 EXCEPTION
48 WHEN NO_DATA_FOUND THEN
49 RAISE_APPLICATION_ERROR(-20510,'No xml is available as metadata');
50 END;
51 /
Procedure created.
SQL> exec move_table('DEPT','SCOTT','OE');
PL/SQL procedure successfully completed.
SQL> select count(*) from dba_objects where object_name = 'DEPT' and owner = 'OE';
COUNT(*)
1
SQL> spool off;The xml returned by the get_xml function contains the tablespace name and storage parameters of the schema in which the object is present.
Check these parameters for both your schemas. -
Running out of memory while using cursored stream with large data
We are following the suggestions/recommendations for the cursored stream:
CursoredStream cursor = null;
try
Session session = getTransaction();
int batchSize = 50;
ReadAllQuery raq = getQuery();
raq.useCursoredStream(batchSize, batchSize);
int num = 0;
ArrayList<Request> limitRequests = null;
int totalLimitRequest = 0;
cursor = (CursoredStream) session.executeQuery(raq);
while( !cursor.atEnd() )
Request request = (Request) cursor.read() ;
if( num == 0 )
limitRequests = new ArrayList<Request>(batchSize);
limitRequests.add(request);
totalLimitRequest++;
num++;
if( num >= batchSize )
log.warn("Migrating batch of " + batchSize + " Requests.");
updateLimitRequestFillPriceForBatch(limitRequests);
num = 0;
cursor.releasePrevious();
if( num > 0 )
updateLimitRequestFillPriceForBatch(limitRequests);
cursor.close();
We are committing every 50 records in the unit of work, if we set DontMaintianCache on the ReadAllQuery we are getting PrimaryKeyExceptions intermittently, and we do not see much difference in the IdentityMap size.
Any suggestions/ideas for dealing with large data sets? ThanksHi,
If I use read-only classes with CursoredStream and execute the query within UOW, should I be saving any memory?
I had to use UOW because when I use Session to execute the query I get
6115: ISOLATED_QUERY_EXECUTED_ON_SERVER_SESSION
Cause: An isolated query was executed on a server session: queries on isolated classes, or queries set to use exclusive connections, must not be executed on a ServerSession or in CMP outside of a transaction.
I assume marking the descriptor as read-only will avoid registering in UOW, but I want to make sure that this is the case while using CursoredStream.
We are running in OC4J(OAS10.1.3.4) with BeanManagedTransaction.
Please suggest.
Thanks
-Raam
Edited by: Raam on Apr 2, 2009 1:45 PM -
Adding footage fails with larger documents
Hi,
I'd be thankful for any advice: I tried to add footage to a document (2.300 kb) for several times, but it doesn't work. With smaller documents it's no problem. It's a pdf of a magazine we publish for open access.
Has anyone an idea that would help me?
Thanks.Hi MScallion,
You can try the following Jython script to transfer the files using FTP.
import snpsftp
ftp = snpsftp.SnpsFTP('HOST_NAME', 'USER_NAME', 'PASSWORD')
ftp.setmode('ASCII')
ftp.mget('SOURCE_DIR', 'File1.txt','OUTPUT_DIR')
ftp.close()
Thanks,
Yellanki -
Problems with larger documents.
Here's my problem: I am a composer, I need to print my scores (document size is 9x12) but it seems that adobe only supports 8.5x11. What I'm looking to do is to save my 9x12 document as a pdf, and have it actually show up in adobe reader as a 9x12 document so that it can be accurately printed at its intended size. Every time I try to do just that, the document either rescales to accomodate to adobe, or parts of the document get cut off. That's not what I want, I want a 9x12 document. If in the unfortunate case that what I'm trying to do is impossible, please notify me of an alternate universal document reader that will do what I want.
I set up the score for my music in my notation software (finale 2011.) I must then convert the score from finale into a PDF, as there are additional items that I need to add to the score that can't be added from finale. So I export the document from finale as a 9x12 file. I use one of those PDF creators that acts as a printer since Finale 2011 for windows doesn't have direct pdf conversion capabilities. Once the PDF is created, I open it only to see that my large document has been subject to the 8.5x11 parameters of Adobe Acrobat, and much of it has been cropped out. I don't want to rescale, because again, it is a 9x12 document and that is all it will ever be. Is there a better alternative to this process that might yeild the desired outcome?
-
Pagecount: problem with larger documents
Hi,
To print the pagecount I print &SFSY-PAGE&/&SFSY-JOBPAGES& on every page. This works for smaller documents (2-3 pages) but if I have larger documents (12-15 pages) it will print 1/, 2/, 3/, 4/ etc untill close to the end where it will print 12/13, 13/13 correctly.
Anyone had this issue before?
Thanks!Hi,
I think you should specific a length option for field, just like:
&SFSY-PAGE(4ZC)& / &SFSY-FORMPAGES(4ZC)&
"4: set length to 4
"Z: Suppresses leading zeros in numbers
"C: This effect corresponds to that of the ABAP statement CONDENSE
Please try,
Thanks -
Considering using 20" Imac with larger external monitor - good idea?
I've just returned my 24" Imac for a refund due to the uneven brightness issue. I want a set up for my illustration work, but can't justify the price of a mac pro + monitor. Therefore I'm considering a 20" Imac 2.4 GHZ, and connecting an external 23/24" monitor that has better consistent brightness than the Imac screens, e.g. the Dell 2407WFP-HC or an 23" Apple cinema display. The idea is that, any problems with gradients on the Imac screen won't bother me as I'll be using it merely as a web browser.
Is this a good idea? Will there be any problems running a larger monitor of the Imac - any compatibility issues etc. Can anyone recommend a good screen around the £500 mark or under? I basically want a screen that isn't obviously brighter on one side than the other, as the Imac appears to be.I know uneven lighting is a complaint among 24" iMac users - and I've seen two myself. But not all of them have the problem. You might want to consider trying another before giving up on them. Having said that - take a look at Samsung displays. I don't know what they run in the UK but I'm very impressed with the ones we have at work.
-
Is it possible to use xml publisher with xml document as data source ?
I have an application that have to publish document from xml document that are not part a oracle 10g database but will be stored into Oracle Berkeley XML database insteed. Is it possible to use server and/or desktop to publish these documents ?
I test the desktop edition using the source xml document but it render no data when the template is executed (vizualization)
I installed the server edition and i'm not able to declare xml document as a data source
So i have a doubt that xml publisher is able to publish something from a xml datasource
ThanksYes, it is possible.
The problem should come from your template. Refer to "edit a RTF template" in the docs.
A fact is that XML Publisher server edition is not very adapted to an XML file datasource. In order to use it, you should use an HTTP datasource, with the URL of your XML document (that you should place on a web server...). The problem is that this URL is fixed and point always on the same reference...so XML Publisher server edition is not very good for that use.
I choose to use the XML Publisher Java API which is better for this task. -
Help with large document please.
I'm using a MacPro 2 x 2.26 Xeon/6GB RAM/Radeon graphics card. For the 6th year I'm producing an A4 product catalogue for a client with mostly full page photographs on every page. This year it will have grown to 400 pages. I'm half way through and already the file is becoming a bit unwieldy with daily crashes and slow to load. Does anybody know if increasing the RAM would help or should I try to split the catalogue into smaller chunks and then join them up into a book. That's not something I've tried before so am not sure about the drawbacks. The client does have a habit of changing the page order quite a bit which might be a bit of a problem if I have to move between the smaller documents. Or am I wrong?
Any advice most welcome.Thanks for your comments Peter. I think I'm at a stage where I can easily split a duplicate file into 10 or maybe 11 documents but I will need to reference 5 or 6 words on each page for the index. Hopefully that won't tax the system too much!
-
Constant crashes with large document when scrolling through pages
Need help ASAP with crashing issue. Have shut down and restarted, and nothing helps.
Nobody can help you. You have not even bothered to tell us what program you are referring to much less provided any technical info like what system or what documents. Sorry, but this is pointless.
Mylenium -
Finally considering using iPhoto - good with large dbs?
I never liked iPhoto before, and when I bought iLife yesterday, iPhoto was the app I had the least expectations for.
But I tried it and immediately liked the auto-events feature. What a great organizing tool. I like the way you can immediately scan events by rolling over them with your cursor. So I'm thinking of using iPhoto from now on.
One question - how good is it with dealing with 20,000 - 30,000 photos, like 20G - 30G of data?
Thanks!
doug
Message was edited by: Doug Lerner2Doug:
You shouldn't have a problem with that size library as long as you have sufficient free space on your boot disk. It's strongly recommended you have a minimum of 10 GB free, better to have around 20 if you're going to use iDVD much. You have plenty of RAM. Also check the tip at the end of my signature.
Do you Twango?
TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file. -
I'm trying to get to grips with DBMS_METADATA to transfer table DDL across schemas, making some modifications in the process.
Firstly, I'm not achieving table recreation using DBMS_METADATA.PUT. Example 18-7 from the Utilities manual is giving an "ORA-00942: Table does not exist" error, and my own attempt below does not result in a copy of the table being created. Can anyone point out what the problem is?
xdba@ora10gr2 > select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
xdba@ora10gr2 > create user king identified by lion;
User created.
xdba@ora10gr2 > grant connect, resource to king;
Grant succeeded.
xdba@ora10gr2 > declare
2
3 src number;
4 destn number;
5
6 xml xmltype;
7 ddls sys.ku$_ddls;
8
9 txh number;
10
11 created boolean;
12 errs sys.ku$_SubmitResults := sys.ku$_SubmitResults();
13
14 dbms_metadata_failure exception;
15
16 begin
17
18 src := dbms_metadata.open('TABLE');
19
20 dbms_metadata.set_filter(src, 'SCHEMA', 'SCOTT');
21 dbms_metadata.set_count(src, 3);
22
23 txh := dbms_metadata.add_transform(src, 'MODIFY');
24 dbms_metadata.set_transform_param(txh, 'OBJECT_ROW', 3);
25 dbms_metadata.set_remap_param(txh, 'REMAP_SCHEMA', 'SCOTT', 'KING');
26
27 txh := dbms_metadata.add_transform(src, 'DDL');
28
29 dbms_metadata.set_transform_param(txh, 'REF_CONSTRAINTS', false);
30 dbms_metadata.set_transform_param(txh, 'CONSTRAINTS', false);
31 dbms_metadata.set_transform_param(txh, 'STORAGE', false);
32 dbms_metadata.set_transform_param(txh, 'SEGMENT_ATTRIBUTES', false);
33
34 ddls := dbms_metadata.fetch_ddl(src);
35
36 for i in ddls.first()..ddls.last()
37 loop
38 dbms_output.put_line(ddls(i).ddlText);
39 end loop;
40
41 destn := dbms_metadata.openw('TABLE');
42
43 created := dbms_metadata.put(destn, xml, 0, errs);
44
45 dbms_metadata.close(destn);
46
47 if not created
48 then
49 raise dbms_metadata_failure;
50 end if;
51
52 dbms_metadata.close(src);
53
54 exception
55
56 when dbms_metadata_failure
57 then
58 for i in errs.first..errs.last
59 loop
60 for j in errs(i).errorlines.first..errs(i).errorlines.last
61 loop
62 dbms_output.put_line(errs(i).errorlines(j).errortext);
63 end loop;
64 end loop;
65 raise;
66
67 end;
68 /
CREATE TABLE "KING"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4,0),
"HIREDATE"
DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0)
PL/SQL procedure successfully completed.
xdba@ora10gr2 > connect king/lion@ora10gr2
Connected.
king@ora10gr2 > select dbms_metadata.get_ddl('TABLE', 'EMP') from dual;
ERROR:
ORA-31603: object "EMP" of type TABLE not found in schema "KING"
ORA-06512: at "SYS.DBMS_METADATA", line 1546
ORA-06512: at "SYS.DBMS_METADATA", line 1583
ORA-06512: at "SYS.DBMS_METADATA", line 1901
ORA-06512: at "SYS.DBMS_METADATA", line 2792
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1Secondly, does anyone have experience of performing more complex transformations with DBMS_METADATA using external XLST? Are there any examples anywhere?I've now achieved table recreation in example 18-7 and my own code above. This does not work when XMLType storage is used, but does when CLOB is used. It is not clear to me from these experiments and the documentation if there is intended to be a difference between XMLType/dbms_metadata.fetch_xml() and CLOB/dbms_metadata.fetch_clob, and if so, what this is?
I have also succeeded in applying more complex transformations using XSLT (changing table names, tablespaces; adding columns). However, I'm concerned that the dbms_metadata XML format seems to be undocumented.
Has there been any advance since XML Schema for Oracle DDL statements??
Can anyone shed any light on the use of the various <SPAREn> elements for example? Valid values for <COL_LIST_ITEM>...<TYPE_NUM>? -
Using InterMedia Text with FrameMaker, StarOffice...
I'm planning to use InterMedia text with various kinds of documents, but inso filter does not support them. In particular, it does not support:
- Framemaker
- PostScript (I know it works on encapsulated PostScript)
- Applix
Where can I find the right filters?
Is there a way to use InterMedia text with these documents?
Thank you
Paolo BonanomiI'd suggest searching the web - there are a number of little freeware filters out there that could be used as user-filters.>Have anybody found a postscript filter and can post it here ?
Regards,
Mihai -
i´m using pages 5.1 and i need 2 different types of page in 1 document: first page with large logo and second with a small one. in pages 09 was a option for different first page ...
that's not my problem, and I am unfortunately not a professional. Sorry.
In Pages09 there was an option "Different First Page" (like MS Word). I could create different pages (first and second) with two different logos and text boxes. If the document was opened, there was only one side with the large logo. during writing the small logo and the other text boxes appeared on the second page (and subsequent pages).
Unfortunately I miss this function. I mean the inclusion of items on a second page. However, this must not necessarily be active.
Maybe you are looking for
-
Can you use Itunes with out an apple id?
my stepson has an Ipod and Itunes but he isn't old enough to have an apple id, what do we need to do? can he use them?
-
USING PREMIERE CS4 AND MATROX RT.X2 CARD FOR CAPTURING- Captrued look great on composite tv and computer monitor- when using dynamic link (or manual export to Encore) and burn DVD, regardless of quality of input, all dvds are blurry- no definition- n
-
Can Javascript trigger an action in a swf file?
Earlier I was able to create flash buttons in a swf object in a widget on a Jive page, and have each of them trigger a separate Javascript function. That worked well.I used this in Flash: import flash.external.ExternalInterface; Now I would like to b
-
Reagarding saving and sending the adobe interactive form as non interactive
Hi , I am trying to send the interactive adobe form as non-interactive form through email.The interactive form size is very large because of the interactivity. Can anybody suggest how to do this. Regards, Debasis
-
Content objects and datasources for different sources...
Dear Experts, Please write me, which content cubes, dso obects, datasources should be used for the following modules: HR MM SD CRM SCM FI CO CO-PA Thank you very much in advance!