Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Tom.

Asked: December 10, 2002 - 1:34 pm UTC

Last updated: February 22, 2009 - 5:36 pm UTC

Version: 8.1.7

Viewed 1000+ times

You Asked

Tom:

Hope this gives you a bit of a break from the technical :-). Can you give me a general picture of what a development environment should look like, with regard to permissions in the database? Consider an organization with 2 data architects, 10 application developers (web and otherwise), half a production DBA, and a couple of QA people. The DA's primary responsiblity is designing the database. We get somewhat involved in production issues, and laying out strategies there for the long term, but most of the day to day DB activities fall on the production DBA. That works well.

Regarding the development environment, we have a few different database silos, and each silo has 3 instances: DEV, QA, and PROD.

I would categorize the developers as not having much experience with programming with Oracle, and in some cases, SQL is even new to them. They pretty much do their best, and ask us for help as they go. We try to review the SQL as they go.

The main question is: what about programmers' permissions in the DEV instance? Should they have table create/alter privs there so they can move at their own pace? We (the data architects) are having trouble with this concept because the programmers are not DB designers. We want to own the design, and we want to be the only ones creating/altering tables, even in DEV. Because, if they create something the wrong way, they will code to it, and then later when we object to the design, they will claim they've already done 2 weeks of coding against it and it's too expensive to change now.

I respect your opinion very much, and would appreciate your high level take on this issue.

Thanks.

and Tom said...

I concur, the data model is yours. They should have appropriate grants against it in order to develop the application and you should listen to their input (eg: this query we developers have to run 1000 times an hour is impossible against your schema -- maybe schema needs to change?).

It would be utter chaos for everyone to make up their own stuff -- you are working on a single system -- the data is the core, the heart. It must be built in a coordinated fashion.

Developers should be able to create objects in their own schemas -- to test with, to be able to come to you and say "hey, if it were like this ...." (i think developers should have their own oracle instance on their desktop to play with personally). But they should be congnizant of the fact that their code will only run against the "real schema".

If it is not too late, you might want to make a rule that there will be NO "select, insert, update, deletes" allowed in the application itself -- that'll make tuning, security, fixing the database logic tons easier as well.




Rating

  (24 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

QUESTION

PRS, December 12, 2002 - 7:48 pm UTC

I have a stored procedure. I have put DBMS_OUTPUT lines to print some information for the debugging point of view in the stored procedure. The number of lines with DBMS_OUTPUT is approximately 5% of the number of lines of source code for a procedure. I have put this DBMS_OUTPUT for the debugging point of view. This procedure exist in the production environment. So in case of any failure I can execute this procedure by setting SET SERVEROUTPUT ON and get the output by DBMS_OUTPUT(i.e. debug information) about the code.

My DBA has a problem of having a DBMS_OUTPUT lines of code in the production environment. I asked him the reason. He says it is a policy not to have the DBMS_OUTPUT lines. But he has no valid reason.

Is it wrong to have the DBMS_OUTPUT?



Tom Kyte
December 13, 2002 - 7:30 am UTC

No, your DBA is being silly (i actually have much stronger words for what they are being -- but this being a public forum and all)

You can justify for very good reasons why DBMS_OUTPUT should there.

Your DBA cannot justify squat.

Maybe your DBA thinks Oracle should remove the EVENT system we have for dumping debug? Maybe your DBA thinks the code for generating trace files should be removed from the kernel? Maybe your DBA wants to make it physically impossible to track down issues and problems?

Maybe in order to "make them happy", you could global change DBMS_OUTPUT.PUT_LINE to "MY_PKG.P" and create a package

create package my_pkg
as
procedure p( p_str in varchar2 );
end;
/

create package body my_pkg
as

procedure p ( p_str in varchar2 )
is
l_str long := p_str;
begin
loop
exit when l_str is null;
dbms_output.put_line( substr( l_str, 1, 250 ) );
l_str := substr( l_str, 251 );
end loop;
end;

end;
/

in test and in production:


create package my_pkg
as
procedure p( p_str in varchar2 );
end;
/

create package body my_pkg
as

procedure p ( p_str in varchar2 )
is
begin
NULL;
end;

end;
/


That way

a) you can debug in dev with lines > 255 even...
b) in production, your DBA is a happy camper
c) when you have a "bug" you make them put the right body back in, in order
to get the debug back out.



