Database Administration (MOSC)

MOSC Banner

merge command, duplicated rows

edited Jul 16, 2015 9:09AM in Database Administration (MOSC) 2 commentsAnswered ✓

Hi,

table rasm_segments has a unique index on (owner,segment_name,partition_name,segment_type).

a program designed to run update the info of this table from dba_segments using the following merge command:

merge into rasm_segments r_seg

      using (select null segment_id,

                    d.owner,

                    d.segment_name,

                    d.partition_name,

                    d.segment_type,

                    d.segment_subtype,

                    d.tablespace_name,

                    round(d.bytes / 1024 / 1024, 2) mbytes,

                    d.blocks,

                    d.extents,

                    null first_analyzed,

                    null last_analyzed,

                    null state,

                    null temprature,

                    null status

               from dba_segments d

               join rasm_tablespaces t

                 on d.tablespace_name = t.tablespace_name) dba

      on (r_seg.owner = dba.owner and r_seg.segment_name = dba.segment_name and r_seg.partition_name = dba.partition_name and r_seg.segment_type = dba.segment_type)

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center