Question about SELECT DBMS_METADATA. GET_DDL
HelloIn reading the other posts, I found this interesting statement:
SELECT DBMS_METADATA.GET_DDL('TABLE','TABLE_NAME') FROM DUAL;
I thought it would be useful. When I tried as user SCOTT, the result I got is 'incomplete', as shown below:SQL> select dbms_metadata.get_ddl('TABLE', 'EMP') from dual;
DBMS_METADATA.GET_DDL('TABLE','EMP')
--------------------------------------------------------------------------------
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
SQL> describe emp;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> select dbms_metadata.get_ddl('TABLE', 'DEPT') from dual;
DBMS_METADATA.GET_DDL('TABLE','DEPT')
--------------------------------------------------------------------------------
CREATE TABLE "SCOTT"."DEPT"
( "DEPTNO" NUMBER(2,0),
"DNAME" VARCHAR2(14
SQL>
looks like the function smothered in half way through.Question: No idea why GET_DDL did not return all DDL for tables above?
I thought that maybe it was a question of the privileges of the user, so I tried to sys as sysdba, then he tried to find EMP in SYS (which is obviously not there). How the ADMINISTRATOR bring the DDL for a table without having to sign in as a user that owns the schema?
Thank you for your help,
John.
You need to set the LONG and LONGCHUNKSIZE parameters to sql * higher level for a complete result.
Tags: Database
Similar Questions
-
Hi all
I have some questions unresolved about the selections, I have the Panel, CBS, ASB, layoutSelectionBoss and so on:
- What is my selection? What are the steps I need to do for this?
- How to recover data from selection? It shlould be abstract methods defined in the BSA and its actual implementation of CSB or, for example. LayoutSelectionBoss?
Thank you for the advice
To create your own selection of suites, you will need to follow these steps.
1. create an interface for the rest of the selection and place it as a supplement in the IntegratorSuite and the office boss, you need to expand. As for the layout, you can use the kLayoutSuiteBoss.
2. the implementation for the interface added in the IntegratorSuite will be the implementation of the SBA, the code because it's pretty well modeled, see SDK sample code to get an idea on the subject.
3. the implementation for the interface added in the other boss now will be the implementation of the CSB. Inside of this class, you can write the code that is specific to your needs.
Observation on covers the call on this code and how can you get your code running, first you need to get the selection manager which is usually obtained from the activeselection interface but there is otherwise too see the SDK for it. From this interface selectionmanager query interface of your suite and if your suite is available, you can call its method, otherwise you will get a pointer nill.
I think this should make quite clear, for more details, consult the SDK and programming guide samples.
Manan Joshi
-Effective InDesign solutions-
MetaDesign Solutions
http://metadesignsolutions.com/services/InDesign-development.php
-
question about select in question
Hello all;
I need an idea on how to y to take to write this query... I need to compare two fields to see if they are in another table... it is similar to the following select statement below
How do you write this sql query in formalselect id, place from table_one t where t.id and t.place in (select z.zoneid, z.zoneplace from zone z)
select id, place from table_one t where (t.id,t.place) in (select z.zoneid, z.zoneplace from zone z)
-
Hello
I have a table, for ex:
col1 col2CREATE TABLE TEST1 ( COL1 NUMBER, COL2 VARCHAR2(100 BYTE) )
0 23
100 0
300 0
857 27
I want the output to have lines AVG nonzero. For the above the correct output will be:
col1 col2
25 419
I have the following:
But is it possible to refer to the table only once. This real table we did 20 + million records and I need avg on several columns, where the data in the column are not 0.select col1,col2 from ( SELECT AVG(COL1) COL1 FROM test1 WHERE COL1 != 0) a, ( SELECT AVG(COL2) COL2 FROM test1 WHERE COL2 != 0) b
Thank youTry this
select col1,col2 from test1; COL1 COL2 ------ --------------------------------------- 0 23 100 0 300 0 857 27 select avg(decode(col1,0,null,col1)) col1, avg(decode(col2,0,null,col2)) col2 from test1 / COL1 COL2 ------ -------- 419 25
-
Question about DBA_EXTENTS BLOCKS
My partitioned table has the following attributes:
INITIAL_EXTENT = 50 MB
NEXT_EXTENT = 10 MB
PCT_INCREASE = 0
My DB_BLOCK_SIZE is 8 KB
But when I check on the DBA_EXTENTS, the number of blocks for a measurement allocated to each partition in this table is 2560 blocks.
Why is it so? I expect only 1280 (since 10 MB / 8 KB = 1280)
Could you help me to explain? It seems that the next step to allocate 20 MB when in fact the next_extent as seen in DBA_SEGMENTS is 10 MB.
Looks like you tablespace is defined with uniform extents of 20 MB, then.
For a segment in this tablespace that oracle will then use the original, and the value of min_extents to calculate the initial size of the segment, then allow the number of uniform extensions meets this requirement.
You can use "select dbms_metadata.get_ddl ('TABLESPACE', 'XXXX') from dual;" to rebuild the tablespace definition
Concerning
Jonathan Lewis
-
Hi all
We have oracle 10g on windows.
In one of our plan, we have 15 materializing the view. I need to get the creation of that script all mviews. is it possible that I can get the creation of the mview script using the query.We have oracle 10g on windows.
In one of our plan, we have 15 materializing the view. I need to get the creation of that script all mviews. is it possible that I can get the creation of the mview script using the query.
Select dbms_metadata.get_ddl ('MATERIALIZED_VIEW', mview_name) in user_mviews;
-
grant for dbms_metadata.get_ddl on objects in another schema
In Oracle 11 g R2, I use dbms_metadata.get_ddl to get the DDL to another schema, but I got an error:
ORA-31603: object not found 'IS_SNMP_DATA' of type TABLE in the schema "TXV.
that grant is necessary for this package to get from another schema ddl?
I tried with authid current_user (that I found on google), but no result...See the following example:
SQL> create user us_one identified by us1; User created. SQL> grant connect, resource to us_one; Grant succeeded. SQL> create user us_two identified by us2; User created. SQL> grant connect, resource to us_two; Grant succeeded. SQL> conn us_one/us1 Connected. SQL> create table t (id number); Table created. SQL> grant select on t to us_two; Grant succeeded. SQL> conn / as sysdba Connected. SQL> grant execute on dbms_metadata to us_two; Grant succeeded. SQL> conn us_two/us2 Connected. SQL> select dbms_metadata.get_ddl('TABLE','T','US_ONE') from dual; ERROR: ORA-31603: object "T" of type TABLE not found in schema "US_ONE" ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105 ORA-06512: at "SYS.DBMS_METADATA", line 2806 ORA-06512: at "SYS.DBMS_METADATA", line 4333 ORA-06512: at line 1 no rows selected SQL> conn / as sysdba Connected. SQL> grant select_catalog_role to us_two; Grant succeeded. SQL> conn us_two/us2 Connected. SQL> select dbms_metadata.get_ddl('TABLE','T','US_ONE') from dual; DBMS_METADATA.GET_DDL('TABLE','T','US_ONE') -------------------------------------------------------------------------------- CREATE TABLE "US_ONE"."T" ( "ID" NUMBER ) PCTFREE 10 PCTUSED 40 INITRA SQL>
-
get the table script using dbms_metadata.get_ddl but with clob field
Thus, Oracle 11g R2...
I use dbms_metadata.get_ddl for table scripts and it works fine...
now, I have a table with clob field, and it does not work... I got an error "missing a closing parenthesis (ora-0907) '...
I could paste a script I had, but I don't think that it makes no sense...
does anyone have an experience on the use of this package on clob tables?
TNXSee this code.
DECLARE myddl clob; PROCEDURE print_clob(p_clob in clob) as l_offset number default 1; BEGIN loop exit when l_offset > dbms_lob.getlength(p_clob); dbms_output.put_line(dbms_lob.substr(p_clob, 255, l_offset)); l_offset := l_offset + 255; end loop; END print_clob; FUNCTION get_metadata return clob is h number; th number; doc clob; BEGIN h := dbms_metadata.open('TABLE'); dbms_metadata.set_filter(h, 'SCHEMA', 'HR'); dbms_metadata.set_filter(h, 'NAME', 'EMPLOYEES'); th := dbms_metadata.add_transform(h, 'MODIFY'); th := dbms_metadata.add_transform(h, 'DDL'); --dbms_metadata.set_transform_param(th,'SEGMENT_ATTRIBUTES',false); doc := dbms_metadata.fetch_clob(h); dbms_metadata.CLOSE(h); return doc; END get_metadata; BEGIN myddl := get_metadata; print_clob(myddl); END;
This procedure of print_ddl I took of the documentation.
Use of the long VALUE. See, in the first example out put is truncated.SQL> SELECT dbms_metadata.get_ddl('TABLE','EMP','SCOTT') FROM dual; DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT') -------------------------------------------------------------------------------- CREATE TABLE "SCOTT"."EMP" ( "EMPNO" NUMBER(4,0), "ENAME" VARCHAR2(10), SQL> set long 10000 SQL> / DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT') -------------------------------------------------------------------------------- CREATE TABLE "SCOTT"."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), CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT') -------------------------------------------------------------------------------- USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ENABLE, CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"
SQL> SET LINESIZE 132 SQL> SET pagesize 0 SQL> SET LONG 1000000 SQL> / CREATE TABLE "SCOTT"."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), CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ENABLE, CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" SQL>
-
grant dbms_metadata.get_ddl wanted
Hi all! I need help. I want to get in clob a ddl of an object. What I am doing wrong?
Select the owner, constraint_name from dba_constraints where constraint_name = "TOME_KYTE_IS_UNIQUE";
OWNER CONSTRAINT_NAME
TOMKYTE TOME_KYTE_IS_UNIQUE
Create procedure tomkyte.testprint as
CLOB text;
Start
Select DBMS_METADATA. GET_DDL ('CONSTRAINT', 'TOME_KYTE_IS_UNIQUE', 'TOMKYTE')
in the text of the double;
dbms_output.put_line('1');
end;
-----
procedure created
-----
Start
tomkyte.testprint; -I plugged as tomkyte
end;
ORA-31603: object "TOME_KYTE_IS_UNIQUE" of type CONSTRAINT was not found in the schema TOMKYTE
This who should I agree with tom that he can get atleast its own objects ddl?
Thanks in advance.Instead of DBA_constraints you can use USER_CONSTRAINTS and see how it works
create or replace procedure tomkyte.buildConstraint( cons_name varchar2, cons_owner varchar2, cons_new_owner varchar2) AS stat clob; e varchar2(4000); var varchar2(300); begin select DBMS_METADATA.GET_DDL('*CONSTRAINT*',cons_name,cons_owner) into stat from dual; dbms_output.put_line(stat); end;
Try to replace the CONSTRAINT by REF_CONSTRAINT
Thnks to metalink
Published by: Maran Viswarayar Sep 12, 2008 17:26
-
Another question about dbms_metadata.get_ddl
Hello
Recorded in as 'sys as sysdba' I tried to get the DDL for the EMP table in the SCOTT schema. Here is the output I got:
Remove the reference to SCOTT, we get another error (no surprise):1* select scott.dbms_metadata.get_ddl('TABLE', 'EMP') from dual SQL> / select scott.dbms_metadata.get_ddl('TABLE', 'EMP') from dual * ERROR at line 1: ORA-00904: "SCOTT"."DBMS_METADATA"."GET_DDL": invalid identifier
Question: How the ADMINISTRATOR bring the DDL for a table without having to sign in as a user that owns the schema?ORA-31603: object "EMP" of type TABLE not found in schema "SYS"
Thank you
John.He must inform the owner of this object when running DBMS_METADATA of SYS.
If we describe DBMS_METADATA
FUNCTION GET_DDL RETURNS CLOB Argument Name Type In/Out Default? ------------------------------ ----------------------- ------ -------- OBJECT_TYPE VARCHAR2 IN NAME VARCHAR2 IN SCHEMA VARCHAR2 IN DEFAULT VERSION VARCHAR2 IN DEFAULT MODEL VARCHAR2 IN DEFAULT TRANSFORM VARCHAR2 IN DEFAULT
So there must be another SCHEMA parameter when running DBMS_METADATA of SYS.
-
Question about text boxes, and then select options in web sites and text in yahoo.
Hello
I am a web developer working on with web sites. I am a regular user of fire fox , previously i sent an issue about search option in fire fox browser, i am very much happy to see change in the search option in browser recently. Presently i got an issue in browser about select and text box ... i'm not able to view them properly i mean the text is breaking ... sample i opened yahoo browser .. i was shocked to see breakable text .i will attach screen shot if possible. please fix this as soon as possible.
Thank you
Lady Sarah.You can not attach a screenshot in the first row who starts a thread, but you can do it in subsequent responses.
- http://en.Wikipedia.org/wiki/screenshot
- https://support.Mozilla.org/KB/how-do-i-create-screenshot-my-problem
- Use a type of compressed as PNG or JPG image to save the screenshot
- Make sure you do not exceed the maximum size of 1 MB
What the font is used to display this text?
You can select "Inspect element" in the context menu to open the Inspector (Firefox/tools > Web Developer).
You can check the font used for the text selected in the tab fonts in the right pane of the Inspector. -
strange dbms_metadata.get_ddl TS DDL
11.2.0.2 Oracle 64-bit
Oracle Linux 5
In another issue (isn't that where we find always the uh, interesting things?) I came across something odd about a definition of TS returned by dbms_metadata. Launched a couple of other requests for related information together. Note that the supposed definition of the ts includes an alteration of a redo log file.
Sign me - stumped.
SQL > SELECT DBMS_METADATA. GET_DDL ('TABLESPACE', 'PSUNDOTS') of double;
DBMS_METADATA. GET_DDL ('TABLESPACE', 'PSUNDOTS')
--------------------------------------------------------------------------------
CREATE UNDO TABLESPACE "PSUNDOTS" DATA FILE
' / u01/oradata/fs91dmo/psundots01.dbf' 314572800 SIZE
AUTOEXTEND ON NEXT 5242880 MAXSIZE 32767M.,
' / u01/oradata/fs91dmo/redo03.log' 314572800 SIZE
AUTOEXTEND ON NEXT 5242880 MAXSIZE 32767M
BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
ALTER DATABASE DATAFILE
' / u01/oradata/fs91dmo/psundots01.dbf' 3145728000 RESIZE
ALTER DATABASE DATAFILE
' / u01/oradata/fs91dmo/redo03.log' 3145728000 RESIZE
1 selected line.
SQL > select file_name
2 of dba_data_files
3 where nom_tablespace = 'PSUNDOTS ';
FILE_NAME
---------------------------------------------
/U01/oradata/fs91dmo/psundots01.dbf
1 selected line.
SQL > select group #,.
2 Member
3 v $ logfile
4 order of 1,2;
GROUP # MEMBERS
---------- ---------------------------------------------
1 /u01/oradata/fs91dmo/redo01.log
2 /u01/oradata/fs91dmo/redo02.log
3 /u01/oradata/fs91dmo/redo03.log
3 selected lines.
SQL >--
SQL > spo off
Hello
It is clearly a bug:
Bug 10177856 - DBMS_METADATA.get_ddl ('tablespace',...) includes wrongly tempfiles and redo-log online (Doc ID 10177856.8)
Kind regards
Bashar
-
About a month ago I posted a question about iMovie and not being able to "share". I solved the problem thanks, so no more emails!
Hi Michael,
If you want to stop receiving notifications by electronic mail, in the thread, that you have created, then I suggest that you follow the steps below:
One time connected to the Apple Support communities, visit your mini profile and select manage subscriptions.
Content
To manage this content, you are currently subscribed and changing your preferences, select the content.
Select next to see what content you are currently following. Note that any thread you are responding you subscribe you automatically to this thread.
You can select to terminate a subscription to a thread.
Learn how to manage your subscriptions
Take care.
-
I recently bought a mini nb200 with windows 7 and I have a few questions about it. How can you set up your email, I was willing to put up with Outlook Express, but I don't know if I can. Also, is there a way to get a paper copy of the user manual?
You can download and install a new e-mail program when you download Windows Live via Microsoft Update. You can select the components of Windows Live, you want to include by checking a box for each you want. I installed all the. Or you can use Outlook, if you have Microsoft Office and you want to install it.
-
Question about "Windows 8.1 DG to Windows 7 Pro 64-bit" and Windows product key
I have acquired a recnet ThinkPad T450 fdrom a retialer online (NCIX) and I hav ea a few questions about the installed Windows operating system.
Before I just go further, HRE are some information about my particular system.
Lenovo ThinkPad T450
Model: 20BV00BUS
CPU: Intel Core i5-4300U
RAM: 4 GB
Under the product description, it was stated "Windows 8.1 DG Windows 7 Pro 64." My understnading, the ThiknPad has been installed with Windows 8.1, but downgraded to Windows 7. There is also a Windows 8 Pro badge sticker at the bottom of the matchine.
Is it possible, at the end of the user/consumer, to alter the functioning ti repressive back Windows 8.1?
Can I create a recovery with Windows 8.1 disk?
A separate but related matter relates to the Windows product key.
I noticed the Ultrabook do not come with a sticker / label with the Windows product key (i.e. COST). Some quick research indicated that the Windows key is programmed into the BIOS.
This indeed true (I wish an audit)?
The key is visible in some way (for when you need to reinstall the operating system. I have not tried to enter the BIOS at the moment)?
Thank you for taking the time to consider my question.
Kind regards
Victor L.
Hi Victor,
I'm in the same boat as you type, but want to keep the facilities of Windows 7 rather than pass them to 8. Just like you, I buy our Lenovo from different retailers and they come with windows 7 installed through the Windows 8 lower upgrade program.
We had one or two laptops come with a recovery media (for windows 8/8.1 only) but have noticed that all laptops now come with no physical media or codes for the recovery. WIN8 stickers, you described is more came with the license key on the sticker (it comes to stop you using the same license again and again, microsoft will get more money if you buy another license etc.). I also saw that the key is essentially located in the BIOS but were not able to test what we use any of windows 8. I use it even at home!
To answer your question, you can get a recovery of Lenovo for Windows 8 media!
Go to the following link: https://support.lenovo.com/us/en/lenovorecovery
(It help you understand why this method is used on this page as well)
Select Start,
Please have your serial number of your laptop, (to find it go to this link: https://support.lenovo.com/us/en/find-product-name)
If you qualify (which you will very probably) Lenovo will ship for free, recovery disks give it a go, took me 2 minutes.
I hope this helps.
Best regards, Max.
Maybe you are looking for
-
Re: Satellite U500 - 18K - where is the bag and the driver on the CD?
I just bought this laptop yesterday and when I read the manual book its has said that the package includes the bag and the driver on the CD but I had none of them, only the laptop and the power cable. When I ask the man to store, he says, it's all...
-
How to add memory to end 2007 iMac?
I have done it before, but can't find instructions this time to do. I got the chips in the mail, but no instructions. Can anyone help with this? Larry Jay
-
Calibration of pressure sensor
I have two pressure omegadyne transducers. I tried to calibrate the transducers via linear equations. The problem is that when I put the second slope of line transducer and the y-intercept, the first (slope of the line and intercept) changes automati
-
Convert table 1 d of cluster of 2 doubles 2D elements
Hello world I tried to follow the advice in other posts on this issue, but it does not work. People suggested using a cluster "in the table" inside a loop for, however, I get a message that this conversion is not accepted. Take a look at the attached
-
ScanJet G3010: Solution Center to stop working
Recent update Windows 10 KB3132372 does my Scanjet G3010 Solution Center stop working. I uninstalled the update, but guess what it turns back on. HP have a solution?