Oracle DB (PL/SQL) Refactoring Tools - oracle

I was wondering if there are any good refactoring tools for Oracle databases and especially for PL/SQL. I'm working on a project where half the developers are working with c# and the other half on the db where there is a large and complex schema and a large code base in pl/sql. We also use sql server but the database team work exclusively with Oracle.
This code base is being worked on actively and is being refactored gradually but I was quite surprised to see how bad the refactoring tools for oracle seem to be (or at least in comparison to Eclipse and Resharper).
The developers are using Toad which only has basic refactoring support (probably as its seems to be targeted more towards db admin then development). I've used Toad myself before but always had assumed for pl/sql there were more features for working with code but had never looked into it. Now as far as I can see the only refactorings that it provides are extract method (procedure) and variable renaming. I read an article comparing sql developer and pl/sql developer and these do not appear to have any better support for refactoring. I had a quick look at the eclipse data tools project but couldn't see that they've added refactoring support since I last used it (a few years ago).
For Sql Server there exists Sql Refactor which when table structures are changed gets propagated through to the stored procedures. This for me is much cleaner and less error prone than having someone manually update all stored procedures. I used an older version of these tools on a project in the past and they seemed to be quite ok but a bit slow but that was a few years ago and it was still usable.
Something similar for Oracle would already be a big help for our developement team so I'd appreciate some pointers to good refactoring tools for Oracle if they do exist.
Thanks,
Crocked

As it happens the "D" in TOAD stands Developer not DBA. In fact many DBAs anathematise TOAD and other such tools.
You are out of luck. As far as I know there are no tools for refactoring PL/SQL. The root problem is that refactoring as a concept comes from the OOP paradigm, and PL/SQL is not object oriented. It does not support inheritance or polymorphism (*). This means that many of the techniques which underpin classical refactoring practice (say as defined by Fowler) - abstraction, interfaces, etc - have no analogue in PL/SQL.
The corollary of this is that people who are used to having refactoring as part of their conceptual toolbox tend to avoid programming with PL/SQL. I once got into a heated debate on the TDD list over this. The upshot being that even developers who need and appreciated the virtues of PL/SQL would rather develop in languages with better tool support, clause #1 of the Agile Manifesto notwithstanding.
The most important tool for refactoring is automated unit testing. Although TOAD does not (I think) have integrated unit testing, the next release of Oracle SQL Developer will. There are also standalone unit test tools. I recently mentioned a couple of them in another SO thread.
In terms of refactoring PL/SQL to match changes in the database, arguably most interaction with tables ought to be underaqtken by generated table APIs rather than being embedded in transactional PL/SQL. In this happy realm there is no need for refactoring tools, we just need to re-generate the relevant APIs. The post I linked to above also mentions QCGU, a tool which can do this. Of course, when we have a PL/SQL codebase which isn't organised in such a fashion then life is harder. You won't be surprised to learn that there isn't a lot of tool support for implementing Feathers's WELC in PL/SQL.
(*) Yes, I know Oracle has Types but they are (a) SQL not PL/SQL and (b) how many people out there are actually building APIs using them?

Related