The way we work

Marc Blum, December 13, 2002 - 4:25 am UTC

In our projects we typically have 4 roles:

- Projectmanagemer/Designer: much experience, gathering of requierements, holding contact to the customer, application design, data modeling, coordination of all development activities

- Project-DBA: good or much experience, focuses on database technology, supports the designers, involved in all design decisions, implements the data model, coaches the developers, maintains all development databases, responsible for versioning and deployment, is aware of all database related activities

- Developer: various levels of experience, development of application code (PL/SQL, C++, VBA, Delphi etc.), works very task oriented

- Tester/QA: low experience, maybe good understanding of the requierements (sorrily often students or part time workers, sigh)

hth


DBMS_OUTPUT.PUT_LINE

Arun Gupta, December 13, 2002 - 9:55 am UTC

Tom
I recently recommended that developers should comment out the dbms_output.put_line from the code which goes into production. The reason was simple. In our architecture, the COM+ components in middle tier call the stored procedures and the dbms_output goes nowhere.

Though it is a good idea to have each developer run Oracle instance on their desktops, I have found the following issues with this:
a) Who creates these instances and database objects and keeps these databases in sync with the integrated development database?
b) Who manages these instances if something goes wrong? These databases are operating without any backup, without any protection from file deletion.
c) Most often, developers will test the application with stored procedures on their local instance and then forget to migrate the code to source control mechanism. This can lead to application breaking down when deployed in integrated development database. The developers come running to the DBA blaming that the development database is not "configured properly".
d) The developers working in their own schema used schema_name.object_name in queries. In the integrated developement environment, the schema_name doesn't exist, the query fails and they again come running to the DBA.
e) Developers create test cases in their local database and then expect the DBA to migrate these test cases to integrated development database. If sequences are used as surrogate primary keys, this may not be possible.
f) How can we ensure that developers will follow the object naming convention and change management procedures?

It can well be argued that the developers can have their own databases with the premise that it will be used as scratchpad and doesn't come with any guarantees or warranties, as development progresses, expectations rise and the local databases sitting on the developer's desk becomes as important as the production database!!

Just my experiences...

Thanks

Tom Kyte
December 13, 2002 - 11:38 am UTC

so? when they want to debug their code -- eg: they get the call "hey, code broke, help" -- what do they do then?

why bother commenting it out? it is a waste of time and energy. Then you have code in production that is not the same as code in dev and test. The slightest difference could cause issues.

Use my "my_pkg.p" approach -- then they could turn p into something that uses utl_file instead of dbms_output even -- this stuff is way to precious to comment out. It has saved my butt a gazzilion times over -- even I have bugs in my code. without this sort of stuff -- i would NEVER be able to fix it. I've dedicated a rather large section of my next book to this topic and how it is so short sighted to outlaw or remove it!!!


a) who said they had to be kept in sync? The developers having their own database is so that they can test ideas, play with concepts. Development takes place in development. If they develop on their desktop -- they have to deploy their changes to development for testing.

b) so? they are - as i said -- to test with, to play with. It is not dev -- it is a playground. A total loss of these databases is not material to anything.

c) that is a problem in your PROCESS then, doesn't matter if they have a database or not on their machine does it? You have this problem with or without a playground

d) why? why do they come "running to you" for an obvious error on their part???? not getting it.

e) why????? I'm not getting it at all. You are talking about migrating data here -- not a test case.

