数据先存储大端。即第一个字节是最小的。
另外一种翻译:高序字节存储在起始地址。
例如:
假设一个整数存储为4个字节(32位),那么一个值为0x01234567(十进制表示)的变量将以0x01、0x23、0x45、0x67的形式存储。在具有大端的系统中,此数据按此顺序存储,而在小端系统中,它以相反的顺序存储。 Little Endian 和 Big Endian 的区别
下图显示了大端和小端的区别。 在 Oracle 数据库中,字节序格式由其工作环境中的字节序信息决定。数据库中的字节序格式告诉我们相关数据库可以移动到哪些环境。在不同的端序环境之间使用常规方法移动数据库是不可能的。例如,您不能用Data Guard 将数据库从 Little Endian系统传输到具有Big Endian的系统。
您可以用以下SQL查看数据库中的当前字节序格式。
SQL> select name,platform_id,platform_name from v$database;<br> <br>NAME PLATFORM_ID PLATFORM_NAME<br>--------- ----------- ----------------------------------------------------------<br>ORCL 13 Linux x86 64-bit<br>
复制代码
以下查询显示了可以移动现有数据库的其他环境。 大端格式 (IBM AIX)
SQL> set lines 200<br>SQL> set pages 200<br>SQL> COL "Source" FORM a32<br>SQL> COL "Compatible Targets" FORM a40<br>SQL> select d.platform_name "Source", t.platform_name "Compatible Targets", endian_format<br>from v$transportable_platform t, v$database d where t.endian_format = (select endian_format from v$transportable_platform t, v$database d where d.platform_name = t.platform_name) <br>order by "Compatible Targets"; <br> <br>Source Compatible Targets ENDIAN_FORMAT<br>-------------------------------- ---------------------------------------- ------------------------------------------<br>AIX-Based Systems (64-bit) AIX-Based Systems (64-bit) Big<br>AIX-Based Systems (64-bit) Apple Mac OS Big<br>AIX-Based Systems (64-bit) HP-UX (64-bit) Big<br>AIX-Based Systems (64-bit) HP-UX IA (64-bit) Big<br>AIX-Based Systems (64-bit) IBM Power Based Linux Big<br>AIX-Based Systems (64-bit) IBM zSeries Based Linux Big<br>AIX-Based Systems (64-bit) Solaris[tm] OE (32-bit) Big<br>AIX-Based Systems (64-bit) Solaris[tm] OE (64-bit) Big<br> <br>8 rows selected.<br>
复制代码
小端格式 (Linux x86)
SQL> set lines 200<br>SQL> set pages 200<br>SQL> COL "Source" FORM a32<br>SQL> COL "Compatible Targets" FORM a40<br>SQL> select d.platform_name "Source", t.platform_name "Compatible Targets", endian_format<br>from v$transportable_platform t, v$database d where t.endian_format = (select endian_format from v$transportable_platform t, v$database d where d.platform_name = t.platform_name) <br>order by "Compatible Targets"; <br> <br>Source Compatible Targets ENDIAN_FORMAT<br>-------------------------------- ---------------------------------------- --------------<br>Linux x86 64-bit Apple Mac OS (x86-64) Little<br>Linux x86 64-bit HP IA Open VMS Little<br>Linux x86 64-bit HP Open VMS Little<br>Linux x86 64-bit HP Tru64 UNIX Little<br>Linux x86 64-bit Linux IA (32-bit) Little<br>Linux x86 64-bit Linux IA (64-bit) Little<br>Linux x86 64-bit Linux x86 64-bit Little<br>Linux x86 64-bit Microsoft Windows IA (32-bit) Little<br>Linux x86 64-bit Microsoft Windows IA (64-bit) Little<br>Linux x86 64-bit Microsoft Windows x86 64-bit Little<br>Linux x86 64-bit Solaris Operating System (x86) Little<br>Linux x86 64-bit Solaris Operating System (x86-64) Little<br> <br>12 rows selected.<br>
复制代码
下面是上文的中的SQL语句:
SET lines 200<br>SET pages 200 <br>COL "Source" FOR a32 <br>COL "Compatible Targets" FOR a40<br>SELECT d.platform_name "Source",<br> t.platform_name "Compatible Targets",<br> endian_format<br>FROM v$transportable_platform t,<br> v$database d<br>WHERE t.endian_format =<br> (SELECT endian_format<br> FROM v$transportable_platform t,<br> v$database d<br> WHERE d.platform_name = t.platform_name)<br>ORDER BY "Compatible Targets";<br>