First, the demand
Database has a table car, need to create a view for this table View_car, and create a new user User01, give the query this view permissions
Ii. Steps of implementation
1, the Administrator CLGL login database, the new view View_car:
Create or Replace view View_car as SELECT * from car;
2. New User User01
Create User User01
Identified by "123456";
3, grant the user User01 permission
Grant SELECT on View_car_runtime_b to User01; //Query View permissions
Grant connect to User01; //Connect database permissions
Grant create synonym to User01; //new synonym permission
4, the user User01 login database, can access to the view view_car information
SELECT * from Clgl.view_car; //Query view view_car information, because each time need to add user prefix clgl., very inconvenient, so set a synonym for easy query
5. Create a new alias for the View Clgl.view_car car
Create synonym car for clgl.view_car; //Set Clgl.view_car alias to car
SELECT * from Car; //user can enter car to query data directly
6, to CLGL login database, set the number of user User01 allowed access session
Alter system set Resource_limit=true scope=both sid= ' * '; //Use Resource_limit and profile to restrict user connections
Create profile User01_profile limit Sessions_per_user 1 failed_login_attempts unlimited; //Create a new user Profile:user01_profile
Alter user User01 profile User01_profile; //change user User01 profile to User01_profile
Alter profile user01_profile limit Sessions_per_user 2; //Limit user User01 number of connections to 2
When User01 has more than three access connections, an error is indicated:ora-02391:exceeded simultaneous sessions_per_user limit
Oracle builds views, creates users, and grants query permissions