Dbms_metadata ORA-31603
Hi,
PL/SQL behaves different in SQL*Plus and in Apex.
Test 1 (anonymous block):
sql*plus:
========
OWL@NGPO>show user
USER is "OWL"
OWL@NGPO>DECLARE
2 l_sql_ddl VARCHAR2(32000);
3 BEGIN
4 l_sql_ddl := dbms_metadata.get_ddl('TABLE', 'JLI_TGEVALLEN_TFM', 'JLISTG');
5 END tst;
6 /
PL/SQL procedure successfully completed.
OWL@NGPO>
Apex:
====
Apex workspace parsing schema: OWL; the same as the user executing the code-block in SQL*Plus.
Home > SQL Workshop > SQL Commands:
executing the same anonymous pl/sql block as above results in:
ORA-31603: object "JLI_TGEVALLEN_TFM" of type TABLE not found in schema "JLISTG"
Test 2 (stored proc.)
CREATE OR REPLACE PROCEDURE owl.tst
AUTHID CURRENT_USER
AS
l_sql_ddl VARCHAR2(32000);
BEGIN
l_sql_ddl :=
dbms_metadata.get_ddl
('TABLE', 'JLI_TGEVALLEN_TFM', 'JLISTG');
END tst;
Now execute this procedure in sql*plus:
OWL@NGPO>exec tst
PL/SQL procedure successfully completed.
OWL@NGPO>show user
USER is "OWL"
in apex Home > SQL Workshop > SQL Commands:
begin
tst;
end;
==> ORA-31603: object "JLI_TGEVALLEN_TFM" of type TABLE not found in schema "JLISTG"
Any idea?
Regards,
Jurgen
Jurgen - That is correct. Invoker's rights procedures don't work as they do in other places when the session user is APEX_PUBLIC_USER and the code is executed dynamically by the Application Express engine (a definer's rights package). That's just the way it is.
Scott
Similar Messages
-
ORA-31603:While Extracting SQL of a table I am getting this error.
Hi,
I am getting below error whenever I try to get the SQL for any table. I tried executing DBMS_METADATA() also but the same error is coming.
Please let me know what needs to be done IF I want to extract the DDL for any object.
ORA-31603: object "EMP" of type TABLE not found in schema "MKT"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3241
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
Thanks,
Rusty....Hi,
use AUTHID CURRENT_USER show as below exmaple...
CREATE OR REPLACE FUNCTION xx_get_ddl(
p_object_type IN VARCHAR2
, p_object_name IN VARCHAR2
, p_owner IN VARCHAR2
RETURN CLOB AUTHID CURRENT_USER
IS
v_string CLOB;
BEGIN
SELECT DBMS_METADATA.get_ddl(p_object_type
, p_object_name
, p_owner
INTO v_string
FROM DUAL;
RETURN v_string;
EXCEPTION
WHEN OTHERS
THEN
RETURN NULL;
END; -
Problem using IMPDB(ORA-31603:ORA-31693:)
Hi guys i am getting the following errors when i run the following import impdp.
I will show you both my export and import statemnets
EXPORT
./expdp slc/pswd@slc parfile=slc_exp.par
and parameter file contents
DIRECTORY=exp_usac_dir
DUMPFILE=slc.dmp
SCHEMAS=slc
CONTENT=DATA_ONLY
===========================================================
ON IMPORT
impdp slc/pswd@slcldtst parfile=slc_imp.par
and parameter file contents
DIRECTORY=IMP_USAC_DIR
DUMPFILE=slc.dmp
SCHEMAS=slc
LOGFILE=slcutest.log
=====================================================
when i run th eimport i am getting a lot of the following errors
ORA-31603:object "table_EXTENSION" of type TABLE not found in schema "SLC"
ORA-31693: Table data object "QPHRN_MODIFY" failed to load/unload and is being skipped due to error:if i dont want any thing but data on the target database.
i am thinkink about using exclude parameter on indexes,triggers,constraints,views,functions,prodecures,packages. this is how my parameter file will look for import.....
DIRECTORY=IMP_USAC_DIR
DUMPFILE=slcu.dmp
SCHEMAS=slc
EXCLUDE=ref_constraint
EXCLUDE=index
EXCLUDE=view
EXCLUDE=function
EXLUDE=trigger
EXCLUDE=procedure
EXCLUDE=package
EXCLUDE=sequence
LOGFILE=slcutest.log
Let me know if this will work
Thanks
Message was edited by:
mtaji wa maskini -
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 -
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 -
Calling DBMS_METADATA.GET_DDL on scheduler jobs owned by SYS
Hi!
While I can generally retrieve the DDL for scheduler jobs using the PROCOBJ type, this doesn't seem to work for scheduler jobs owned by SYS.
Does anybody happen to have a workaround for this?
SELECT user FROM dual
USER
SYS
1 row selected
select * from v$version
BANNER
Oracle Database 10g Release 10.2.0.4.0 - 64bit Production
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
5 rows selected
SELECT DBMS_METADATA.GET_DDL('PROCOBJ' ,'MGMT_CONFIG_JOB', 'ORACLE_OCM') DDL FROM dual
DDL
BEGIN dbms_scheduler.create_job( ...
1 row selected
SELECT DBMS_METADATA.GET_DDL('PROCOBJ' ,'AUTO_SPACE_ADVISOR_JOB', 'SYS') DDL FROM dual
ORA-31603: object "AUTO_SPACE_ADVISOR_JOB" of type PROCOBJ not found in schema "SYS"
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 1Cheers,
MarcusI guess I need SELECT_CATALOG_ROLE role
http://www.orafaq.com/node/807
SYS and users with SELECT_CATALOG_ROLE can see all objects. -
[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
Hi
I am having issues running this oracle package within a stored procedure. I can get the code to work within a select statement. I can even get it to work within a declare/begin/end statement but as soon as i put it in a SP i get the following error.
ORA-31603: object "MESSAGE_METRICS_PK" of type INDEX not found in schema "XMS"
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
ORA-06512: at "MBLOX_DBA.SP_TEST";, line 11
ORA-06512: at line 2
I am running this from a user that has dba access and all the described privileges described within oracle. The user is trying to get the create index ddl from a different users objects. I have even given the current users direct privs to the objects within the user that owns them.
Please can someone shed some light on to what i need to give the user to beable to run dbms_metadata within a SP.
Cheers
GaryHi,
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1016867
from above doc
>
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
>
Edited by: user6806750 on 14.10.2011 4:34 -
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 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 returns text of table script but not the view
Hi all
I am using a DDL trigger like
CREATE OR REPLACE TRIGGER SYS.log_ddl AFTER DDL
ON DATABASE
declare
n_text varchar2(2000);
begin
if ora_sysevent='CREATE' and ora_dict_obj_type='VIEW' then
select dbms_metadata.get_ddl
(ora_dict_obj_type ,ora_dict_obj_name,ora_dict_obj_owner)
into n_text from dual;
elsif ora_sysevent='CREATE' and ora_dict_obj_type='TABLE' then
select dbms_metadata.get_ddl
(ora_dict_obj_type ,ora_dict_obj_name,ora_dict_obj_owner) into n_text from dual
end if;
end;
on execution
the first condition produces an error if the view does not already exists
ORA-31603: object "TEST" of type VIEW not found in schema "SHAI"
but the second condition of table creation executs successfuly and return the script of the table
what can be the main theory behind this.I think some of the bug fixes were targeted for 9.2.0.5, but I can't tell you for certain.
One of the things I really don't like about DBMS_METADATA is that it returns an error if a specified object does not exist. For example, I created a sql script that would accept a schema name as the input parameter and would generate all the ddl for the schema. If the schema did not have a particular object, for example a sequence, the call to DBMS_METADATA to generate the sequence ddl would return an error instead of returning nothing. I had error checking in the script, so this caused problems. (Oracle's response is that this is expected behaviour).
This might be what is happening with your call.
Dan -
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. -
I have used following method to copy constraints from remote tables;
REMOTE: TEST
LOCAL: hahmed2
SELECT DBMS_METADATA.GET_DDL ('TABLE', v_tablename)
INTO v_copytablename
FROM all_tables
where owner='TEST';
ERROR at line 1:
ORA-31603: object "ORDER_ITEMS" of type TABLE not found in schema "HAHMED2"
ORA-06512: at "SYS.DBMS_METADATA", line 1511
ORA-06512: at "SYS.DBMS_METADATA", line 1548
ORA-06512: at "SYS.DBMS_METADATA", line 1864
ORA-06512: at "SYS.DBMS_METADATA", line 2684
ORA-06512: at "SYS.DBMS_METADATA", line 4220
ORA-06512: at line 1
ORA-06512: at line 29Duplicate thread : Re: Need Help in Constraints Issue
Nicolas. -
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.
Maybe you are looking for
-
Can I use the wizards to build a form that submits multiple checkboxes as an array?
I could do this by hand, but for maintenance ease would prefer that the toolkit understand all my forms. Has anyone else figured out how to do this? Here's the scenario: On page load, a query is used to get a recordset that builds a form representing
-
Time Machine: Make it back up less?
Ok, I don't know how to do this and the discussion board here isn't giving much insight, but I require to find an answer, because right now using an older machine I get pegged at maximum processor peak whenever Time Machine runs in backup, even if it
-
When ever i try to sync my ipod touch, my itunes wont let me on my mac becasue it says i do not have enough access privileges for this operation. What should i do?
-
Field "Value field texts" is disabled to enter new values
Hi there, I'm trying to enter new values on the field "Value field texts" from Depreciation Area, in Config Asset Value Display(Financial Accounting (New) > Asset Accounting > Information System > Configure Asset Value Display). The fields are disble
-
Catalog content missing after upgrade to 11.1.1.6.6
We recently applied the patches to upgrade OBIEE from 11.1.1.6.0 to 11.1.1.6.6. But after the upgrade, all of the catalog contents went missing. I can still see My Folders and Shared Folders, but nothing under them. I still have all of the subject ar