【DB笔试面试860】在Oracle中,如何判断Oracle是32位还是64位?

问题

如何在Oracle中确定Oracle数据库是32位还是64位?

答案

由于Oracle数据库分为客户端和服务器端,因此,检查Oracle是32位还是64位也需要分别对服务器端和客户端进行操作。

1、数据库服务器端

方法一:使用SQL*Plus

若数据库是64位,使用SQL*Plus连接后会显示具体的位数信息;如果是32位,则不会显示。

64位:

[oracle@lhrdb2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Sun Sep 25 08:57:22 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

32位:

C:\Users\lhr>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 25 08:55:48 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

方法二:查看V$VERSION视图

若数据库是64位,V$VERSION视图中会显示具体的位数信息;如果是32位,则不会显示。

64位:

SQL> SELECT * FROM V$VERSION;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE   10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 – Production

32位:

SQL> SELECT * FROM V$VERSION;
BANNER
--------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE   11.2.0.1.0      Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

方法三:查看V$SQL视图

64位:输出为16位16进制数

SQL> SELECT ADDRESS FROM V$SQL WHERE ROWNUM = 1;

32位:输出为8位16进制数

SQL> SELECT ADDRESS FROM V$SQL WHERE ROWNUM = 1;

2、数据库客户端端

客户端可以从Linux和Windows平台分别进行分析。

①Linux平台

在Linux平台下,可以使用file命令检查sqlplus可执行文件,以确定是64位还是32位。

32位客户端:

[oracle@dblhr01 ~]$ which sqlplus
/u01/app/oracle/product/10.2.0/db_1/bin/sqlplus
[oracle@dblhr01 ~]$ file /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus
/u01/app/oracle/product/10.2.0/db_1/bin/sqlplus: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

64位客户端:

[oracle@dblhr02 ~]$ which sqlplus
/u01/app/oracle/product/10.2.0/db_1/bin/sqlplus
[oracle@dblhr02 ~]$ file /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus
/u01/app/oracle/product/10.2.0/db_1/bin/sqlplus: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

②Windows平台

在64位机器上运行exp、imp或sqlplus等Oracle客户端命令后,在任务管理器中查看进程。如果文件名后面带有*32,则表示32位程序;否则是64位程序。在32位机器上运行这些命令,如果能成功运行,则为32位客户端;如果不能运行,则说明是64位客户端。

如下图所示为在Windows Server 2008服务器下,客户端为32位的截图:

下图所示为在Windows 10服务器下,客户端为32位的截图:

DB宝分享的IT资料:https://mp.weixin.qq.com/s/Iwsy-zkzwgs8nYkcMz29ag

● 本文作者:小麦苗,专注于数据库技术的应用

● 作者博客地址:https://www./link/a89b9b817d1c710e6ef5000032e1c514

● 本系列题目源自作者的学习笔记,部分内容整理自网络,如有侵权或不当之处,敬请谅解

● 版权所有,欢迎分享本文,转载请保留出处