Managing the backup tables [message #638778] |
Sat, 20 June 2015 10:10 |
|
scorpy90
Messages: 1 Registered: June 2015
|
Junior Member |
|
|
Hi there:),
I'm new at SQL and I'm trying to solve the following case:
A new backup table has to be created every time before data cleansing takes place. The problem here is that after a certain time the database can get full of backups, which are not needed anymore.
So in order to avoid this problem, after creating a new backup its name has to be inserted in a backup-managament-table which contains information about all backups. The management table could look like this:
--Start of SQL--
CREATE TABLE bck_man (
bck_id number(3) PRIMARY KEY,
bck_name varchar(30) NOT NULL,
end_date date NOT NULL
);
--End of SQL--
‚end_date' would be the backup's date of expiration.
My problem is to write a generic script which does the following: 1. lists all backups with an expired ‚end_date'. 2. The user chooses manually which of those backups should actually be deleted from the backup-managament-table and from the database. 3. The script removes the chosen backups.
First I would list the backups with an expired ‚end_date' in a new temporary table...But I really don't know what to do with steps 2. and 3. ..For example: how can the script read user-inputs dynamically?
I would be very appreciated if someone could give me an advice...
Thank you in advance!
(P.S. my English isn't perfect, please excuse me if I've made a mistake somewhere..)
|
|
|
|
|