How to Mimic SQL Developer Database Copy Feature Behavior Through Scripting - oracle

SQL Developer has a feature "Database Copy". I had initially thought that maybe it uses SQL*Plus COPY Command under the hood. However, this doesn't appear to be the case, as you can copy CLOB's through the SQL Developer option. Any ideas on what it uses, and how one could possibly script out a copy using the same methods? I find the feature to work really well when compared to some other database development IDEs for copying data.

Related

Does SQL Developer GUI use an encoding?

I'm using SQL Developer and I have a doubt about displaying data in the SQL Developer GUI. Indeed, I have an encoding concern, and I wanted to check the real state of the data, because I think that maybe the SQL Developer GUI also uses an encoding....
I don't know if my question is clear?
Oracle SQL Developer is a Java application, everything we do is 'Unicode'
That being said, when you open or create a file, you most definitely cause an 'encoding' to be set.
What most folks run into, problem-wise, is using a FONT that doesn't support the characterset being used in their database.
This setting affects display of BOTH your code and your data.
Disclaimer: I work for Oracle and I am the product manager for SQL Developer.

Is there a way to safely compile packages in Oracle SQL Developer

When writing PL/SQL packages I am a using Allround Automations PL/SQL Developer, not only, but also because of its handy feature of Safe Compilation, which uses a temporary compilation object.
So it allows me to just compile my code and if I have any error in my syntax, nobody would be bothered.
Some colleagues are more comfortable working with Oracle SQL Developer (cur. 19.4.0), but it happens, that they invalidate a package and jobs or other overlying layers may get affected.
I was looking at the Preferences of Oracle SQL Developer, but did not found any useful settings, while searching for comp, temp or safe. May I overlooked something.
So my question is:
Is there a way to enable Safe Compilation of packages in Oracle SQL Developer?
No, you're working with an object in a database somewhere.
My best advice is create your own, local, private instance of Oracle to do your development work. Then when you're ready to share that code with your teammates, merge your changes to Git / Compile to the official Development instance.
VirtualBox, Docker, Oracle XE - there are many, easy ways to stand up a copy of Oracle on your machine for development purposes.
Other benefits include - you now get to be your own DBA/god. If you want to debug, step into an ASH report, there's no asking, you own the instance.

Exporting databases or tables can't be done in pl/sql developer

I am currently using PL/SQL developer software to manage my databases, however, when I want to import or export tables or databases, "Export" or "Import" buttons are disabled in it as shown in picture. Here, "Export" button can't be clicked as It is disabled. How can I solve this problem?
Here is the screenshot of that problem
In order to be able to use those utilities, you have to install them onto the computer.
Depending on database version you use, there are two options: data pump export & import, or the original EXP and IMP utilities.
If you access the database which is not installed on your computer (which might be the case, regarding the fact that those buttons are disabled), you can
install them as part of Oracle Client software, or
a simpler option (from my point of view), install Oracle 11g Express Edition (which is a fully-operational, small-footprint database, but it installs all utilities you might need, including export & import, SQL*Loader, etc.)
Both are available in Oracle Technology Network's Download section; pick a version which suits you best. Note that old versions, which are out of support, can't be downloaded any more (but you can ask Oracle to provide them, if you have a valid license).
Littlefoot's answer is correct (i upvoted it).
I wanted also to point out that the three tabs you see in the screenshot you posted (tabs that I am highlighting in the attached image) represent three alternative methods you can use to export database data and structure.
"Oracle Export" uses the official oracle tools you need to install on your client
"SQL Inserts" will produce plain SQL scripts (or a single script for all the tables) containing insert commands (and they will also contain the commands needed to re-create the tables, optionally)
"Pl/SQL Developer" will produce an export file in a proprietary format that can be understood only by PL/SQL Developer (you will need to have PL/SQL Developer to import such file"
Options 2 and 3 do not require external tools.

How to create PDF reports using PL/SQL

Is there PL/SQL package or engine available which would enable the creation of PDF reports from stored procedures?
If your looking for a freeware or open source package, their is this. I've not used it, but it has good reviews. lPL_FPDF If you have a budget, then this, which enterprise class product, meaning excellent documentation, is available. plpdf.
The commercial package is written in native Pl/SQL so will be very easy to use. The open source package I don't know.
If your running in an Oracle environment, with any of the reports servers, then all of then support PDF being emitted both to the printer and stored in the db as blobs.
Its a fairly tedious task to configure it, from what I remember.
Hope that gets you started.
B
PL_FPDF has many problems, such as 32k page limitations and many bugs. I've modified the code and renamed it to wpdf. You can get wpdf here: http://databaseknowledge.com/services.htm
You may want to look into Oracle Application Express to create PDF reports, but depending on how the output is coming out from your stored procedure, it may not be an easy tool to use.
You can find directions here:
http://www.oracle.com/technology/obe/apex/apex31nf/apex31rpt.htm#t1
Oracle Application Express - printing features not to be forgotten. You can use interactive reporting from browser and decide what you need to print. You can apply XSLT also and decide the printing format.

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

Resources