I have some (5) rename statements in a plsql script
drop table new;
rename old to new;
“old” tables hold very valuable information.
As I see it, if the rename command is guaranteed to be atomic, then I´d have one problem solved.
Is it atomic? If not, is there a way to do a “safe” rename ?
Thanks in advance
RENAMEis a DDL command. So it is a single discrete transaction, if that’s what you mean by atomic in this context. Consequently it is about as safe as anything could be. I can’t imagine how a renaming would cause you to lose your data. But if you’re feeling paranoid, just remember that’s why Nature gave us backup and recovery.edit
The way to be sure you don’t lose data if the
DROPsucceeds and theRENAMEfails is to deployRENAMEtwice:That way you have your data online. This also minimises the downtime.