f) BECAUSE THEY DO THEIR REAL WORK IN DEV which gets migrated to TEST which gets rolled out to PRODUCTION. the thing on their desktop -- lets them tune queries without having to bend your arm to get the trace files. Lets them use autotrace without forcing you to give access to v$ tables. Lets them test ideas without asking you to grant them privs (eg: create any context, wanna test out this context thing -- see how/if it works -- prove that it is the best AND THEN I'll approach that DBA guy and see if I can bend his arm to grant this to me in DEV)


But to make them physically REMOVE Debug code -- boy -- you are way off base -- way way off base. Your basic premise is sooooo wrong (my 20cents worth, my experience).




Licence costs

Paul, December 13, 2002 - 12:21 pm UTC

I requested having my own local database to experiment on, but was denied this due to licence cost :-(

Not really for this forum, but it might be worth checking with Oracle (Sales?) to clarify the licencing issues before going down this route.

Paul

Great ideas and follow-up

Eric Givler, December 13, 2002 - 2:08 pm UTC

I think the idea of being able to trace your code is extremely important. With that in mind, though, is it an issue to run: alter <obj> compile debug; on objects (procedures, packages, functions, etc) in your production instance? This allows stepping the server code from the client-side tools like procedure builder.

I've already put the utl_file tracing concept in place, and must say that it works like a charm (the one from the Beginner Oracle book).

I'm a little confused on your "NO SELECT, INSERT, UPDATE, DELETE statements". If you are using a Forms tool, and using base table blocks, this is going to cause a lot of extra code to be written, especially in the case of complex user-entered queries, etc. which forms handles automatically. What's the point of adding to the work if you have a LARGE# of developer written modules? I realize the options to base blocks on other things (stored procs, etc) has been around for quite some time.

Tom Kyte
December 13, 2002 - 3:02 pm UTC

When I said "no insert/update/delete/select" statements -- I was (implicitly -- should have stated it) refering to hand generated code like VB, Java.

Yes, if using a tool like Powerbuilder or Forms -- having select/insert/update/delete is virtually inescapable for practical reasons.

Dave, December 13, 2002 - 2:49 pm UTC

With regard to licensing issues, the OTN License Agreement text that you read (and agree to) on downloading software from Technet states ...

"We grant you a nonexclusive, nontransferable limited license to use the programs only for purposes of developing and prototyping your applications, and not for any other purpose.

...

You may not:
·use the programs for your own internal data processing or for any commercial or production purposes, or use the programs for any purpose except the development and prototyping of your applications;
·use the applications you develop with the programs for any internal data processing or commercial or production purposes without securing an appropriate license from us;
...

etc"

... which I read to mean that you can install EE on as many desktops that want, as long as it is solely for the purpose of development. I think you are covered for the purposes being discussed here.

I beg to differ

Arun Gupta, December 14, 2002 - 2:24 pm UTC

======================================
But to make them physically REMOVE Debug code -- boy -- you are way off base --
way way off base. Your basic premise is sooooo wrong
======================================
Every application has debug features. I am yet to see an application where debug features are left turned on by default. There must be a well defined mechanism to turn on debugging when required. How many times I have read in this forum that every extra line of code has a performance impact associated with it.

Judging a DBA because he asked for debugging turned off (not removed) is not justified in a forum of this standing.

As for the developers having a desktop Oracle instance and database, I have many times read in this forum that any database used for query tuning must be as close to production database as possible. How can this be achieved on a desktop? Secondly, there is a real possibility of the desktop database soon becoming a substitute for the real DEV database.

While the aim should not be to frustrate developers, a well controlled database environment always benefits the developement process in the long run, since a group of persons(DBA/Server Admins/Project Manager/Leads) always know what environment settings a project is being developed under. If a developer migrates a piece of working code from his desktop to DEV server and it breaks down, he can spend hours trying to find what went wrong. I have seen this happen many times. I will give real life instances personally witnessed by me.

Instance one: COM+ components. They worked very well on the desktop because the developer had different version of dll than the server. 8 manhours were spent in trying to figure out which dll was causing it. Result: The developers were asked to develop and test against the server dlls only.

Instance two: Perfectly working code, tested in DEV and INTG, migrated from INTG to Acceptance test. The transactions failed to enlist in the distributed transaction coordinator. The difference was that we moved from Windows 2000 Advanced Server to Windows 2000 Datacenter. Oracle treats both of them as same. I had to open a TAR with Oracle. They asked me to turn on tracing of Oracle Service for MTS at highest level. After looking at the trace files, they suddenly spotted that every 9th transaction was failing to enlist. They told me to set a hidden parameter _max_transaction_branches=32. That fixed the problem. User acceptance testing delayed by two days. Result: We moved all the databases to Windows 2000 Datacenter.

Instance three: Developer tests the code in his schema, works fine. Forgets to migrates to DEV, goes home (most work 6:00am to 3:00pm). The testing lead tests the app at 4:30pm, it breaks down. Developer is called at home, he instructs the dev lead to migrate code from local machine to DEV. Two hours lost. Result: Developers were discouraged from developing in own schema.

All these decisions were taken by project management team. I as a DBA, had no hand in it. However, seeing the headaches it caused, I tend to agree.

We have had our more than fair share of problems in production across multiple projects. The one thing we have not done is use production database as debugging platform. There are 4 pre-production platforms for this purpose. These environments are periodically synch'ed up with production. Any code that goes into production is kosher.

However, things vary by the size of project, technological architecture, available resources, timelines, budgets, contractual limitations and so on. There is nothing like a one size fits all. Thinking that forums are for sharing a variety of experiences and opinions, I had come out with one of the approaches that has worked for us. However, this approach is restrictive and doesn't seem to agree with many. I apologize if I have caused any offense.

Thanks


Tom Kyte
December 14, 2002 - 2:52 pm UTC

dbms_output is TURNED OFF by default. Your premise is wrong. to make they PHYSICALLY REMOVE IT IS WRONG.


There is overhead -- overhead something you can and should avoid.

Then there is mandatory stuff -- stuff that must be in there forever. This falls into this category. You want to see some? Just change the NO to YES in the URL above. I would Never in a billion years remove my debug/timing code. I need it CONSTANTLY.

You said (i quote)

I recently recommended that developers should comment out the
dbms_output.put_line from the code which goes into production.


you made them REMOVE IT -- it is commented out. It is not there. They cannot get it again without physically changing code and putting it back in and recompiling. You let them do that in prod when there is an issue???

I'm not judging you -- I'm saying "you are wrong to do this". Period.


sigh -- why is everyone missing this point of the database on the desktop. You use it to test ideas, to learn, to try things out. You want to find out which approach takes more latches (latches being locks, locks being serialization devices, serialization devices being the thing that kills scalability)? You need a single user instance running in isolation. It is a playground, a scratch database. It is not your development box, it is a playground, It gets wiped out -- big deal, nothing lost, just use dbca and recreate it. See also:
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:6349391411093 <code>
where we discussed this playground database.



I agree a well controlled development, test, production setup is mandatory, I think I've said that more then once here as well. However, if the developer wants to prove that bind variables are better then not using bind variables -- well, they need to flush the shared pool for example. Will you let them do that? Oh yeah, they need to kick everyone else off during the test to make the numbers meaningful. Will you let them do that? No, of course not. So, what can they do then? Well, if they have that little playground instance....

And if the developer cannot migrate his code from his machine to DEV -- how pray tell will it go from DEV to TEST magically? Also, I never said "develop on their desktop" -- that is what DEV is all about. Nuff said on that topic.

Your example with the COM stuff -- that'll happen between DEV and TEST and TEST and PROD. Thing is -- if what you are testing is database stuff -- it won't happen between Oracle and Oracle -- I develop on linux to deploy to solaris or even windows all of the time. We have the same bugs on all platforms so it ports pretty easy.


UAT was not delayed. UAT did what UAT was designed to do. Catch these issues.

And with the developers not being able to have their own schema to test with -- that's a particularly bad example. First -- the pain inflicted here was 100% self induced -- the programmer was the entire cause. What if they had just written the code and not moved it into source code control or something. Having their own schema is not the cause here -- a person making a mistake -- yes. Tell me -- when this same programmer who can no longer test in their own schema AND cannot have a local database wants to compile new functionality into a package that everyone uses -- what then? How many hours will be wasted by:

o the programmer waiting for everyone to stop using it
o the other developers waiting for this programmer to work the kinks out -- you know, debug this piece of code that lots of people use


All of the issues you describe happened without desktop databases -- it is all a project management issue -- all of it policy and procedures. I'm not saying to develop on the desktop -- but boy, if you want to test an idea, having it there is a nice thing.

However, we got so far off topic here -- we were talking debug code which you are making them physically remove. That is a bad policy period. The Oracle data is heavily instrumented and we can turn it on at will (hey, you know that, Support had you do that to track down an issue!!!)

You seem to say "i want homogenous code" but you make them comment out code -- it is no longer homogenous. Perhaps there was a side effect from calling dbms_output that made the code work in test and dev. Removing the call to dbms_output introduces a bug that was not detected. So following your methods we must not only remove the dbms_output from prod but also from test and therefore DEV.

True story: Some C code. Littered with fprintfs to a debug file (had

if debug fprintf( .... )

all over). Someone says "hey, code will run faster if we don't have those if's, comment them out. don't need to test or anything, same code right..."

Well, C being C -- the physical removal of code changed some pointer locations and exposed a nasty application related bug that wasn't exposed when the fprint's were in the source. Bummer, works in test -- debug shows it works -- doesn't crash, all is well in the world. But production -- doesn't work at all. Why? it isn't the code we developed. It isn't the code we tested. It is code sans debug code. So, not only were we handicapped in trying to figure out what was wrong -- we had no debug we could run -- we couldn't reproduce the issue (cause there we did have debug on).

What if the dbms_output somewhere has:

dbms_output.put_line( 'and the answer = ' || f(x) );

well, commenting that out blindly -- just making them remove it -- could easily materially affect the code. What does F do? Is it important? Maybe they really wanted f as a procedure, didn't care about the return value and this was a cheap way to call it (in their mind). Blindly removing the dbms_outputs -- well, that could change the outcome.

You haven't caused any offense, I'm still trying to convince you that leaving that debug code in there is justified and the right thing to do. Making them physically remove it is a very bad idea. If you want to outlaw a scratch database on the desktop -- so be it. I only see positives, no negatives. Every negative you came up with was pretty much policy based. Take the COM+ dll example. Do you think there would have been ZERO hours of fixing if they had the "bad dlls" from the beginning? No -- they would have fought the DLL he%#@ for N hours on the real machine as well (been there, done that, never will I program windows again personally). Not a chance -- they would have spent 4 hours on the dev machine saying "why isn't this working as it should".


Anyway.


Source Control for PLSQL

Tommy, January 29, 2004 - 10:21 am UTC

Tom,

What would you suggest for source controlling in a multi-developers environment for PLSQL packages, procedures, functions and views editing? Seems like SQL navigator can integrate with Microsoft Source Safe, but still we cannot prevent developers to replace a package from script. And other tools like Toad and SQLPlus are not aware of the control that SQL Navigator is forcing.

I have looked at others like PVCS but not in very detail. Would it have similar problem? Plus it seems that we cannot check the history of the package being edited.

Any good suggestion?

Tom Kyte
January 29, 2004 - 1:24 pm UTC

everything will have this "issue" that the developers can ignore the tools. Everything.

Source Control

Tommy, January 29, 2004 - 2:33 pm UTC

Forget about the script problem.

If we have more than one tool (say SQLNav and Toad) for example, how would you suggest we use for controlling? Is there a way better than check in and out a text file into/from Source Safe, then edit by these tools, then check back in from the text file again? I am wondering if we can allow the use of both SQLNav and Toad, and may be some others. But if we use the SQL Nav control (ver 4), then Toad and other tools (even SQL Nav 3) is not under control.

Tom Kyte
January 30, 2004 - 7:42 am UTC

You need to use a check in/check out metaphor if you want source code control, if you want configuration management, if you want to know whats going on

This is no different then if you were writing a C program and some wanted to use visual C and others wanted to use borland C or whatever. You would need to use source code control tools.

PLSQL is just code.
Java is just code.
VB is just code.

if you want configuration management, versions, trackability -- you'll be using source code control tools to do it.

Regarding debugging procedure

Matt, January 29, 2004 - 6:26 pm UTC

I see the advantage of the replaceable package body for enabling debug.

On previous systems I have worked on I have seen this instead though using a globally packaged variable:

procedure p ( p_str in varchar2 )
is
begin
if not g_debug_enabled then
return
else
--dubug processing here
end if;
end;

So, there is a little more overhead to process the if, but the code is always in production (and so it is easier to flick the switch).

Is there any good reason why this should not be used in production code? The systems where I have seen this have typically been batch processing systems (so the overhead is a small % of the overall run time). Would this still be appropriate for OLTP?


Tom Kyte
January 30, 2004 - 8:05 am UTC

yes -- in fact I pretty much do not put the empty body in myself -- I let the code stay there since having it there saves so much time at the end of the day (when you need it, you NEED it)

the "compile an empty body" is for those who would not otherwise let the code in even.

Gupta

A reader, January 31, 2004 - 2:24 am UTC

I hope that you've convinced Arun to leave the debug messages alone c^)....

Source control for teeam coding

Laxman Kondal, June 21, 2005 - 11:07 am UTC

Hi Tom

We are having a problem with our team coding. One developer will make changes in pkg/procedure and another other user is also altering same pkg/procedure and canceling each other modification.

And there are other developers who logged on to same instance and just recompiling without making any change which wipes out all changes made by other developers. And finally the one who recompiles last is the final version of that pkg/procedure.

I created alter and create schema triggers which makes them to lock it first, if not locked by any one else, and keeps records of lock/unlock on every procedure. This helps to allow only one person at a time to alter code.

And the problem with this method is that those users who logged on before alteration has same old code on there procedure editor tool (TOAD/Pl-Sql Developer) and when they lock the object and make changes and recompile they wipe out all modification made by other user. They need to refresh or reconnect to get the latest code which I am unable to do.

How to compare last ddl time of object with the version developer wants to alter from this tool and allow only if timestamp is same, else must logoff and logon.

Is there any way it can be done in Oracle9i?

In one of your reply you mentioned ‘if you want configuration management, versions, trackability -- you'll be using source code control tools to do it.’

Is there any tool available in Oracle9i/10g for source control for team coding and document to learn that tool?

Thanks and regards.


Tom Kyte
June 21, 2005 - 5:12 pm UTC

you can use cvs, rcs, whatever you want with jdeveloper (which also does plsql and does debugging of plsql and so on).

they would check code out of CVS (or whatever), modify it, compile it, then check it back in. anyone that just read code out of database and modified it would get 15 demerits and be made fun of, unless they do it like 10 times then they are shunned from the group and given nothing interesting to do.

Toad might even have hooks into such a system.

Source code hell

Randy, June 22, 2005 - 10:15 am UTC

I'm still trying to keep people from editing directly in the database tool and convince them to keep all the code in scripts in version control. I think they don't believe PL/SQL is real code or something, like it's not compiled and they're just saving a text file.

The answer is to put the PL/SQL DDL in source files, check them in (like Tom suggests), and ONLY have them compiled against the database when checked out of source control. I don't know how you keep some yahoo from randomly compiilng procedures, other than to revoke privs. until he's a good boy. I like the shun/ostracize idea too. Maybe even the stockade.

Tom Kyte
June 22, 2005 - 4:41 pm UTC

You might even have to introduce the concept of the real development database and not even grant them create procedure, YOU or your team checks out the code they've checked in and compile it for them after they test in their testing instance.

code is code, ddl is code, inserts are code, creates are code, code is code

and code needs Configuration Managment, especially if you have more than 2 or 3 coders.

development environment

sam, June 21, 2006 - 9:49 pm UTC

Tom:

We have an environment with three instances: DEV, TEST and PROD. We develop code in DEV, move it to TEST for testing and then move it to PROD for production users.

A small group of developers log in using same account. We are trying to impose more security and accountability feautres. Developers create tables, other objects and code.

If we create one oracle dev account per user, would everyone be able to log in to one instance and create objects there and trace who created/modifed that object. Or each user will have his own schema. Developers also do unit and integration testing in DEV instance.



Tom Kyte
June 22, 2006 - 12:08 pm UTC

the problem would be is that if everyone logs in as "themselves", they would need "create any" privs in order to create the objects in some other schema (very powerful). You would be able to use auditing to track this however.

Better would be - developers test schema changes in their own little database (to get syntax right) and then submit to development dba who checks in changes, then reviews changes, then runs changes.

development environment

sam, June 23, 2006 - 8:36 pm UTC

Tom:

That may not work well with the dba we have. I think it might create a mess.

Can you in oracle set up one schema "xxxdev" and then have 5 developers (each with different user account" log in and create tables/procedures and other objects in "xxxdev". We want to test in one instance but be able to see who created each object or last modified it? We do have change/version management software running in development but everyone is using one account.






Tom Kyte
June 24, 2006 - 11:44 am UTC

you need a real DBA then - you have an infrastructure (political, non-technical) problem here.

To create something in XXXDEV you would need to either:

a) log in as XXXDEV in the first place (not as "yourself")
b) grant CREATE ANY privs to the developers and they can create table XXXDEV.T ...
c) create a procedure in XXXDEV that accepts a string and executes it, grant execute on this procedure to the developers, then they can:

