Home » SQL & PL/SQL » SQL & PL/SQL » Managing the backup tables (Oracle, 11g)
Managing the backup tables [message #638778] Sat, 20 June 2015 10:10 Go to next message
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..)
Re: Managing the backup tables [message #638779 is a reply to message #638778] Sat, 20 June 2015 11:22 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Welcome to this forum.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/

If you really intend to complete this task first you need to decide utility or User Interface will be used to interact with the Oracle database.
Plain SQL has NO facility to directly interact with end user.

In most situations it not necessary to create any "temporary" table in Oralce that is especially true for this problem.
Re: Managing the backup tables [message #638783 is a reply to message #638778] Sat, 20 June 2015 14:16 Go to previous message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
Can you give a bit of backgroud to this? Is it, for example, a college homework assignment or a real-world problem? Is the method that must be used (which sounds like using CREATE TABLE ... AS SELECT ... ) fixed, or can you consider better techniques?

My immediate reaction is that I woud use ether the Workspace Manager to create and drop different versions of the table,
http://docs.oracle.com/database/121/ADWSM/long_intro.htm
or perhaps use the Flashback Data Archive facility to save all versions,
http://docs.oracle.com/database/121/ADFNS/adfns_flashback.htm#ADFNS01011

Previous Topic: Generate Start - End date
Next Topic: require output in described order
Goto Forum:
  


Current Time: Fri Apr 19 07:47:04 CDT 2024