are claims of Oracle being hard to administer on simple tasks correct? aren't there quality admin apps for it? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I see this claim made in a rant here http://discuss.joelonsoftware.com/default.asp?joel.3.456646.47 . As well as in various other rants that can be looked up on google using "oracle sucks". Ok, well, if let's say something as low key as Drupal doesn't have an easy to use visual IDE I can understand why, but if this is really true about something as big money as Oracle, why don't we see an entire ecosystem of user-friendly visual tools for basic DBA work on Oracle? I mean, people who work on Oracle work for companies with big budgets, so surely they could afford a license for a fancy "sit tight and enjoy the ride Oracle admin studio" of some sort to help developers do some stuff by themselves without pestering the DBA? Or do these tools really exist and do good job whereas the people doing the rants are simply unaware of them?
Quest Software has a variety of tools, primarily TOAD but also Spotlight and there is a backup monitoring tool in beta, for database admin.
Part of the issue is that Oracle runs on a variety of platforms, such as Solaris, Linux and Windows. The larger (and therefore more complex) installs have been on more exotic hardware. A 'full stack' admin tool would really have to be native to the database platform, and that just hasn't been practical. That's one reason why the OEM stuff is built as a web-app, and why SQL*Plus, the standard client, has stuck as a command line tool. As has RMAN, the backup/recovery manager.
Another issue is that there is a lot of baggage in Oracle. Rather than a simple "Database = File" or "Table = File" model, Oracle needed to cope with data volumes too big for single files. So they have a concept of a tablespace which maps database objects to data files. That's not so much an issue with modern filesystems.
Finally, Oracle is a high-end product. You use it in situations where the cheaper alternatives can't cut it. So it is often applied in more complex environments which would require more admin anyway. In that way, it is more a case that with Oracle, you can admin your way out of situations which impossible for a competitor product.
There are tools for Oracle, both built-in and third-party.
I think that the tools for SQL Server are a lot easier to use. And third party tools for SQL Server (i.e. Red Gate) are also extremely easy to use and powerful (compared to Toad, which has a byzantine and complex user interface)
Oracle is a multi-platform database and it dates from the original RDBMS implementations generation (one of the first which competed to replace older systems), so it has a lot of layers at install which can be very challenging to deal with. PL/SQL is also more difficult for development compared to SQL Server, MySQL or DB/2 in many ways.
From the point of view of small development shops without dedicated development DBA (or a production DBA who actually understands development) resources, Oracle is less productive than SQL Server or MySQL.
For DBA management and monitoring there's Oracle Enterprise Manager Grid Control. Not an IDE, purely an enterprise-wide administration tool for all of the databases in an organization. Everything from backups to performance monitoring, job creation, alerts, and so forth.
When I was a grasshopper Master Po told me : 'A fool with a tool is still a fool'. As others have pointed out Oracle is a high-end product. You really have to read the documentation, once you understand the basic concepts of oracle there are a lot of tools available. Allmost all tasks are command-line based. A lot of different GUI applications are available to assist you. Oracle's main tools are Enterprise Manager and SQL Developer. Server side you have a few tools you can use: Database Configuration Assitant, Network Configuration Assistent, Migration Assistent, etc. Choose the one you like for a sprecific task. Bottom line is : it's not a point and click application.
If you're deploying Oracle in a large corporate environment, there is an ecosystem of user-friendly tools to administer the database. But most of those tools are relatively painful to install-- they need their own database, for example, and install components on the database server along with the central repository. It makes perfect sense to invest in this sort of heavy-weight infrastructure when you're spending 6 or 7 figures on Oracle database licenses and you need to handle things like continuous monitoring and alerting.
On the other hand, most of the folks that are complaining about Oracle usability are trying to install and run Oracle in a much different environment. If you're a developer, for example, that wants to run Oracle on your local laptop so that you have the full stack installed, you're not going to need or want one of these heavyweight tools. Those folks are going to end up with whatever tools Oracle installs by default. Traditionally, those tools have been somewhat less than ideal. Oracle is getting better about that by shipping a lightweight Enterprise Manager web client with the database that is very useful for these types of installs. But it can still be a bit of a fight to ensure that the Enterprise Manager web client works perfectly on a developer's Windows laptop install which leads a non-trivial number of developers to conclude that "Oracle sucks".
I use an app called PL/SQL developer, and it works pretty well, IMO.
www.enterprise-elements.com is one such tool
You have noticed that you are pointing to a four-year-old rant right? By a supposed DBA who didn't even know enough to turn off unneeded services in order to shorten up the load time?
I'm sorry, but if the complaint is "why can't this industrial-strength DB be managed as easy as this lightweight, feature-poor, freeware?" then I think it is a self-answering question.
To answer the rest, yes there are tools out there. To specifically answer your " I mean, people who work on Oracle work for companies with big budgets, so surely they could afford a license for a fancy "sit tight and enjoy the ride Oracle admin studio" of some sort to help developers do some stuff by themselves without pestering the DBA? " , this is more often a factor of a DBA choosing to lock down privileges - not a function of the database itself. A tool is no use to a developer if their user account is not granted the rights to do what they want.
Rants like that one? Looks like someone tasked with running an app they had no interest in actually learning much about. No wonder they got frustrated. Yes, sometimes Oracle causes frustration of its own, but many of these rants are from people who probably picked a database platform far above their needs, and are disinclined to really learn how to manage it.

What is the perfect toolbox for PL/SQL development?

