Sometimes it’s necessary to determine certain characteristics of your server. For example, you might have the task of installing the Oracle database binaries, and before you download and install this software, you need to know the system architecture and operating system version of the target Linux box.
Solution Use the uname (print system information) tool to display system details. This example uses the -a option to print all the information:
$ uname -a Linux dv2.rmug.org 2.6.9-55.0.6.ELsmp #1 SMP Tue Sep 4 21:36:00 EDT 2007 i686 i686 i386 GNU/Linux
The previous output shows the kernel name (Linux), hostname (dv2.rmug.org), kernel release (2.6.9-55.0.6.ELsmp), kernel build (#1 SMP Tue Sep 4 21:36:00 EDT 2007), name of hardware (i686), processor type (i686), hardware platform (i386), and operating system (GNU/Linux).
How It Works In today’s global environment, you’ll often find yourself connecting remotely to database servers located in dispersed data centers. In these situations, you’ll find yourself constantly using the uname command with the -a option to verify what machine you’re logged on to. Use the –help parameter to display all the choices available with uname in your environment.
From the prior output, if you wanted to view only the kernel release version of your Linux server, you can use the -r option of the uname command, as shown here:
$ uname -r 2.6.9-55.0.6.ELsmp
In a Linux environment, you can also view server information by querying the virtual files in the /proc directory. For example, you can view the current version of the server by viewing the /proc/version file:
$ cat /proc/version Linux version 2.6.9-55.0.6.ELsmp (firstname.lastname@example.org) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)) #1 SMP Tue Sep 4 21:36:00 EDT 2007
THE /PROC VIRTUAL FILESYSTEM
The Linux /proc virtual filesystem acts as an interface for viewing and configuring kernel parameters. The /proc directory is a hierarchy of files and subdirectories that contain the current settings of kernel values. It is appropriately named /proc because this virtual filesystem sends information to other system processes. The /proc filesystem is virtual because its files don’t actually reside on disk. You’ll note that most files beneath the /proc directory have a 0-byte size. The /proc virtual files are created dynamically in memory from kernel data when you access them. For your convenience, the /proc filesystem is subdivided into directories that contain related parameters. For example, the /proc/sys subdirectory contains many of the parameters used to configure the kernel. Use the man proc command to view documentation on the /proc virtual filesystem for your server.
Interestingly, some utilities such as top and free extract information from the /proc virtual files and present it in a human-readable formatted fashion. Table 9-1 describes some of the virtual files in the /proc directory. Use your favorite file-viewing utility (cat, more, less, view, grep, and so on) to inspect these virtual files.
The Oracle installation documentation recommends installing the binaries on a server with powerful CPUs. You want to display the CPU characteristics on your Linux server.
Solution You can quickly obtain in-depth information about the physical characteristics of the CPU(s) on a Linux server by viewing the virtual /proc/cpuinfo file:
$ cat /proc/cpuinfo
For multiple processor boxes, there will be a section in the output for each CPU. The first CPU on the box is identified as 0 and the next one as 1, and so on. Here’s a partial listing of some typical output from /proc/cpuinfo:
processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.66GHz stepping : 5 cpu MHz : 2667.494 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1
How It Works Sometimes you need to know whether the CPUs on your box are powerful enough to handle the database software being installed. If you have multiple CPUs on your server, then you’ll see a listing for each CPU. Use the information in the /proc/cpuinfo file to determine whether your server meets Oracle’s prerequisites for CPU minimum megahertz speed (this is usually the cpu MHz line in the /proc/cpuinfo file).
Displaying Physical Memory
Oracle’s installation documentation recommends you have a certain minimal amount of memory installed on the Linux server. You want to verify you have enough memory on a box before you do a database installation.
Solution With Linux, you can view the contents of the /proc/meminfo file with grep to check the total physical memory amount:
$ grep MemTotal /proc/meminfo MemTotal: 2074904 kB
To view the total amount of swap memory, issue the following grep command:
$ grep SwapTotal /proc/meminfo SwapTotal: 4184924 kB
When dealing with database servers, you have to be aware of two types of memory: physical RAM and virtual (swap). Depending on the software you install on a box, you are sometimes required to check to see whether there is sufficient RAM and swap memory on the target server. If you don’t have enough physical or swap memory, usually the Oracle Universal Installer will alert you as to any inadequacies when attempting to perform the installation. You can also view physical and swap memory by issuing the free command with no options. This command gives you a view of the currently free and consumed memory on the box:
$ free total used free shared buffers cached Mem: 2074904 2050512 24392 0 84704 1759792 -/+ buffers/cache: 206016 1868888 Swap: 4184924 74652 4110272
Additionally, if you want to view per-process memory consumption, use the following cat commands:
$ cat /proc/<PID>/maps $ cat /proc/<PID>/status