The method of realizing common user query x$ base table by creating view and synonym way

Source: Internet
Author: User

See a group of people asked the ordinary user access to the base table problem, the test is as follows:

The x$ base table can be accessed by creating a view, and then creating a synonym, authorization, and access to the base table for ordinary users.

Of course, ordinary users visit the base table is not reasonable, theoretically not necessary, permission control should also be disallowed. It is not considered reasonable here to experiment on this issue.

1. Create synonyms directly on the x$ base table, and other users will not be able to implement access.

Sql> show Useruser is ' SYS ' sql> select COUNT (*) from Sys.x$kcbwds;  COUNT (*)----------         8sql> CREATE public synonym Kcbwds for sys.x$kcbwds; Synonym created. Sql> Grant Select on Sys.x$kcbwds to Bys;grant Select on Sys.x$kcbwds to bys                    *error @ line 1:ora-02030:can only s Elect from fixed tables/views----------sql> show Useruser are "BYS" sql> Select COUNT (*) from Sys.x$kcbwds;select Coun T (*) from Sys.x$kcbwds                         *error on line 1:ora-00942:table or view does not existsql> select COUNT (*) from Kcbwds;sel ECT COUNT (*) from Kcbwds                     *error on line 1:ora-00942:table or view does not exist


--------------

2. Use the method of creating a view on the x$ base table to enable ordinary user access to x$:
Sql> show Useruser is ' SYS ' sql> select COUNT (*) from X$kcbwds; COUNT (*)----------8sql> CREATE View testa as select * from Sys.x$kcbwds; View created. Sql> Grant Select on Sys.testa to Bys; Grant succeeded.  Sql> Conn bys/bysconnected.sql> show Useruser is ' bys ' sql> select COUNT (*) from Sys.testa;    COUNT (*)----------8sql> desc sys.testa Name Null?                                               Type-----------------------------------------------------------------------------ADDR                                            RAW (4) INDX number inst_id                                            Number set_id number pool_id Number Dbwr_num number Blk_size NUMB Omit After er ...



3. More simple access can be achieved by adding synonyms to the view
sql> CREATE public synonym testb for sys.testa; Synonym created.  Sql> show Useruser is ' SYS ' sql> conn/as sysdbaconnected.sql> conn bys/bysconnected.sql> Select COUNT (*) from TESTB;  COUNT (*)----------         8


The method of realizing common user query x$ base table by creating view and synonym way

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.