Oracle creates tablespaces-users-roles-authorizations

Source: Internet
Author: User

1. Create a data table space:

SQL>Create  tablespace rusky_data  2  'D:\rusky\rusky_ DATA01,DBF'  size 10M  3on     4   Next  10M maxsize 1024m  5  extent management Local, table space created. 

EXTENT MANAGEMENT LOCAL: Storage area management method. Local administration: The disk is managed in a binary way, with high efficiency and maximum use of the disk. can also automatically track records near
Space, avoiding the merging of idle areas.
2. Create a temporary tablespace:

 sql>  create  temporary   tablespace rusky_tmp  2  tempfile  " d:\rusky\rusky_tmp.dbf   "  size 5m  4  autoextend  on  5  next   10m maxsize 100m; table space created. 

Temporary tablespace: Temporary tables can only be placed inside, temporary table space mainly put some temporary data, such as you query a complex SQL statement, the system will put the intermediate data in the temporary table space to be staged
The temporary table space is deleted by itself. When sorting, grouping, and indexing in an Oracle database, a lot of temporary data is generated, using temporary table spaces
To delete a table space:
DROP tablespace rusky_data including CONTENTS and datafiles;
3. Create user and specify table space

SQL>createuser by Rusky  2   default  Tablespace rusky_data  3  temporary  tablespace rusky_tmp; user created. 

Log in with SYS or system
There are two built-in users within Oracle: System and sys. Users can log on directly to the system user to create additional users because the system has permissions to create other users.
SYS: System administrator with the highest privileges
System: Local Administrator, sub-high privilege
Scott: Normal user, password default to Tiger, unlocked by default
User Change Password:
In addition to the alter USER command, users can also use the password command. If you use the password command, the new password entered by the user will not be displayed on the screen. A user with DBA authority can change the password of any other user through the password command, and the other user can only change their own password.
Alter user Rusky identified by Rusky2;
Log in as SYS or system, enter the command: Password Rusky, enter the original password and the new password.
Log in as Rusky, enter command: password

4. Authorization and revocation of authority
Grant CONNECT,RESOURCE,DBA to Rusky;
Connect role (Connect roles)
Temporary users, especially those who do not need to build a table, usually give them only connectrole. Connect is a simple permission to use Oracle that only has access to other users ' tables, including SELECT, INSERT,
Update and delete, and so on, will become meaningful. Users with Connect role also have the ability to create tables, views, sequences (sequence), clusters (cluster), synonyms (synonym), sessions (session), and link with other databases
Resource role (Resource roles)
More reliable and formal database users can grant resource role. Resource gives users additional permissions to create their own tables, sequences, procedures (procedure), triggers (trigger), indexes, and clusters
(cluster).
DBA Role (Database administrator roles)
DBA role has all of the system permissions----including unlimited space limits and the ability to grant various permissions to other users. System is owned by the DBA user.
In general, creating users will give Grant connect to username permissions, even grant Connect,resource to username;
However, connect includes the ALTER session permission, which is considered not to be very secure or can be modified in the following form.
Grant create session to user;
SELECT * from User_sys_privs; --------View permissions for the current user
Grant dba to User name;
Grant create session to Rusky; Create a session, that is, logon rights.
Unlimited session,create table, insert Table,update table
Grant all to public; Grant all permissions to all users.
Grant SELECT on Scott.emp to Rusky;
Grant drop on scott.emp to Rusky;
Grant insert on scott.emp to Rusky;
Grant update on scott.emp to Rusky;
Grant Update (ENAME) on scott.emp to Rusky;
5. Revoke Permissions
Revoke permissions: Revoke permissions from Rusky;
Revoke connect, resource from Rusky;
6. Role
A role is a collection of permissions that can be granted to a user. Three system roles: Connect, resource, and DBA. Users can also create their own roles. A user-created role can consist of a table or system permission or a combination of both
。 In order to create a role, the user must have the Create role system permission.
Create role myrole;//creating roles
Grant create session to myrole;//grants permission to create session Myrole
Grant Myrole to Rusky;
Drop role myrole; remove roles
However, some permissions are not granted to the role, such as the unlimited tablespace and the Any keyword

Oracle Create tablespace-user-role-authorization

Related Article

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.