exec xxxdev.run_this( q'| create table t ( x varchar2(5) default 'x' ) |' );

(in 10g, quoted identifiers can look like that, in 9i and before

exec xxxdev.run_this( 'create table t ( x varchar2(5) default ''x'' )' );

would have to be used)


a) not a good solution, what you have now.
b) not a good solution, create any privs are extremely powerful
c) so so solution - xxxdev needs to have all CREATE privs granted directly (not via a role, roles not active in that definer rights procedure), quotes become an issue, sql is hidden in strings....




development

sam, June 25, 2006 - 1:10 pm UTC

Tom:

1. It seems that every schema created in oracle is a user account. Correct?

2. Your first solution is a lot of work. If I am correct you will have a schema for every developer. So every developer will have his own set of tables/procedures. These are constantly changing. It is alot of work to consolidate 6 user accounts into one schema at the end.

3. I want a solution to minimize dba involvement. My goal is to track what a developer did what and when in one schema. IT may not be efficient in your way, but that is my aim. We do not care if it is one account for all as long as we can account people to what they did. Is there an easy way to do this?

Tom Kyte
June 25, 2006 - 5:12 pm UTC

1) yes.

2) it is no work? Developers test ideas in their schema (immediately, without waiting). When idea is fully baked, developer checks in change so that it can be configuration managed and rolled out (with ability to un-roll it out) to the rest of the planet.

