What is the timestamp of a Select from a busy table

  • From: Chen Zhou <oracle.unknowns@xxxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 14 Sep 2016 11:04:37 -0700

Hi, Everyone,
I have a general question (or a few ).  When I do a select from a table
that is actively getting more data inserted, does Oracle just select from
the data at that moment when the select command is issued?
New data that get inserted after Oracle started the select work will not be
included, right?  Is there an accurate way to tell the timestamp/SCN that
SELECT is fixed on?

I have a large table (close to 400G with 160million rows), I would like to
recreate that table with only the most recent data.  Even the most recent
data will be many millions of rows.

This obviously will take hours, if not days.  During these hours/days, the
original table will keep on growng.  There is no timestamp column on this
table to tell a old record from new one.  I can only get the record
creation time from another table through foreign key.

So if I can do "insert into newtable (select * from oldtable where some
column  values in (select column from table3  where timestamp>
sysdate-x))", then after that completes, schedule a downtime to stop the
old table from being written into, then another "insert into newtable
(select * from oldtable where some column  values in (select column from
table3  where timestamp> last select timestamp)", it will have all new data.

But what is that timestamp/scn for that first select statement?  Or is
there a better way to get a new table created with only the new data.

Thanks in advance!
Chen

Other related posts: