SELECT owner, table_name
FROM dba_tables
This is assuming that you have access to the DBA_TABLES
data dictionary view. If you do not have those privileges but need them, you can request that the DBA explicitly grants you privileges on that table, or, that the DBA grants you the SELECT ANY DICTIONARY
privilege or the SELECT_CATALOG_ROLE
role (either of which would allow you to query any data dictionary table). Of course, you may want to exclude certain schemas like SYS
and SYSTEM
which have large numbers of Oracle tables that you probably don't care about.
Alternatively, if you do not have access to DBA_TABLES
, you can see all the tables that your account has access to through the ALL_TABLES
view:
SELECT owner, table_name
FROM all_tables
Although, that may be a subset of the tables available in the database (ALL_TABLES
shows you the information for all the tables that your user has been granted access to).
If you are only concerned with the tables that you own, not those that you have access to, you could use USER_TABLES
:
SELECT table_name
FROM user_tables
Since USER_TABLES
only has information about the tables that you own, it does not have an OWNER
column – the owner, by definition, is you.
Oracle also has a number of legacy data dictionary views-- TAB
, DICT
, TABS
, and CAT
for example-- that could be used. In general, I would not suggest using these legacy views unless you absolutely need to backport your scripts to Oracle 6. Oracle has not changed these views in a long time so they often have problems with newer types of objects. For example, the TAB
and CAT
views both show information about tables that are in the user's recycle bin while the [DBA|ALL|USER]_TABLES
views all filter those out. CAT
also shows information about materialized view logs with a TABLE_TYPE
of "TABLE" which is unlikely to be what you really want. DICT
combines tables and synonyms and doesn't tell you who owns the object.
Now check in php_info(); that oci8 enables or not if enable then use standard oci8 connections
This is your standard Oracle connection
include('database.php'); //which have database credentials and server name stored
$c = oci_connect($userName, $password, "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =$serverName)(PORT = 1521)))(CONNECT_DATA=(SID=$databaseName)))");
print_r($c);
Try this
Best Answer
Oracle 11g + WAMP + Windows. This tutorial shows you how to use PHP with Oracle Database 11g. First of all let's assume that I am using Windows 7 64bit along with Oracle database 11G and WAMP server, so I have already downloaded Oracle instant client x64. If you are using 32bit Windows then download 32bit client otherwise it wont work. Steps :-
Install Oracle database 11g XE
Install WAMP
Download appropriate Oracle instant client
Extract all the content of Oracle instant client and copy all the .DLL files and paste into the directory like this D:\wamp\bin\apache\Apache2.2.17\bin
Turn on the WAMP server and left click on the icon > PHP > PHP extension > check the php_oci8_11g only. If you are using Oracle database older then 11g like 10g then you must check on php_oci8 only.
Turn on the Oracle database 11g XE services. Also the OracleServiceORCL should be there in services.
Write a PHP code to connect Oracle with database 11g XE, and save the code in www directory of WAMP server. Below is the code: