Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can compilation of several Oracle Pl/SQL package be an atomic operation?

If I deploy N pl/sql packages to Oracle DB, can I make their compilation atomic i.e. the changes in these packages will be applied after the successful compilation of all packages?

like image 616
Alexey Kalmykov Avatar asked Apr 23 '10 08:04

Alexey Kalmykov


People also ask

Which of the following is true about PL SQL package body?

Which of the following is true about PL/SQL package body? The package body has methods declared in package specification and private. It is created using the CREATE PACKAGE Statement.

What is the process for PL SQL compilation?

PL/SQL executes in a virtual machine, and it first translates (compiles) your code into virtual machine code, sometimes called bytecode or mcode. This is basically the same model that Java uses. When it is time to actually run your code, however, that bytecode is translated (interpreted) into system calls.


2 Answers

Since packages are editionable you could look at edition-based redefintion. This would give you a way to atomically switch between versions of your packages.

like image 62
Janek Bogucki Avatar answered Sep 30 '22 01:09

Janek Bogucki


CREATE OR REPLACE and ALTER PACKAGE are DDL statements, and each single DDL statement is a discrete transaction. A COMMIT is issued before and after each DDL command; that is why there is no rollback for DDL.

It seems to me that you have a configuration management issue. And configuration management, plus source control, is the way to fix it. Keep all your PL/SQL scripts (heck , just all your scripts) under version control. When you deploy a new version of some PL/SQL programs check out the previous versions too (into a separate sub-directory, or whatever makes sense under your deploymenet regime). Then if there are any problems with the new versions of your packages it is a cinch to re-deploy the old versions.

like image 42
APC Avatar answered Sep 30 '22 01:09

APC