It should be no work - less work anyway than "every one in the pool, do whatever you want whenever you want to the stuff we are all sharing, it'll be fun!"

3) no you don't. Or, call the person doing the DBA like stuff something else, maybe "head developer responsible for change management".




Query on Debug methodology

Animesh, April 12, 2007 - 2:34 am UTC

Hi Tom,
If I put DBMS_OUTPUT on every objects to find if some thing comes up as "issue" and by setting serveroutput on, I will eventually switched on debugging feature for all.
Can you suggest some methodology to turn off / turn on debugging feature for a particular component.

Thanks,

Tom Kyte
April 13, 2007 - 11:48 am UTC

why not use a debugger? it is free (sql developer, on otn)


see also http://asktom.oracle.com/tkyte/debugf for an approach.

Version

Animesh, April 12, 2007 - 2:41 am UTC

I forgot to mention Version

SQL> select banner from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE    9.2.0.6.0       Production
TNS for HPUX: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production

Thank you very much

Animesh, April 16, 2007 - 1:39 am UTC

I got the point
Thanks again.

Backtrace

Gary Dykes, September 12, 2007 - 5:19 am UTC

I have found that backtrace can help you to track bugs. We use it in a generic error handling package.

l_bt := dbms_utility.format_error_backtrace;

Say an Oracle error occurs -- the user can select "additional information". Details of package and line numbers can be displayed on the front end. You can insert the datails into a database table using an autonomous transaction. It really is useful.

