Wednesday, May 28, 2008

Tip#13 Big Vs Little Endian

Little Endian means that the low-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. (The little end comes first.) For example, a 4 byte LongInt

Byte3 Byte2 Byte1 Byte0

will be arranged in memory as follows:
Base Address+0 Byte0
Base Address+1 Byte1
Base Address+2 Byte2
Base Address+3 Byte3

Linux, Windows use "Little Endian" byte order.


Big Endian means that the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. (The big end comes first.) Our LongInt, would then be stored as:

Base Address+0 Byte3
Base Address+1 Byte2
Base Address+2 Byte1
Base Address+3 Byte0

Solaris, HPUX, Apple Mac use "Big Endian" byte order.


In Oracle 10g, following SQL should tell you which operating systems follow which byte order,

select * from v$transportable_platform order by platform_id;

To transport tablespaces between OS with same byte orders (endianness), we don’t need conversion in other cases we do which can be done using RMAN. E.g. I need to transport a Tablespace from Linux (Little Endian) to Solaris (Big Endian)

RMAN> convert tablespace XXX to
platform ‘Solaris[tm] OE (64-bit)'
db_file_name_convert '/app/oracle/oradata/mbs’,
'/app/oracle/rman_bkups';

Now this file can be copied over to the target Solaris system, and the rest of the steps are easy.

2 comments:

Serg K. said...

According to
Note:413484.1 Data Guard Support for Heterogeneous Primary and Standby Systems in Same Data Guard
and
Note 113178.1 - How to Move a Database to a Different Platform
Note 277650.1 - How to Use Export and Import when Transferring Data Across Platforms or Across 32-bit and 64-bit Servers

We can't transport between Solaris Sparc and HP-UX - both are Big endian. Why?

Unknown said...

Data Guard is not supported across platforms (e.g. Solaris and HPUX). Quote from the same metlink article (Note:413484.1)

"Differences between the primary server(s) and the standby server(s) are permitted as long as the Oracle software installed on all servers is of the same Oracle Platform as defined above, and is certified to run on each server. Examples of such differences that are supported include the following:

* hardware manufacturer (e.g. Dell and Sun or Hitachi and EMC)
* hardware configuration (e.g. number of CPUs, amount of RAM, storage configuration, etc)
* processor (e.g. x86-64 AMD64 and x86-64 Intel 64; POWER4 and POWER5)
* operating system distribution (e.g. Red Hat Linux and SUSE Linux)
* operating system version (e.g. Windows 2000 and Windows XP)"


Regarding transporting between Solaris Sparc to HP UX, can you pass me further details like Oracle version, OS version and 32/64 bit . And if you have already tried what error you get?

Regards
Mehul