开发者

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开发者_C百科 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