I still do not see relationship between ip and selecting tables. Anyway this is an example in which user scott (database user) can only preform select (action) on the table employees.
SQL> grant select on hr.employees to scott;
I am thinking in high level of security
You can also review the following;
Overview of Security Considerations and Requirements
Lastly you might also review the following thread for clarfication;
Can an Oracle database be made 100% Secured ? Can an Oracle database be made 100% Secured ?
Even if I don't see clearly why you want to limit table access by IP rather then by username, here's a possible solution.
I don't have a database now to test it, so you should try it on your own ... :-)
1. Set up a driving policy with CREATE OR REPLACE CONTEXT ...
2. Create the package associated with the context you defined in step 1.
In the package: Set the context, and define the predicate
3. Define the policy as SYSDBA by using DBMS_RLS.ADD_POLICY.
4. Set up a logon trigger to call the package at logon time and set the context
Use ORA_CLIENT_IP_ADDRESS to identify client's IP address.
What I"ve found out is something like this:
1. CREATE OR REPLACE CONTEXT my_ctx
2. CREATE OR REPLACE PACKAGE my_pkg
IS...here you get the client's IP with a procedure or function... I'd recommend to read about DBMS_SESSION.SET_CONTEXT procedure, too!
3. Define the policy as SYSDBA by using DBMS_RLS.ADD_POLICY procedure
4. CREATE OR REPLACE TRIGGER set_ctx_on_logon
AFTER LOGON ON DATABASE...
I hope you can work it out now!
But why do you want to limit table access by IP?!
The capability you are looking for is built into Oracle's Label Security option.
You can certainly reinvent the wheel if you wish but you would be far better off calling an Oracle sales engineer, reviewing your requirement, and getting a quote.
If you decide to do it on your own, which I would not advise, then some combination of SYS_CONTEXT for the IP Address, a logon triggers, and a CONTEXT or RLS is likely the way to go.