source code control

JL, August 07, 2008 - 5:54 pm UTC

Hi, to control source code, i found this

http://technology.amis.nl/blog/?p=846


method

sam, February 21, 2009 - 5:05 pm UTC

Tom:

<<Developers test ideas in their schema (immediately, without waiting). When idea
is fully baked, developer checks in change so that it can be configuration managed and rolled out
(with ability to un-roll it out) to the rest of the planet.>>

How would this work? if you have 10 developers, do yo ucreate 10 schemas and one common schema for the application code. when Developer A is done he submits his code to development DBA who reviews and checks in the code to application schema.

but all these developers need to code against the database tables in the application schema. do you create one database in each developer schema? if yes, then you have to maintain the database in 10 different schemas? that would be a nightmare.

You probably mean each developer will create code in his own schema but it will run against the database table in the application schema.

can you clarify.

Tom Kyte
February 21, 2009 - 9:34 pm UTC

... You probably mean each developer will create code in his own schema but it will
run against the database table in the application schema.
...

that is one approach.

methodology

sam, February 22, 2009 - 11:08 am UTC

Tom:

Is this how you would set it up

DEVELOPMENT SCHEMA
--------------

Schema MY_APP_DEV (all database objects)

grant select, update, delete and execute or MY_APP_DEV to all developers. (make sure no dnamic sql is run because they will delete objects that way)

