DBMS_METADATA.GET_DDL - Required permissions in absense of SELECT_CATALOG_R
Hi,
In our production database SELECT_CATALOG_ROLE cannot be given to any normal user because of Security policy.
I am normal user and I would like to use DBMS_METADATA.GET_DDL to get the DDL's of all the objects for creation of physical data model using tool.
In absense of SELECT_CATALOG_ROLE, are there any alternate roles/grants present which can be given to the normal user so that he/she can use GET_DDL for any object in the database?
Many Thanks in Advance!
Might not be exact match but Note 312883.1 talks about this.
Another way could be by create script/procedure to generate the DDL (like we use to do in 9i) and call it in place of DBMS_METADATA. This would require granting of SELECT privs on few dictionary objects. Check below article.
http://www.dba-oracle.com/oracle_tips_dbms_metadata.htm
Similar Messages
-
[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 -
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 -
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 inside the pl/sql procedure
We have a requirement to drop certain materialized view and need to recreate based on certain condition inside the
pl/sql procedure.i am using the dbms_metadata to get the Mv ddls.
var1 := 'SELECT DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW,'MV_NAME','OWNER')'|| 'from dual' || ';' ;
dbms_output.put_line(var1);
But i am unable to get the create ddl syntax in var1.
Can anyone help me on thisHi Deepu,
you are not helping us too much. You information are coming drop by drop.
Anyway, I don't have a materialized view but I have tried with a table.
Here is my test and output (what I expect you too show us too):
First test using normal SELECT FROM DUAL:
SET LONG 2000000
SET HEAD OFF
SET ECHO ON
SELECT DBMS_METADATA.get_ddl ('TABLE', 'ALERT_QT', 'SYS') FROM DUAL;
Output:
SQL>
SQL> SELECT DBMS_METADATA.get_ddl ('TABLE', 'ALERT_QT', 'SYS') FROM DUAL;
CREATE TABLE "SYS"."ALERT_QT"
( "Q_NAME" VARCHAR2(30),
"MSGID" RAW(16),
"CORRID" VARCHAR2(128),
"PRIORITY" NUMBER,
"STATE" NUMBER,
"DELAY" TIMESTAMP (6),
"EXPIRATION" NUMBER,
"TIME_MANAGER_INFO" TIMESTAMP (6),
"LOCAL_ORDER_NO" NUMBER,
"CHAIN_NO" NUMBER,
"CSCN" NUMBER,
"DSCN" NUMBER,
"ENQ_TIME" TIMESTAMP (6),
"ENQ_UID" VARCHAR2(30),
"ENQ_TID" VARCHAR2(30),
"DEQ_TIME" TIMESTAMP (6),
"DEQ_UID" VARCHAR2(30),
"DEQ_TID" VARCHAR2(30),
"RETRY_COUNT" NUMBER,
"EXCEPTION_QSCHEMA" VARCHAR2(30),
"EXCEPTION_QUEUE" VARCHAR2(30),
"STEP_NO" NUMBER,
"RECIPIENT_KEY" NUMBER,
"DEQUEUE_MSGID" RAW(16),
"SENDER_NAME" VARCHAR2(30),
"SENDER_ADDRESS" VARCHAR2(1024),
"SENDER_PROTOCOL" NUMBER,
"USER_DATA" "SYS"."ALERT_TYPE" ,
"USER_PROP" "SYS"."ANYDATA" ,
PRIMARY KEY ("MSGID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSAUX" ENABLE
) USAGE QUEUE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGIN
G
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSAUX"
OPAQUE TYPE "USER_PROP" STORE AS LOB (
ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
CACHE
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
{code}
Now with the procedure storing in CLOB variable
{code:sql}
SET SERVEROUTPUT ON SIZE UNLIMITED
SET LIN 5000
SET LONG 20000000
SET ECHO ON
DECLARE
l_clob CLOB;
BEGIN
l_clob := DBMS_METADATA.get_ddl ('TABLE', 'ALERT_QT', 'SYS');
DBMS_OUTPUT.put_line (l_clob);
END;
Output:
SQL>
SQL> DECLARE
2 l_clob CLOB;
3 BEGIN
4 l_clob := DBMS_METADATA.get_ddl ('TABLE', 'ALERT_QT', 'SYS');
5 DBMS_OUTPUT.put_line (l_clob);
6 END;
7 /
CREATE TABLE "SYS"."ALERT_QT"
( "Q_NAME" VARCHAR2(30),
"MSGID" RAW(16),
"CORRID" VARCHAR2(128),
"PRIORITY" NUMBER,
"STATE" NUMBER,
"DELAY" TIMESTAMP (6),
"EXPIRATION" NUMBER,
"TIME_MANAGER_INFO" TIMESTAMP (6),
"LOCAL_ORDER_NO" NUMBER,
"CHAIN_NO" NUMBER,
"CSCN" NUMBER,
"DSCN" NUMBER,
"ENQ_TIME" TIMESTAMP (6),
"ENQ_UID" VARCHAR2(30),
"ENQ_TID" VARCHAR2(30),
"DEQ_TIME" TIMESTAMP (6),
"DEQ_UID" VARCHAR2(30),
"DEQ_TID" VARCHAR2(30),
"RETRY_COUNT" NUMBER,
"EXCEPTION_QSCHEMA" VARCHAR2(30),
"EXCEPTION_QUEUE" VARCHAR2(30),
"STEP_NO" NUMBER,
"RECIPIENT_KEY" NUMBER,
"DEQUEUE_MSGID" RAW(16),
"SENDER_NAME" VARCHAR2(30),
"SENDER_ADDRESS" VARCHAR2(1024),
"SENDER_PROTOCOL" NUMBER,
"USER_DATA" "SYS"."ALERT_TYPE" ,
"USER_PROP" "SYS"."ANYDATA" ,
PRIMARY KEY ("MSGID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "SYSAUX" ENABLE
) USAGE QUEUE 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 "SYSAUX"
OPAQUE TYPE "USER_PROP" STORE AS LOB (
ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
CACHE
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
{code}
It should be nice if you could post your tests too if they are not working.
Regards.
Al -
DBMS_METADATA.GET_DDL doesn't include function parameters
Sometimes, when I call DBMS_METADATA.GET_DDL to get the DDL statement for a function (which we always do to ensure we're starting from the source that's actually in production), the returned text doesn't include the parameters. Other times, it does, and I'm not able to see any pattern.
I was going to just make a function and show the output, but that did show the parameters. Then I tried calling GET_DDL while logged in as SYS as SYSDBA on my development database, and I still did not get the parameters, so I don't think it's a permissions issue.
Does anyone have any idea what's going on here?It's really difficult to show you exactly what I'm doing when I can't consistently reproduce the problem, as I described.
But here, I'll try.
declare
the_ddl clob;
begin
the_ddl := dbms_metadata.get_ddl('FUNCTION', '*****', '*****');
dbms_output.enable(null);
dbms_output.put_line(the_ddl);
end;
/Sometimes, it produces output like this:
CREATE OR REPLACE FUNCTION "*****"."*****" (
***** in varchar2,
***** in number,
) return *****
...And other times, it produces output like this:
CREATE OR REPLACE FUNCTION "*****"."*****" return *****
...I am not able to determine any consistent reason for this. In our production database, I can log in as myself and get the parameters for a specific function, but another user (that our automated process uses) doesn't see the parameters. In my development database, I log in as myself and I do not see the parameters, but I still don't see them when I log in as SYS AS SYSDBA.
For what it's worth, if I recreate the function on my development database, then subsequent calls do show the parameters. -
Spool Command with dbms_metadata.GET_DDL function
Hi All,
My requirement is before applying a patch on the Database Schema, I need to take a backup of the db objects DDL script, so that incase if I want to rollback I can use it. what I am trying to use is the dbms_metadata.GET_DDL function to get the DDL script and with the help of spool command store that in a text file.
The problem I am encountering is the whole script runs without an error but whne I check the spool file for certain big packages the DDL script is not fully exported. The below is the script that I make use of to generate the DDL script.
set heading off
set feedback off
set echo off
set term off
set newpage none
set space 0
set trimout on
set TRIMSPOOL ON
column c1 format a4000
set long 99999
set lines 1000
exec DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM, 'PRETTY', true);
spool c:\Rollback.sql
select dbms_metadata.GET_DDL('FUNCTION',u.object_name) || '/' c1
from user_objects u
where object_type = 'FUNCTION'
and object_name in ('FN_CALCMASTERDATA_AGE','FUNC_ASSIGNBENEFITSNONFLEX','FUNC_CHECKNEWEMPLOYEE');
select dbms_metadata.GET_DDL('PACKAGE_SPEC',u.object_name) || '/' c1
from user_objects u
where object_type = 'PACKAGE'
and object_name in('PKGT_BEN_YEAR_DETL','PKGT_BENS_TEST');
select dbms_metadata.GET_DDL('PACKAGE_BODY',u.object_name) || '/' c1
from user_objects u
where object_type = 'PACKAGE'
and object_name in ('PKGT_BEN_YEAR_DETL','PKGT_BENS_TEST','PKGT_FLEX_INITIALIZATION','PKGT_EMP');
spool off
Note: Database Oracle 10 g,
Client Machine Windows XP from where the script is ran.
Is there any limitation in amount of data that can be spooled? or is there is any better way to accomplish this task, please help.
Thanks
Saamiset long longer ;-)
set long 1000000 longchunksize 1000000 linesize 32000 pagesize 0 -
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 -
Hi,
I have installed OER-11g version 11.1.1.7 and am successfuly able to open Asset Editor , ImpExp utility and also could harvest SOA and OSB components.
Issue 1:
However while trying to open the Navigator of the harvested components in OER console, a new window opens with two sections ( top and bottom). The top one which is a diagram view doesn't open with an error - Missing required permissions attribute in main jar: http://localhost:7101/oer-web/applets/components.aler-thinkmapclient-11.1.1.7.0.jar.
Please find the screenshot below.
Issue #2 : While trying to browse for the Assets from OER console. The below error is seen ( missing permissions for components.jexplorer-11.1.1.7.0.jar)
Could someone direct me on how to solve this issue. Appreciate your help !
Thanks and regards,
Sridhar.It works for me after I did a small tweak by as mine is a demo install.
Idea - is to make an security exception for the OER url in Java control console
Steps to do that :
1.Go to the control panel and uninstall the 64 bit version of Java
Open Programs and Features and select the 64 bit version of Java and select Uninstall.
2.Open up the Java Control Panel
Found as an option in the standard windows control panel
3.Check the version by clicking on the About Tab
If this is not what you expected you can go to java.com and download the latest version.
4.Click on the Security Tab in the Java Control Panel
5.Click on the Edit Site List button in the lower RH corner of the control panel
6.Add your URL to be allowed
Enter the full path that you use to access this such as https://myequallogics.com or the IP address if that is how you access it (as in http://192.168.0.100 - Https is recommended by Oracle.) Once complete hit OK. You should now see the exception on the security page.
7.Close out of the control panel.
8.You can now acess your site through the browser window.
Thanks to Java error: Missing required Permissions manifest attribute in main jar - Spiceworks for letting me know this.
regards,
Sridhar -
Opening my Photoshop Elements 11 does not work. I always get following message: "Could not open a volume of work, because the file is locked or you do not have the required permissions. Undo the protection of the file on using the command 'Properties' in Windows Explorer." What is wrong? I cannot unterstand what I have to do!
Could not open a scratch file because the file is locked or you do not have the necessary access privileges. (…) | Mylen…
Mylenium -
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. -
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. -
Dbms_metadata.get_ddl including comments.
Hey all,
Is there a way to use the dbms_metadata package to fetch the DDL of a package/function/procedure without removing the comments? For instance if you are using SQL Developer and right click a function and then click edit. The DDL for the function will appear along with the comments. This is what I would like to see.
Any ideas?
Cheers,
Tyson Jouglet
Edited by: Tyson Jouglet on Aug 27, 2009 2:29 PMIs there a way to use the dbms_metadata package to fetch the DDL of a package/function/procedure without removing the comments? Why do you think that the comments are removed?
SQL> CREATE OR REPLACE PROCEDURE p
/* first comment*/
AS
-- some comments
BEGIN
/* some other comments*/
NULL;
END p;
Procedure created.
SQL> SELECT dbms_metadata.get_ddl (
'PROCEDURE',
'P',
USER
) ddl
FROM DUAL
DDL
CREATE OR REPLACE PROCEDURE "MICHAEL"."P"
/* first comment*/
AS
-- some comments
BEGIN
/* some other comments*/
NULL;
END p;
1 row selected. -
DBMS_METADATA.GET_DDL performance
Hi
My application need to run on a schema and get all the DDL of the schema objects.
This action is very heavy on the server and I get 100% on the server CPU.
my code look something like this:
SELECT
D.OBJECT_NAME,
D.OBJECT_TYPE,
TRIM(SYS.DBMS_METADATA.GET_DDL(REPLACE(REPLACE(OBJECT_TYPE,'DATABASE LINK','DB_LINK'),' ','_'),OBJECT_NAME,USER)) AS OBJECTCREATIONSCRIPT
FROM SYS.USER_OBJECTS D
INNER JOIN TEMPOBJECTSLIST OL
ON OL.DBOBJECT_NAME = D.OBJECT_NAME
AND OL.DBOBJECT_TYPE = D.OBJECT_TYPE
WHERE OBJECT_TYPE IN('TABLE', 'VIEW', 'FUNCTION', 'PROCEDURE', 'PACKAGE', 'PACKAGE BODY', 'SEQUENCE', 'TYPE', 'SYNONYM', 'MATERIALIZED VIEW', 'DATABASE LINK', 'TYPE BODY', 'TRIGGER')
Is ther any way to do this faster?
I was thinking on some ways but I do not know how to implement them:
1. working on paralel CPU - The action acording to Enterprise Manager is taking 100% of 1 of 4 CPUs.
2. Add some indexes or run statistics on some where in the database.
3. some other options...
thanksThanks, But I can't use an incremental table for this action becouse of some business logical restrictions of my application.
the application need to do the same action as GET_DDL for all the schema objects like one schema snapshot.
I have a new idea of solving this issue, perhaps someone could help me who to implement it (if it possible):
DMBS_METATDATA package has a procedure GET_XML this procedure is match faster than GET_DDL.
Is ther any way to convert the XML result of GET_XML to a DDL script?
Edited by: rronen on 00:06 01/09/2010
Edited by: rronen on 00:06 01/09/2010 -
DBMS_METADATA.GET_DDL and Materialized View
hi gurus,
In 10gR2, i have created a materialized view EMP_MV with a simple structure.
I wanted to get the DDL of EMP_MV.
I used DBMS_METADATA to get the DDL,
select DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','EMP_MV','TARGET') into v_return from dual;
Output
CREATE MATERIALIZED VIEW "TARGET"."EMP_MV"
ORGANIZATION HEAP 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 "TARGET_TS_01"
BUILD IMMEDIATE
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TARGET_TS_01"
REFRESH FAST ON DEMAND
WITH PRIMARY KEY USING DEFAULT LOCAL ROLLBACK SEGMENT
DISABLE QUERY REWRITE
AS select empid,empname,address from web.emp
Is there any way to get only SELECT part of this MV, ie select empid,empname,address from web.emp directly from dictionary without any string manipulation?
tia,
newbieYes you can do it. By using INSTR and SUBTR against the result of GET_DDL function
Try this:
select substr(DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','EMP_MV','TARGET'),instr(DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','EMP_MV','TARGET'),'select'),1000)
into v_return from dual;- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]
Maybe you are looking for
-
PC Suite - No connectivity established (6300)
please help... specs: nokia 6300 pc suite 6.82.20.2 Win XP Prof Ver 2002 SP2, v.2082 Microsoft Bluetooth Enumerator Cambridge Silicon Radio Ltd BLuetooth Adapter what i did: After clicking "Get Connected!" the Nokia Connection Wizard pops up. After c
-
Java.lang.NullPointerException when doing SQL on ms access
I am trying to perform Insert and delete commands on an access database and I continue to get a java.lang.NullPointerException when performing the action. Everything is fine when i do a Select * FROM..., I am able to read all of the information I ask
-
Daisy-chaining firewire devices
Now that I bought a firewire Audio interface (the Presonus Inspire), I am wondering how to plug in my external firewire HD. Both devices have two firewire sockets, I could daisy-chain them in two ways, right? (Couldn't get it to work today, but the c
-
Still hate versions and autosave
I've given it a week and I still can't get used to the save version/duplicate set up. I understand what they are meant to do, but it is just an awkward workflow for what I do. I hate duplicating an existing file just to edit it and save it as a new
-
Want to update Moving or Standard price from material master to ***.Value ?
Hai Experts, As per Subcontract Logic, 1.1 % of the standard price should be update in J1ID Asseable value.. so I need to update Standard price value should be automatically update in Assesable value whenever it price changes.. Kindly guide me