I have a question that pertains to scripting. For the sake of clarity I'll just start off with a bit of what I'm trying to do. We have a number of testing environments and projects going on in each environment that trying to keep track of what is where is becoming increasingly difficult.
In order to try and straighten this out I was going to create a script that would pull the comments/description (that is where our developers put the code branch,project name,and date of the build into. This is what we use for versioning) of the dll. Then I would dump this information into a simple table on an html page which would be pulled as a web part.
I was using VBS to perform this and I was able to successfully pull a version number and dump it into an HTML page. However, I have not been able to find any information on how to do this for the comments or description (using Server 2k3 and 2k8) fields.
So my question is if there is a way to pull this information using VBS, or would there be a better scripting language that would allow this to be done.
Thanks very much in advance.
I don't think exactly what you're asking for is possible, however this may be helpful:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/filesfolders/files/
Goal is to run a few queries against a database on each new build? Has anyone had any luck without having to put sql in java classes or creating entire new schemas to hold stored procs? Ideally you can include some SQLs in separate files that get run as soon as the build completes.
Might be using maven,bamboo but would love to hear any experiences/successes/difficulties that people have encountered.
You don't say what tools you use for writing you SQL unit tests. If you're using Steven Feuerstein's utplsql tool you should read this artcle on Continuous Integration with Oracle PL/SQL, utPLSQL and Hudson. And even if you're not it might provide some useful insights.
Maybe Team City (Jetbrains) is what you're looking for. It has various build runners, including but not limited to Ant, MS Build, NUnit, Maven and Command Line.
Just configure a TC-project to listen to your svn/git/hg repository for changes, then run a build: first compilation and if successful then Maven (or whatever). Or which-ever way you want to do it.
/mikkel
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.
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.
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.