DEV A will create code in his schema A against MY_APP_DEV
DEV B will create code in his schema B against MY_APP_DEV
DEV C will create code in his schema C against MY_APP_DEV

When developers are done, code is submitted to development DBA who compiles the code into MY_APP_DEV.

TEST SCHEMA
-------

When everything works, development dba moves code to MY_APP_TEST for integration testing. Developers will not have access to run code against this schema

PRODUCTION SCHEMA
-------------------
Block all access (C, R, U , D) for all development users against this schema. allow only application users or the code in MY_APP_PROD to run against this.

Tom Kyte
February 22, 2009 - 5:36 pm UTC

sam - there are dozens of possible setups, it would depend.

I would actually like the developers to have their own scratch instance on their desktop for initial testing if I had my way (personal edition - all features)



... (make
sure no dnamic sql is run because they will delete objects that way)
...

that statement makes no sense. you get nothing special or magic from dynamic sql, it is not any different than 'static' sql - since static sql is just an attribute of a precompiler (like plsql has static sql, but it is all really dynamic sql under the covers)

Deepank, April 27, 2010 - 8:03 am UTC

Hi Tom,

In our PROD environment there are 200 odd tables which needs to be sync down to TEST and DEV environment. We have procedures in place which refresh only changed data from PROD to other environments using date columns. But these procedure takes lot of time as they are queried over DB LINK again and again. What is the best possible way to achieve this with minimal overhead?

Thanks,
Deepank