I'm trying to 'compile invalid objects' in Oracle procedures using Datagrip. I didn't find any option for it. Any advice? Is this even possible?
It was possible to do it in the past, below (DataGrip 2016.2):
The "Recompile" action was just moved into the "Database Tools" submenu:
It could be omitted in one of 2021.2.x versions but in the version 2021.2.2 it does present.
Related
In SQL Server Management Studio, there is a "Parse" menu where you can check the syntax of the stored procedure, without running the stored procedure.
Is there a similar thing in Oracle SQL Developer, to check the syntax of the codes in the stored procedure without executing it ? Similar to compiling it, and see if there is any error ?
Thank you.
Yes...but it does that as you type, it's not an on-demand thing.
There is no...hey compiler have a look at this, but don't actually compile it feature. Our parser is client side and is following the rules of the Oracle SQL and PL/SQL syntax and applies that to the code it sees.
Is there any way to know why the procedures are in error?
They compile well.
Yes it is possible in SQL Developer under "Errors" tab:
Image source: https://thatjeffsmith.wpengine.com/wp-content/uploads/2012/01/show_errors3.png
Related: Viewing PLSQL Compilation Errors in Oracle SQL Developer
I'm triying to import our database which is in WE8MSWIN1252 instance to a new AL32UTF8 instance.
I'm using impdp tool to achieve this.
I get the following error
Processing object type
SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
ORA-39083: Object type ALTER_PACKAGE_SPEC:"MyOwner"."MyPackageOwner"
failed to create with error: ORA-00904: "DECL_OBJ#": invalid
identifier
Please note that when I compile this package using SQLplus it is working as expected
Do you have any idea about what can causes this error ?
Thanks,
Bilel
Open SQL Developer. Set the PLScope identifiers parameter (Tools > Preferences > Database > PL/SQL Compiler > PLScope identifiers) from All to None.
Close and open the SQL Developer.
It solved my issue.
In the support note mentioned above, Oracle says that this error is related to SQL Developer and a specific patched version of Oracle DB (12.2.0.1.181016).
As a workaround it seems you can disable PL/Scope (a functionality to parse and analyse PL/SQL code) like this :
Open SQL Developer Set the PLScope identifiers parameter (Tools > Preferences > Database > PL/SQL Compiler > PLScope identifiers) from All to None.
Close and open the SQL Developer
I have just excluded views, packages and package_compile from the export and this worked as expected.
We have an oracle procedure which is inside a package. When we are calling that Procedure from .NET (Windows Forms) it is giving Operation timeout errors
After seeing this message "Operation Timeout Error" from the screen,when i go to SqlDeveloper and Compile All Packages then after compiling them, the procedure works very fast and i can retrieve the data in 5 seconds.
Can you anyone tell how to solve this issue and what is the root cause?
You should proabbly analyse why package is getting invalid and need compilation before executing and either eliminate code taht causes invalidation or as previous answer says execute compile before running procedure.
Package can get invalid when you alter some dependent objects (swaping table names or synonyms during some load, altering table, dynamically droping and creating objects that package depends on). Those two threads may help you: What Situations Cause Oracle Packages to Become Invalid? and When does an Oracle Package Specification become INVALID If you're able to eliminate package invalidation it is better if you can't go for compilation before each run of procedure.
One more cause that calling procedure from .NET is not recompiling package can be driver. I met such issue a few years ago and remember that changing driver helped. But I don't remember if we changed to managed or unamanged driver.
Try this before run Procedure
ALTER PACKAGE yourpackage
COMPILE PACKAGE;
Sometimes when I browse views or packages in Oracle SQL Developer they have a red icon next to them, indicating that there was a compile error. This seems to randomly happen to objects that compile without any errors or warnings.
They continue to work even with the red icon, but it's confusing and makes me wonder if I'm missing something. What can I do to find out why these objects are being marked as having problems?
I have seen the same; most of the time when a sub procedure was modified and required compilation.
Oracle SQL Developer is not the finest bit of SW engineering. In general i think oracle should just do what they can do good, that is databases ;) Only saying this to indicate that i would not worry to much about such glitches.
I have not seen that problem myself, but i could imagine that this happens when a database object (e.q a table) this package is using has been altered. Even through the package still compiles, oracle somehow marks them. In jdbc, you would get an 'existing state of package has been discarded' message on the first call to the package. Just a guess, it might just be an error, i would not wonder to much, looking at the quality of their java products in general ;)
Oracle will recompile invalid packages on the fly - that's why invalid packages will often work properly.
As others have pointed out, packages will become invalid if any referenced object is altered. The package may or may not compile cleanly - it depends on how the object is altered.