Our demoweb user will have read-only access to the data of the demodata user.
Enter SQL*Plus with system privileges (sys or oracle user) and execute the following statements:
SQL> CREATE USER demoweb IDENTIFIED BY demoweb; SQL> GRANT VxUser TO demoweb;
The UNLIMITED TABLESPACE
privilege is not granted, so demoweb will have a disk quota of zero. That's enough because demoweb doesn't add any data to the database.
Next we have to grant demoweb with privileges of reading demodata tables:
Connect to oracle as demodata:
SQL> CONNECT demodata@csys
Grant read access:
SQL> GRANT SELECT ON VxSegmentation_tab TO demoweb; SQL> GRANT SELECT ON VxSegment_tab TO demoweb; SQL> GRANT SELECT ON VxSegmentStringFeature_tab TO demoweb; SQL> GRANT SELECT ON VxSegmentIntFeature_tab TO demoweb; SQL> GRANT SELECT ON VxSegmentDoubleFeature_tab TO demoweb;
Now, demoweb has read access on demodata tables. But the schema name has to be specified ("demodata" schema):
SQL> SELECT * FROM demodata.VxSegmentation_tab;
It would be better if we can avoid specifying the "demodata" schema. We will do it through views:
Connect to oracle as demoweb:
SQL> CONNECT demoweb@csys
Create views to access demodata tables transparently:
CREATE VIEW VxSegmentation_tab AS SELECT * FROM demodata.VxSegmentation_tab; CREATE VIEW VxSegment_tab AS SELECT * FROM demodata.VxSegment_tab; CREATE VIEW VxSegmentStringFeature_tab AS SELECT * FROM demodata.VxSegmentStringFeature_tab; CREATE VIEW VxSegmentIntFeature_tab AS SELECT * FROM demodata.VxSegmentIntFeature_tab; CREATE VIEW VxSegmentDoubleFeature_tab AS SELECT * FROM demodata.VxSegmentDoubleFeature_tab;
Now, demoweb user can just type:
SQL> SELECT * FROM VxSegmentation_tab;
to access demodata tables.