I work on two projects with a lot of PL/SQL code since few months.
However, I didn't find any really interesting tools to develop on this langage.
For the moment, my configuration includes the following tools:
Eclipse (the rest of the application is developed in Java), with PL/SQL Editor plugin
As I really don't like and trust the PL/SQL Editor plugin for Eclipse, I use mainly PsPad for editing my PL/SQL files.
SQL Developer (I have also TOAD, but I don't really know/like this tool).
So what is your "perfect" toolbox for developing PL/SQL applications?
I've also read that SQL Developer 2.1 introduces a PL/SQL unit testing feature. Does anybody has a feedback about this feature and this version of SQL Developer (I still use 1.5) ?
Being an old-fashioned sort of chap I still mainly get along with SQL*Plus and the TextPad IDE. TextPad is nagware, but the licence is cheap and the tool has some fantastic features. Also people have written PLSQL syntax libraries for it, which give you keyword highlighting. It is also possible to hook TextPad into other desktop tools such as Subversion.
SQL^Developer is written in java, which means it is a voracious consumer of memory. Still there is undoubted merit in having a data browser. Also the upcoming version 2.1 features built-in unit test, which could be very tasty.
Useful utilities:
pldoc :: generate Javadoc-style
documentation from the comments in
your package spec
utplplsql :: unit test harness;
old but it still works
QUTO :: another, more
sophisticated unit test harness
(which I don't use for the same
reason I'm still hacking with
SQL*Plus and TextPad)
QGCU :: PL/SQL code generator
(previously QNXO)
In defence of Luddism
The danger with tools like TOAD and SQL*Developer is that they allow us to execute DML and DDL directly against the database, including editing PL/SQL source. This is fine and dandy and awfully in the spirit of Getting Things Done. Until we need to revert our changes. Or the production DBA demands a script....
Of course it is possible to use TOAD or SQL Developer in a safe fashion - I know SQL Developer can hook into source control as well - if just requires more self-discipline.
I always liked the PL/SQL Developer by Allround Automations - an excellent, quick and easy to use, and totally affordable tool!
For an interactive query shell - much better than SQL*Plus - I used to use "Golden" - a nice and powerful shareware tool, highly recommended.
Much better than anything else I ever tried with Oracle.
Marc
Might be a slightly different answer than you were expecting but I feel the Oracle documentation and in particular this book should be essential for any PL/SQL toolbox.
My primary editor for PL/SQL packages is SlickEdit.
SlickEdit offers good support for PL/SQL development, though you might miss the direct connection to the database that tools like TOAD or SQLDeveloper offer.
On the other hand, working on PL/SQL files (instead of directly working on database objects, like many TOAD users do) is IMO a good practice for any non-trivial project.
In addition to SlickEdit, I use a few self-made helper programs, e.g. one that loads source code from the database and creates a source file, and another one that compiles the source and calculates the correct line numbers for errors in a file that contains multible objects, e.g. both package specification and body.
For direct database access, I prefer SQLDeveloper, mostly because it's free and works well on Linux.
I use:
Eclipse as the IDE
Toby's PLSQL Editor as the PLSQL Eclipse plugin
TOAD as the database tool
utplsql and OUnit as the unit test framework
Ant as the build tool
CVS as the source control tool
pldoc as the documentation tool
CruiseControl as the continuous integration tool
Toby's PLSQL Editor can do:
Syntax highlighting
Code completion
Load to database
Header generation
F3 jump to code

Are there any good free or cheap tools for building an Oracle Database diagram?

I need to diagram an oracle database and I am hoping to find some good tools that are either cheap, or free.
Ideally the tool should allow me to draw the relationships between the tables, as well as remove unwanted tables from the diagram.
I already have access to MS Visual Studio 2008 as well as SSMS 2008, but I don't believe either will provide much help with oracle.
I asked this question here on serverfault, and I had several answers. However after I tried most of the tools I ran into problems with all of them.
I prefer SQL server over oracle, but I have one legacy oracle system to manage, and I am finding myself climbing an uphill battle against the numerous errors oracle throws at you on a minute by minute basis.
Have a look at TOADSoft and especially Toad Data Modeler (Toad is a very famous tool).
Another well known commercial tool is PL/SQL Developer. This is a more integrated solution (not only graphical modeling).
In both case, I didn't check the pricing but I'm sure they are worth it (and the prices must be insignificant in comparison to Oracle's license).
Like your friends over on serverfault, I had a really good experience with PowerArchitect. And it's free. . . .
Maybe I don't understand, but its only a diagram. In which any UML tool will do the job, even Visio, which should have for free or next to nothing for you, not to mention the tools in that blog. And there always pencil and paper.
Visio professional will let you reverse engineer the database schema and I've done this with Oracle before. It's actually quite good for this as you can organise the diagram into subject areas (i.e. separate pages). You can also annotate the diagrams with missing foreign keys; this is quite a useful feature for making sense of vendors' databases.
'Enterprise Architect' versions will also allow you do generate DDL from the diagrams, and you can often get VSEA2002 or VSEA2003 quite cheaply; these versions come with the EA version of Visio bundled.
I think Visio has a feature called "Reverse Engineering", with which you can specify a database connection and it will automagically draw the Diagram for you. The database connection can be anything accessible via ODBC.
(MySQL also offers such a feature in its MySQL Workbench, though I don't remember, if it was possible to specify a different database system than MySQL itself)
As long as we're mentioning pencil and paper, I'll throw in the next step up from pencil and paper. It's MS Access.
If you have MS Access on your PC, and if you can set up table links from MS access to Oracle, you can use MS Access to generate relationship diagrams, which you can then print.
You have to do a fair amount of manual work, compared to some of the pricier tools.
Set up an empty MS Access database. Then set up a table link to each of the tables in your Oracle database. Then use the Access relationship tool to draw relationship lines between each foreign key and the key it references. Classify each relationship as many to one. This creates the lines between the boxes. You can use the Access interface to drag the boxes around on the diagram until you like the visual layout. You can print the resulting diagram.
Oh, and by the way, you can create local tables to act as snapshots of some of the data, and MS queries to reload the local tables from the Oracle data. That way you can mess around with the local copies without writing to the Oracle database. You can even set up table links to a SQL server database, and move data across, bit by bit.
Depending on the complexity of your Oracle DB, and your diagramming needs, this could be enough of a tool for you.
Oracle's own SQL Developer Data Modeler has a "Free to download, free to learn, unlimited evaluation", whatever that means.

Reporting with DB2

I started learning .net about 3 years ago. I have gone thru a boot camp during that time learning OO and various data access technologies such as NHibernate, Subsonic, LINQ TO SQL.
didn't wanna try EF cause it hasn't reached version 3 :)
As far as reporting goes, I have heard that many ORM'S fall flat on their face when it comes to reporting. We have AS400 OR DB2 as our backend. I have heard that LLBLGEN does a good job on reporting for this product. But it is a commercial product and not FREE. Can someone point me to some good resources for Reporting from DB2? thanks for any links/blog articles
Reporting on DB2 will work the same as reporting on almost any other database - you can use ODBC, JDBC or native DB2 calls to the database. So, you don't need DB2 reporting references - any database reporting references should meet your needs.
The only thing special about DB2 might be a little of the syntax extensions, and how you scale up the back end through parallel database servers (like MapReduce, Teradata, etc). But neither should be of much concern - since it's extremely ansi compliant and the scalability should be largely invisible to the reporting developer.
And Crystal Reports, Brio, Cognos, Business Objects, Microstrategy, Actuate, JasperReports, Birt, etc should all work fine.
ORMs are typically terrible for reporting - since they're object rather than set oriented. You'll especially feel the pain with very large data volumes, complex reports or a large number of reports.
Please, don't overlook the most obvious answer: Query/400!
It is native iSeries software. You configure and runs the report on the iSeries but it works great. It is simple, straight forward and maybe a little bit limited but you get most of the works done.
Don't be scared of the green screen or the simple interface. It's really a powerfull tool that does handle the iSeries database very well.
Can someone point me to some good resources for Reporting from DB2?
RPG I!
Light up those indicators!
Query Manager:
You cam use SQL (that can take input parameters) to build it, then create a "form" that will provide totals, level breaks, counts, customized headers, titles, etc.
Query/400 does not accept parameters AFAIK.
Free manual at:
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzatc/sc415212.pdf

Conversion tool for MS-Excel spreadsheets with macros and VB to Oracle?

Our users have created MS-Excel spreadsheets which over time have evolved into fairly complex applications. They run their part of the business with them. But, never having been exposed to software development discipline, these spreadsheets are brittle, single point of failure, solutions.
Our development group uses Oracle primarily with Java and some other technologies. Is there a tools for conversion from MS-Excel to Oracle? At least part way so we can get a head start and not just have to reverse engineer and rewrite?
There are tools that could convert the data, but trying to converting the formulas would cause the design to be inefficient at best and unusable at worst. The difference between spreadsheets and an Oracle database are similar to the differences between a home gardener and a farmer. Both are useful on their level and some of the same principles apply, but the techniques employed are entirely different.
I suggest you examine the spreadsheets until you understand the goals they are trying to meet and then architect a system in Oracle that meets those goals using the best techniques available in Oracle. The processing will end up being quite different, but the product will be significantly better for it.
You can suck a spreadsheet into MS Access, then push it directly into Oracle as a table (or append it to an existing table). I'm sure you could write an MS Access macro to do it.
It also appears to be possible using SQL Loader from Oracle, but I've never tried that myself.
No there aren't any tools that will covert the formulas or logic. You will have to do that the hard way. You can get the data into Oracle by exporting it as a CSV and using SQL Loader to import it into the database.
You can find tools to migrate the data, but other than that you wouldn't find a tool to automatically do this, you would have to do it all manually.
Even directly copying what was there would not make sense, you were using very limited tools (Excel), you would need to re-analyze the requirements, and possibly modify them before doing anything else.

Resources