0

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

4

1 に答える 1

0

面倒ではない方法は、残念ながら一時テーブルのアプローチを使用することです。もちろん、別のスキーマで使用することをお勧めします。すべての操作とデータをデータベースに保持することで、より高速でコーディングが簡単になり、信頼性も向上します。

これが長いタイムスケールではなく、データに他の変更が発生しない場合は、代わりにFLASHBACK TABLEを使用できます。他の変更が発生した場合、フラッシュバック クエリ句を使用して古いデータを復元するのは、少しだけ複雑になります。

于 2013-06-05T10:01:56.893 に答える