Is there a good alternative to SQL*PLUS for Oracle? - sql

I am not a fan of using SQL*PLUS as an interface to Oracle. I usually use yasql, but it hasn't been updated since 2005 and can do with some improvements. A quick Google search shows yasql and SQLPal. I am using linux, so SQLPal is not an option.
Are there any alternatives out there, or am I stuck with an interface that I do not like or one that is no longer maintained?

I presume that you want a low-overhead method of knocking out queries, but want more functions than SQL*Plus provides? Why not use Oracle's SQL Developer? It's free.
Install, make a new connection to your database, then just start typing a script. Press F5 to run it (or just the part of the script that you've highlighted).

Take a look at gqlplus. It wraps sql*plus on linux and makes it more user-friendly by adding things like command history, table name completion and so on.

Emacs can provide so much more powerful text editing features and functionality beyond the default SQL*Plus command-line interface.
Here are a few links on how to use Emacs as a wrapper for SQL*Plus:
Emacs and Oracle
EmacsWiki:SqlPlus

TOAD is pretty expensive, but you can download a 90-day trial from the Quest site to see if it's got the feature set you want (don't be fooled by the "freeware" title - it's only free for 90 days, and then it expires, which definitely makes it shareware):
http://www.toadworld.com/Freeware/ToadforOracleFreeware/tabid/558/Default.aspx
Another options is a tool I've seen on CodeProject:
http://www.codeproject.com/KB/database/OQuery.aspx
It's in .NET, so you'd have to see if it compiled on Mono, but it might be worth a shot. I haven't used either tool (Toad or this one), since I'm a SQL Server guy, but I've heard good things about Toad.

If it's command-line you want, I'd recommend rlwrap to go with sqlplus; it gives you line-editing capabilities and command history, making sqlplus a somewhat usable tool.

You could try PL/SQL developer from allroundautomations, there is a trial available and the price is much lower than TOAD.
Regards
K

Take a look at Senora. This tool is written in Perl and therefore is cross platform. Also Senora is free, extensible and intends to be your primary Oracle shell. You can extend Senora easily by providing you own plugins. Senora attempts to provide a friendlier output formatting than sqlplus. Columns tend to be only as wide a really needed.
Another interesting alternative is SQLcl. It provides in-line editing, statement completion, command recall, DBA stuff (e.g. startup, shutdown) and also supporting your previously written SQL*Plus scripts.

It depends what you are looking for.
If it is a GUI query tool, then Oracle have their free SQL Developer product (though it has a hefty footprint). There's a few free cross-database ones too. I like SQUirrel SQL client myself. There's also DBVisualiser and a few others.
JEdit is an editor that has a DBConsole plugin for running database queries and DML/DDL.
They are all java based so run most places.
If you like a command line, check out sqlpython (the developer has identified a couple of others too)

I like SQL Developer. It's free, has an intuitive UI, and runs on Windows, Mac, and Linux. It also supports many sql*plus commands and supports version control

Apparently Oracle itself has phased out sql*plus and replaced it with SQLcl, which supports more modern features such as history, formatting, etc: https://www.oracle.com/database/technologies/appdev/sqlcl.html.

open source version of TOAD is TORA:
tora.sourceforge.net

If you're the VIM type kind of guy then I'd look into Vorax. It is basically a VIM wrapper around SQL*plus.

Have used both Toad & SQL Navigator, and I love the stability SQL Navigator has.

i like sqlsh
alias sqr='sqlsh -d DBI:Oracle:MYSERVER.COM -u USER -p PASSWORD'

toad from quest software if you can pay for a license
sql squirrel if you can't.

I used my own tool ocimlsh in conjunction with rlwrap.

I just use socat to add readline support to sqlplus. History and a working backspace key actually turn sqlplus into a pretty decent tool.
In my .bashrc:
function sqlplus {
socat READLINE,history=$HOME/.sqlplus_history EXEC:"$ORACLE_HOME/bin/sqlplus $(echo $# | sed 's/\([\:]\)/\\\1/g')",pty,setsid,ctty
status=$?
}
You might see alternatives that alias sqlplus to socat, but you will quickly discover that doing so prevents you from invoking sqlplus with its various command line options.
CAVEAT: Be sure to set $HOME/.sqlplus_history permissions to 0600. Passwords that you type end up in the history file. You might also consider adding cat /dev/null > $HOME/.sqlplus_history to your .bash_logout.

Related

Oracle SQL Automation

I have a question regarding Automation.In my project we have 35 SQL scripts with same logic,same scripts for all those, with only 4 parameters different how can i automate these in TOAD for Oracle?
Depending on your version of Toad, there could be a 'Automation Designer' under the 'Utilities' menu item. This will allow you to run scripts automatically, based on a bit of logic. It also supports running with parameters.
The tool 'Toad for Data Analysts' can also be used to model automated scripts, and run them with specific parameters.
If you have any of these tools available, I would suggest giving them a try, or at least read up on their documentation. If you don't have access to these, let me know so I can try and think of a different solution.

Oracle: Is there a way to encode a value using the unix crypt method?

Is there a way to encode a value using the unix crypt method in oracle 10g?
(Other DBMS like MySQL support this)
The DBMS_CRYPTO PL/SQL package has encryption, but none using the native weakness of the Unix crypt(1). It's much more analogous to crypt(3).
If you need the exact crypt(1) implementation, you're going to have to code it yourself. Here's the C code for it.
Provided you are one Oracle8i or higher this is possible.
The solution is to write a Java Stored Procedure which can execute OS commands, and use that to run Unix crypt. Tim Hall's Oracle-Base site has an example of how to code one of these things. Find it here.

How do I compile Oracle SQL scripts?

I have a series of SQL files, and I want to compile all of them. If do them manually by using benthic software, it takes a long time. I tried using TOAD, but I don't like to use cracked software. Can you help me execute a SQL file? I want to write a program to do some things for me.
From sql/plus I tried to create batch file but in some of my sql file developer used "/" and ";" so it caused sql/plus suddenly stopping the compilation. Please advise or recommend free software to help.
"I want apply the sql package , function and if they are invalid compile them again"
I am using oracle 10g.
Thanks
If you search for something like TOAD, try SQL Developer, a free tool from Oracle.
If you want to recompile existing source in your database, you can use dbms_utility.compile_schema.
If you try to install several files in a batch, SQL*Plus should work for you. Make sure that your files have the right format.
It sounds like you need to run a large sql script. Correct? Sql/Plus should work, but if you want a free IDE, I recommend SQL Developer. It isn't perfect, but it is one of the better free solutions.
"in some of my sql file developer used "/" and ";" "
You need to consistently use these to have any hope of using a tool to deploy. You don't want to have to use a GUI to deploy, so SQL*Plus is the standard to aim for. A good Oracle GUI should be able to run a SQL*Plus deployment script.
I generally start with SET DEFINE OFF otherwise unexpected ampersands (&) cause issues.
Do some basic grepping - any script with a CREATE PACKAGE, CREATE PROCEDURE, CREATE TRIGGER or CREATE TYPE (including CREATE OR REPLACE) should have a the "/" to execute that statement. If they don't, fix them.
For a first run though, I'd take them in batches of 10, until I was sure that they executed correctly. I wouldn't worry about compilation errors as long as they load. Afterwards, you can do a recompile of any invalid objects in the schema.
Then check USER_ERRORS to see what is still broken.

SQL Server Version Updating Tables

I am part of a software development company looking for a good way to update my SQL Server tables when I put out a new version of the software. I know the answer is to probably use scripts in one form or another.
I am considering writing my own .NET program that runs the scripts to make it a bit easier and more user-friendly. I was wondering if there are any tools out there along those lines. Any input would be appreciated.
Suggest you look at Red_gate's SQlCompare
What kind of product are you using for your software installation? Products like InstallShield often now include SQL steps as an option for part of your install script.
Otherwise, you could look at using isql/osql to run your script from the command line through a batch file.
One of the developers where I'm currently consulting wrote a rather nifty SQL installer. I'll ask him when he gets in how he went about it.
I am using Red Gate's SQL Compare all the time. Also you need to make sure to provide a rollback script in case you need to go back to the previous version.
Have a look at DB Ghost Packager Plus.
Packages your source database and the compare and sync engine into a simple EXE for deployment. The installer EXE will automatically update any target schema to match the source on-the-fly at installation time.
Red Gate's SQL Compare to generate the change script, and Red Gate's Multi Script to easily send it to multiple SQL databases at the same time.

How to export a DB2 database without a DB2 server

I have a db2 database file, but do not have a db2 server. I would like to export this data into something else (e.g. SQL, but it doesn't really matter what), without having to setup a full db2 server (I started looking into this, but it seems very involved).
Ideally the tool would run on (Debian) Linux, but Windows/OS X is fine if necessary. An online service would be acceptable, although the db is 400MB. A free tool would obviously be preferable, but I'd consider something that wasn't free as long as it wasn't too expensive (this is a one-off task).
(In response to the comment: I downloaded Express-C, and ran dp2prereqcheck, db2setup (didn't seem to do anything), and db2_install. It's not clear how to actually run the server (googling references "db2start", but I cannot find such a file. Googling didn't find me any other setup instructions). Such instructions would be fine. There are nearly 200 files in /opt/ibm/db2/V9.5/bin/, none of which are an obvious start point, and I don't relish trying them all when none seem to offer any --help).
Perhaps you can find someone with a functioning DB instance that can export it for you.
I don't know the answer, but the DB2 SQL Cookbook is available here.
If the answer would be somewhere, I think it might be there.