Error in dbms_metadata.get_ddl ...
Hi,
I am using
"Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production" .
I am trying to Execute dbms_metadata.get_ddl to get the table structure
select dbms_metadata.get_ddl( 'TABLE', 'EMP', 'SCOTT' ) from dual ;
I am getting following error
ERROR:
ORA-06502: PL/SQL: numeric or value error
ORA-31605: the following was returned from LpxXSLResetAllVars in routine
kuxslResetParams:
LPX-1: NULL pointer
ORA-06512: at "SYS.UTL_XML", line 0
ORA-06512: at "SYS.DBMS_METADATA_INT", line 3430
ORA-06512: at "SYS.DBMS_METADATA_INT", line 4259
ORA-06512: at "SYS.DBMS_METADATA", line 458
ORA-06512: at "SYS.DBMS_METADATA", line 615
ORA-06512: at "SYS.DBMS_METADATA", line 1221
ORA-06512: at line 1
Can any one help me in this regard how to overcome the Error ?
Thanks in Advance
Venkatesh .P
Hi,
There was a bug #2736436 in 9.2.0.1 and 9.2.0.5 :
If a constraint is against a partitioned table then DBMS_METADATA.GET_DDL returns ORA-31605 and LPX-410 when attempting to get the DDL of the constraint.
Seems to be solve in 9.2.0.6 patchset.
Hmm, it seems that you're already in 9.2.0.6...
Nicolas.
Similar Messages
-
Error while using DBMS_METADATA.GET_DDL package.
Hi all,
I want script of DDL of all tables in Database not in particular schema,
As I am using below query
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
FROM ALL_TABLES u
WHERE u.nested='NO'
AND (u.iot_type is null or u.iot_type='IOT')
but it gives error as below.
ORA-31603: object "ICOL$" of type TABLE not found in schema "SCOTT"
It should give DDL of all tables, also I am not having DBA Privs.
Please help me.
Thanks & Regards
Rajiv.It could be helpful if you have a look into [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1016867]documentation.
Security Model
The object views of the Oracle metadata model implement security as follows:
Nonprivileged users can see the metadata of only their own objects.
SYS and users with SELECT_CATALOG_ROLE can see all objects.
Nonprivileged users can also retrieve public synonyms, system privileges granted to them, and object privileges granted to them or by them to others. This also includes privileges granted to PUBLIC.
If callers request objects they are not privileged to retrieve, no exception is raised; the object is simply not retrieved.
If nonprivileged users are granted some form of access to an object in someone else's schema, they will be able to retrieve the grant specification through the Metadata API, but not the object's actual metadata.
In stored procedures, functions, and definers-rights packages, roles (such as SELECT_CATALOG_ROLE) are disabled. Therefore, such a PL/SQL program can only fetch metadata for objects in its own schema. If you want to write a PL/SQL program that fetches metadata for objects in a different schema (based on the invoker's possession of SELECT_CATALOG_ROLE), you must make the program invokers-rights.
Best regards
Maxim -
Stange error when using dbms_metadata.get_ddl in PL/SQL procedure
Basic info:
Oracle 10.2.0.4.0 on linux.
I'm trying to extract ddl of indexes that I drop and recreate frequently during monthly loads and store it in a table.
This statement works on the command line:
insert into saved_indexes
select index_name,dbms_metadata.get_ddl('INDEX',index_name,owner_name)
from sys.all_indexes
where owner = owner_name
and table_name = table_name;
commit;
The table 'saved_indexes' is a two column table with a varchar2(40) and a CLOB.
When I use the following procedure, I get 'ORA-04044 procedure, function, package, or type is not allowed here -4044' every time.
PROCEDURE SAVE_INDEXES (v_table IN VARCHAR2, v_owner IN VARCHAR2) IS
v_errorcode number(8);
v_errortext varchar2(1000);
v_start_time date;
BEGIN
insert into saved_indexes
select index_name,dbms_metadata.get_ddl('INDEX',index_name,v_owner)
from sys.all_indexes
where owner = v_owner
and table_name = v_table;
commit;
EXCEPTION
WHEN others THEN
v_errorcode := sqlcode;
v_errortext := substr(sqlerrm, 1, 1000);
dbms_output.put_line(v_errortext || ' ' || v_errorcode);
END;
Alternatively I have tried it this way:
PROCEDURE SAVE_INDEXES (v_table IN VARCHAR2, v_owner IN VARCHAR2 ) IS
v_errorcode number(8);
v_errortext varchar2(1000);
v_index_ddl CLOB;
BEGIN
for x in (select index_name
from sys.all_indexes
where owner = v_owner
and table_name = v_table)
loop
select dbms_metadata.get_ddl('INDEX',x.index_name,v_owner) into v_index_ddl from dual;
insert into saved_indexes
values(v_table,v_index_ddl);
end loop;
commit;
EXCEPTION
WHEN others THEN
v_errorcode := sqlcode;
v_errortext := substr(sqlerrm, 1, 1000);
dbms_output.put_line(v_errortext || ' ' || v_errorcode);
END;
Always with the same result. I have poured over the documentation on this and have not found anything. All objects are in the same schema, so there is not an issues with invokers rights, or privileges.
Any suggestions would be helpful...qwe11126 wrote:
When I use the following procedure, I get 'ORA-04044 procedure, function, package, or type is not allowed here -4044' every time.There is nothing wrong with SP. Post a snippet of SQL*Plus code showing how you call SP along with errors.
SY. -
I want to mirror a schema to a existing schema by creating DDL and recreate on the other schema with same name.
I wrote the code below:
create or replace
PROCEDURE SCHEMA_A."MAI__DWHMIRROR"
AS
v_sqlstatement CLOB:='bos';
str varchar2(3999);
BEGIN
select
replace(
replace(replace(
replace(DBMS_METADATA.GET_DDL('TABLE','XXXX','SCHEMA_A'),'(CLOB)',''),';','')
,'SCHEMA_A'
,'SCHEMA_B'
into v_sqlstatement
from dual;
select CAST(v_sqlstatement AS VARCHAR2(3999)) into str from dual;
execute immediate ''||str;
END;
And Executing this block with below code:
set serveroutput on
begin
SCHEMA_A.MAI__DWHMIRROR;
end;
But still getting the following error code:
Error report:
ORA-01031: insufficient privileges
ORA-06512: at "SCHEMA_A.MAI__DWHMIRROR", line 47
ORA-06512: at line 2
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.user5199319 wrote:
USER has DBA Role
when all else fails Read The Fine Manual
DBMS_METADATA -
Error when running dbms_metadata.get_ddl on different as logged in schema
Hi ,
I am running 10gR2 and trying to export views from different schema as logged in by using dbms_metadata.get_ddl.
Now I logged as user 'USER_01' and run query like :
SELECT dbms_metadata.get_ddl('TABLE','MY_TABLE', 'USER_01') FROM DUAL;
I get the my_table definition,
but if I stay logged in as USER_01 and try to get table definitions for YOUR_TABLE from schema USER_02 like
SELECT dbms_metadata.get_ddl('TABLE','YOUR_TABLE', 'USER_02') FROM DUAL;
-> I do get following error message:
ORA-31603: object "YOUR_TABLE" of type TABLE not found in schema "USER_02"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 2805
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
Do I need additional GRANTS on USER_02?
ThanksI guess I need SELECT_CATALOG_ROLE role
http://www.orafaq.com/node/807
SYS and users with SELECT_CATALOG_ROLE can see all objects. -
Error while viewing Scripts using dbms_metadata.get_ddl
select dbms_metadata.get_ddl('TABLE',table_name,'DWHOWN') from user_tables
DBMS_METADATA.GET_DDL('TABLE',TABLE_NAME,'DWHOWN')
CREATE TABLE "DWHOWN"."T_DWBN_RELATION_MASTER"
( "BUSINESS_DATE" DATE NOT
CREATE TABLE "DWHOWN"."TMP_CS_CUST_UD_CODES"
( "BUSINESS_DATE" DATE NOT N
ERROR:
ORA-31603: object "BIN$IpUrdJVTS9/gRAADup0xmQ==$0" of type TABLE not found in
schema "DWHOWN"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 2697
ORA-06512: at "SYS.DBMS_METADATA", line 4220
ORA-06512: at line 1ORA-31603: object "BIN$IpUrdJVTS9/gRAADup0xmQ==$0" of type TABLE not found in<br>This table come from the recycle bin. You maybe need to purge this one :<br>
purge recyclebin;<br>
Furthermore, it seems that you'll need to set long to bigger for more well output.<br>
<br>
Nicolas. -
Hi,
I'm trying to extract schema DDL from a database (10.2.0.4.0 - 64bit Enterprise Edition on Solaris 10). I run the query below and get an ORA-00907: missing right parenthesis error.
SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN ('TABLE_PARTITION','INDEX_PARTITION','LOB');
This is the output when running the above in sqlplus worksheet
select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects where object_type not in ('TABLE_PARTITION','INDEX_PARTITION','LOB')
ERROR at line 1:
ORA-00907: missing right parenthesis
removing the where clause gives the following:
select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects
ERROR at line 1:
ORA-00907: missing right parenthesis
Any pointers would be gratefully received. I know I could get the DDL out using exp/imp but I want to understand why I'm getting the missing parenthesis error.
cheers,
EwanSELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN You don't need an alias here. Get rid of " AS object_type" and it should work.
-
Error using DBMS_METADATA package
Hi All,
I have the following query and trying to get the DDLs for the foreign Key constraint on tables
SELECT TO_CHAR (DBMS_METADATA.get_ddl ('CONSTRAINT', constraint_name))
|| ';'
FROM all_constraints
WHERE status = 'ENABLED'
AND table_name IN
('OD_MF_ACCT_PLCY')
ORDER BY table_name;I am getting the following error:
ORA-31603: object "ACCTROLE_FK_ACCTPLCY" of type CONSTRAINT not found in schema "D_OD"
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
Note able to decipher the same. Could you help me what it means?
Thanks,
SaffThe table is in D_OD only.
But I think I got the error...Was just reading about various constant types....instead of CONSTRAINT i think I need to give REF_CONSTRAINT as the type...
This worked out
SELECT TO_CHAR (DBMS_METADATA.get_ddl ('REF_CONSTRAINT', constraint_name))
|| ';'
FROM user_constraints
WHERE status = 'ENABLED' AND constraint_type = 'R'
AND table_name IN
('OD_MF_ACCT_PLCY')
ORDER BY table_name;Thanks,
Saff
Edited by: saffron on Feb 1, 2010 1:19 PM -
[RESOLVED] dbms_metadata.get_ddl() issues
Hi all,
I'm having a bit of an issue using the dbms_metadata package. I've never used it so possibly I'm unaware of something basic.
I'm getting diferent results in my production and dev servers, both of which have this configuration:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
I am trying to replicate the DDL for one particular schema and so tried the following:
SQL> select dbms_metadata.get_ddl('TABLE',u.table_name)
2 from user_tables u
3 where rownum = 1;
ERROR:
ORA-06502: PL/SQL: numeric or value error
LPX-00210: expected '<' instead of 'n'
ORA-06512: at "SYS.UTL_XML", line 0
ORA-06512: at "SYS.DBMS_METADATA_INT", line 3698
ORA-06512: at "SYS.DBMS_METADATA_INT", line 4553
ORA-06512: at "SYS.DBMS_METADATA", line 458
ORA-06512: at "SYS.DBMS_METADATA", line 615
ORA-06512: at "SYS.DBMS_METADATA", line 1221
ORA-06512: at line 1I tried again with hard-coding a table name and got these very scary results:
SQL> select dbms_metadata.get_ddl('TABLE','CAMPAIGN_LOOKUP','XMLUSER') FROM DUAL;
ERROR:
ORA-06502: PL/SQL: numeric or value error
ORA-31605: the following was returned from LpxXSLResetAllVars in routine
kuxslResetParams:
LPX-1: NULL pointer
ORA-06512: at "SYS.UTL_XML", line 0
ORA-06512: at "SYS.DBMS_METADATA_INT", line 3722
ORA-06512: at "SYS.DBMS_METADATA_INT", line 4553
ORA-06512: at "SYS.DBMS_METADATA", line 458
ORA-06512: at "SYS.DBMS_METADATA", line 615
ORA-06512: at "SYS.DBMS_METADATA", line 1221
ORA-06512: at line 1in the above, I am logging in as the XMLUSER user and so owns the table campaign_lookup.
Next I tried getting the DDL for another schema that while still logged in as xmluser.
I'm certain that I have access read/write from the tclient table but got these results:
possibly the dbms_metadata package requires you to be loged in as the schema owner though
the oracle documentation link gives me a 404 error at the moment so I can't check.
SQL> select dbms_metadata.get_ddl('TABLE','TCLIENT','TRAVEL') from dual;
ERROR:
ORA-31603: object "TCLIENT" of type TABLE not found in schema "TRAVEL"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 628
ORA-06512: at "SYS.DBMS_METADATA", line 1221
ORA-06512: at line 1So now I log into production:
SQL> select dbms_metadata.get_ddl('TABLE',u.table_name)
2 from user_tables u
3 where rownum = 1;
DBMS_METADATA.GET_DDL('TABLE',
CREATE TABLE "XMLUSER"."CAMPAIGN_LOOKUP"
( "SCHEME_ID" VARCHAR2(30),
"S
etc...but still can't extract DDL for another schema.
my main issue is, I can't log into production (or our implementation environment) as the schema
I want to extract due to big nasty DBAs locking it all down. however I can in dev, but get the above errors.
thoughts anyone?Hi,
For your table not existing error it could be
1) Table not existing
or
2) Nonprivileged users can see the metadata of only their own objects.
SYS and users with SELECT_CATALOG_ROLE can see all objects
For other problem, there is a bug reported for your version, can search in metalink for workaround
Regards -
Dbms_metadata.get_ddl and select_catalog_role
Hi,
We have been requested to give support staff the ability to see table triggers, stored procedures, etc only for specific schemas and they don't have access to the schema password. We can't give them SELECT_CATALOG_ROLE because they are not allowed to see all schemas. I wish there were a way to grant a version of SELECT_CATALOG_ROLE for only certain schemas......
I've played around with dbms_metadata.get_ddl with no luck (as per the documentation, but just had to try it anyway). I've even considered the script below, but it requires creating a view under the SYS schema and I can't figure out how to add triggers to the view.
Any ideas would be greatly appreciated!
Thanks,
Susan
accept 1 prompt "Enter Owner:"
create or replace view all_dev_source
(OWNER, NAME, TYPE, LINE, TEXT)
as
select u.name, o.name,
decode(o.type#, 7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',
11, 'PACKAGE BODY', 13, 'TYPE', 14, 'TYPE BODY',
'UNDEFINED'),
s.line, s.source
from sys.obj$ o, sys.source$ s, sys.user$ u
where
u.name = upper('&&1') and
o.obj# = s.obj#
and o.owner# = u.user#
and o.type# in (7, 8, 9, 11, 13, 14)
and
o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
or
(o.type# = 7 or o.type# = 8 or o.type# = 9)
and
o.obj# in (select obj# from sys.objauth$
where grantee# in (select kzsrorol from x$kzsro)
and privilege# = 12 /* EXECUTE */)
or
exists
select null from sys.sysauth$
where grantee# in (select kzsrorol from x$kzsro)
and
/* procedure */
(o.type# = 7 or o.type# = 8 or o.type# = 9)
or
privilege# = -144 /* EXECUTE ANY PROCEDURE */
or
privilege# = -141 /* CREATE ANY PROCEDURE */
or
/* package body */
o.type# = 11 or
privilege# = -141 /* CREATE ANY PROCEDURE */
or
/* type */
o.type# = 13
or
privilege# = -184 /* EXECUTE ANY TYPE */
or
privilege# = -181 /* CREATE ANY TYPE */
or
/* type body */
o.type# = 14 and
privilege# = -181 /* CREATE ANY TYPE */
union
select u.name, o.name, 'JAVA SOURCE', s.joxftlno, s.joxftsrc
from sys.obj$ o, x$joxfs s, sys.user$ u
where
u.name = upper('&&1') and
o.obj# = s.joxftobn
and o.owner# = u.user#
and o.type# = 28
and
o.owner# in (userenv('SCHEMAID'), 1 /* PUBLIC */)
or
o.obj# in (select obj# from sys.objauth$
where grantee# in (select kzsrorol from x$kzsro)
and privilege# = 12 /* EXECUTE */)
or
exists
select null from sys.sysauth$
where grantee# in (select kzsrorol from x$kzsro)
and
/* procedure */
privilege# = -144 /* EXECUTE ANY PROCEDURE */
or
privilege# = -141 /* CREATE ANY PROCEDURE */
comment on table all_dev_source is
'Current source on stored objects that user is allowed to create'
comment on column all_dev_source.OWNER is
'Owner of the object'
comment on column all_dev_source.NAME is
'Name of the object'
comment on column all_dev_source.TYPE is
'Type of the object: "TYPE", "TYPE BODY", "PROCEDURE", "FUNCTION",
"PACKAGE", "PACKAGE BODY" or "JAVA SOURCE"'
comment on column all_dev_source.LINE is
'Line number of this line of source'
comment on column all_dev_source.TEXT is
'Source text'
grant select on all_dev_source to <username>
/user632322 wrote:
I think I am misunderstanding your reply becauseI had to be more specific. By "privileged user" I meant SYS. SELECT_CATALOG_ROLE is a role itself, so it will be ignored by definer rights SP/SF. That is why it has to be owned by privileged user SYS:
SQL> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> show user
USER is "SYS"
SQL> create user u1 identified by u1 default tablespace users quota unlimited on users
2 /
User created.
SQL> grant create session to u1
2 /
Grant succeeded.
SQL> create or replace
2 function get_ddl(
3 p_type varchar2,
4 p_object varchar2,
5 p_owner varchar2
6 )
7 return clob
8 is
9 begin
10 return dbms_metadata.get_ddl(p_type,p_object,p_owner);
11 end;
12 /
Function created.
SQL> grant execute on get_ddl to u1
2 /
Grant succeeded.
SQL> connect u1/u1
Connected.
SQL> set serveroutput on
SQL> exec dbms_output.put_line(dbms_metadata.get_ddl('TABLE','EMP','SCOTT'));
BEGIN dbms_output.put_line(dbms_metadata.get_ddl('TABLE','EMP','SCOTT')); END;
ERROR at line 1:
ORA-31603: object "EMP" of type TABLE not found in schema "SCOTT"
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
SQL> exec dbms_output.put_line(sys.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")
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"
PL/SQL procedure successfully completed.
SQL> Now one more correction to my previous reply. Driver table shoudl not be owned by SYS (that would be bad practice). Create it in some other schema. Just make sure your "support staff" has no access to it.
SY. -
DBMS_METADATA.GET_DDL has problem
Hi all,
I ran the following statement to get detail about index
SELECT DBMS_METADATA.GET_DDL('INDEX','u.UX_myIndex)
FROM USER_INDEXES u;
and I got the error message:
RA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 653
ORA-06512: at "SYS.DBMS_METADATA", line 1260
ORA-06512: at line 1
Do you have any idea what is the problem here and
how to fix it.
Thank in advance,
JPSELECT DBMS_METADATA.GET_DDL('INDEX','u.UX_myIndex)FROM USER_INDEXES u;
in the above qry ending single quote is missing ('u.UX_myIndex)
and object name won't be there like this u._____________
and how many time u want the same data suppose user_indexes have 1000 rows the it will display 1000 times why don't to use dual table
regs,
naresh -
Dbms_metadata.get_ddl not working in 11g
Hi All,
I need a quick help from you. Following is not working in 11g.
dbms_metadata.get_ddl( 'MATERIALIZED_VIEW', Mview_name, owner )
It is throwing me an error saying the Materialized view does not exist, though its exist.
Please let me know, what is wrong here with 11g.Please let me know, what is wrong here with 11g.No problem here: Can you reproduce these steps:
SQL> select * from v$version where rownum = 1
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
1 row selected.
SQL> create materialized view mv_dummy as select * from dual
Materialized View created.
SQL> select dbms_metadata.get_ddl ('MATERIALIZED_VIEW', 'MV_DUMMY', user) ddl from dual
DDL
CREATE MATERIALIZED VIEW "MICHAEL"."MV_DUMMY" ("DUMMY")
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOG
GING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
BUILD IMMEDIATE
USING INDEX
REFRESH FORCE ON DEMAND
USING DEFAULT LOCAL ROLLBACK SEGMENT
USING ENFORCED CONSTRAINTS DISABLE QUERY REWRITE
AS select * from dual
1 row selected.? -
DBMS_METADATA.GET_DDL Not working
Hi All,
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
I am creating table as:
create table XX as select * from fnd;
select DBMS_METADATA.GET_DDL('TABLE','xx') from dualI get the below given error:
Error starting at line 1 in command:
select DBMS_METADATA.GET_DDL('TABLE','xx') from dual
Error report:
SQL Error: ORA-31603: object "xx" of type TABLE not found in schema "A395513"
ORA-06512: at "SYS.DBMS_METADATA", line 1548
ORA-06512: at "SYS.DBMS_METADATA", line 1585
ORA-06512: at "SYS.DBMS_METADATA", line 1902
ORA-06512: at "SYS.DBMS_METADATA", line 2793
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
31603. 00000 - "object \"%s\" of type %s not found in schema \"%s\""
*Cause: The specified object was not found in the database.
*Action: Correct the object specification and try the call again.Oracle names are stored in dictionary in upper case (unless quoted name is used at create time). Use XX as table name:
SQL> create table XX as select * from emp;
Table created.
SQL> set long 1000
SQL> select DBMS_METADATA.GET_DDL('TABLE','xx') from dual;
ERROR:
ORA-31603: object "xx" of type TABLE not found in schema "SCOTT"
ORA-06512: at "SYS.DBMS_METADATA", line 1548
ORA-06512: at "SYS.DBMS_METADATA", line 1585
ORA-06512: at "SYS.DBMS_METADATA", line 1902
ORA-06512: at "SYS.DBMS_METADATA", line 2793
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
no rows selected
SQL> select DBMS_METADATA.GET_DDL('TABLE','XX') from dual;
DBMS_METADATA.GET_DDL('TABLE','XX')
CREATE TABLE "SCOTT"."XX"
( "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)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
DBMS_METADATA.GET_DDL('TABLE','XX')
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
SQL> SY. -
DBMS_METADATA.get_ddl issues
When you run, select dbms_metadata.get_ddl('USER', 'scott') FROM DUAL; gives following error...
ORA-31603: object "scott" of type USER not found in schema "SYSTEM"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 2805
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
But this works...
select dbms_metadata.get_ddl('USER', UPPER('scott')) FROM DUAL ;
This gives result..
DBMS_METADATA.GET_DDL('USER',U
CREATE USER "SCOTT" IDENTIFIED BY VALUES 'F894844C34402B67'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
PASSWORD EXPIRE
ACCOUNT LOCK
I think the supplied object_name is case-sensitive. but why is it so.SQL> create user new_user identified by pwd;
User created.
SQL> select dbms_metadata.get_ddl('USER','NEW_USER') from dual;
DBMS_METADATA.GET_DDL('USER','NEW_USER')
CREATE USER "NEW_USER" IDENTIFIED BY VALUES 'D1ADB54B2BC01B82'
TEMPORA
SQL> select dbms_metadata.get_ddl('USER','new_user') from dual;
ERROR:
ORA-31603: object "new_user" of type USER not found in schema "SYSADM"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 653
ORA-06512: at "SYS.DBMS_METADATA", line 1260
ORA-06512: at line 1
no rows selected
SQL> create user "new_user" identified by pwd;
User created.
SQL> select dbms_metadata.get_ddl('USER','new_user') from dual;
DBMS_METADATA.GET_DDL('USER','NEW_USER')
CREATE USER "new_user" IDENTIFIED BY VALUES 'D1ADB54B2BC01B82'
TEMPORAnew_user and "new_user" are two differents users.
Nicolas. -
Dbms_metadata.get_ddl wonder...
I'm in the middle of testing a export/import of one database -A - to another - B - (the why is a long, complicated and convoluted discussion of business rules). So I want to grab the ddl for A, in order to create the tablespaces for B prior to importing. Okay, I'll just use dbms_metadata.get_ddl in A, do some editing, and run it in B. No problem. Worked fine. But... when I ran the import, I ran into error after error complaining about space. ?? I look at the script some more and see that the tablespace its importing into is only 1 MB. Its currently 1.5 GB in database A. More poking around, and I fine a difference between the script created with dbms_metadata.get_dd and one I've extracted from Enterprise Manager.
dbms_metadata.get_dd:
CREATE TABLESPACE "PTTBL" DATAFILE
'/oradata/DBATST/data1/pttbl01.dbf' SIZE 1114112
LOGGING ONLINE PERMANENT BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT MANUAL
EM:
CREATE TABLESPACE "PTTBL"
LOGGING
DATAFILE '/oradata/HSCPY/data1/pttbl01.dbf' SIZE 2000M REUSE
AUTOEXTEND
ON NEXT 51200K MAXSIZE 3000M EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT MANUAL
Why the difference? I'm sure I'm missing something obvious, but I've been searching for an answer for this for quite a while.
Thanks,
Hal...here you go...
13:00:46 hscpy.system> select * from DBA_TABLESPACES where tablespace_name = 'PTTBL';
TABLESPACE_NAME BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS CONTENTS LOGGING FOR EXTENT_MAN ALLOCATIO PLU SEGMEN DEF_TAB_
RETENTION BIG
PTTBL 8192 65536 1 2147483645 65536 ONLINE PERMANENT LOGGING NO LOCAL SYSTEM NO MANUAL DISABLED
NOT APPLY NO
1 row selected.
13:00:48 hscpy.system> select * from DBA_DATA_FILES where tablespace_name = 'PTTBL';
FILE_NAME
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
/oradata/HSCPY/data1/pttbl01.dbf
102 PTTBL 2097152000 256000 AVAILABLE 102 YES 3145728000 384000 6400 2097086464 255992
1 row selected.
Yes, its a PeopleSoft database, and its not 1 MB in our "running" version. ;-) I've also looked more closely at the script I created with my incredibly complex script (select 'select dbms_metadata.get_ddl(''TABLESPACE'',''' || tablespace_name || ''') from dual;' from dba_tablespaces;) and am seeing more than a few with SIZE 1114112.
I am running it in the same version of sqlplus. I've set my Oracle environment (with oraenv) to this HSCPY environment and use sqlplus from the same Oracle Home.
Thanks,
Hal...
Maybe you are looking for
-
Missing fonts in PDF placed in InDesign
I was sent a PDF to make slight changes to it. Since the changes were so minor and relatively few, I thought it would be easiest to just place the pages of the PDF into an InDesign document and put white boxes over what needs to change. I just notice
-
How to select value of selectOneChoice
Hello, First of all I want to describe what I want to do and then the preconditions for my case. What I want to do: I simply want a <selectOneChoice> Component which represents an enumeration of values. In database there is a column which has the val
-
Hello Everyone, We have SAP DMS in our compnay and are using SAP Content server to storing the documents. Now,we are installing cFolders in the demilitarised zone(outside compnay network).My questions are: 1.Can we use the same SAP DMS content server
-
How do I reopen all closed tabs that suddenly disappeared.
I'm sending birthday greetings to each of 11 facebook friends; and all of a sudden all my tabs close. Firefox did not crash, it simply closed all of my tabs. Closing Firefox and reopening does not resolve the problem.
-
Why cant i make calls when out of state?
when I go out of state, and try to make a call I get a voice message. Is there a setting for this?