Getting Information with PHP`s Oracle Functionality
(Page 1 of 2 )
In this sixth part of a seven-part series on PHP's Oracle functionality, you will learn how to view database characteristics and user tables. This article is excerpted from chapter 32 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).
Viewing Database Characteristics
As you may remember from Chapter 28, there is a subtle but clear distinction between a database and an instance. The database consists of the files on disk. These files store the data itself, the state of the database in the control file, and changes to the databases data in redo log files. The instance, on the other hand, refers to the Oracle memory processes and memory structures that reside in your server's memory and accesses the database stored in the disk files. For most databases, including Oracle Database XE, there is one and only one instance for each database. For those versions of Oracle Database 10g that support RAC, you can have more than one instance per database.
To retrieve information about the database, you can query the dynamic performance view V$DATABASE; similarly, you can query the dynamic performance view V$INSTANCE to retrieve information about the instance. Listing 32-10 shows you how to retrieve key informational columns from these two views, and Figure 32-3 shows you the results. We discuss dynamic performance views (views that start with V$) in Chapter 35.
Listing 32-10.Querying Database and Instance Characteristics (query_db_info.php)