I m creating a unix script for our prod enviornment. Requirement is to create a backup of table (not the entire table) few rows. Perform some operation on table(update and delete). At end delete new data and restore back. Problem is how to take backup in prod enviornment. I cant have temp table there.
Script it something like this.
spool below query
select 'insert into <tablename> values ( ' || col_1 || ','|| col_2 || ','|| col_3 .. so on
from <tablename> <where condition> --- generate backup
perform operation on table <delete/update>
delete new values
Restore backup executing spool file
I find this appoarch kind of tedious, is there any better way to accomplish this task?
Note :- This script will be executed in prod where I dont have access to create table. Can perform only update/delete on given table.
Database - 10g