oracle create user, tablespace, authorization

--Table space 
Create a table space (generally build N table spaces for storing data and an index space): 
create tablespace table space name 
datafile ' path (the path must be built first)\***.dbf ' size *M 
tempfile ' Path\***.dbf ' size *M 
autoextend on -- automatic growth 
-- there are also some commands to define the size, see 
default storage( 
initial 100K, 
next 100k, 
); 
CREATE TABLESPACE sdt 
DATAFILE 'F:\tablespace\ demo' size 800M 
         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;   --index
tablespace 
CREATE TABLESPACE sdt_Index 
DATAFILE 'F:\tablespace\demo' size 512M          
         EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;      
 
--2. Create user 
: create user user nameidentified by "password"; 
create user demo identified by demo  
default tablespace std; 
  
--3. Authorization
1. The default ordinary user sun is not unlocked by default and cannot be used for that purpose. The newly created user does not have any permissions, and the permission must be granted

grant create session to sun; / /Grant the sun user the permission to create a session, that is, the login permission
grant unlimited tablespace to sun; //Grant the sun user the permission to use the tablespace
grant create table to sun; //Grant the permission to create a table
grant drop any table to sun; // Grant the permission to delete the table
grant insert any table to sun; //The permission to insert the table
grant update any table to sun; //The permission to modify the table

grant all to public; //This is more important, grant all permissions (all) to All users (public)

2. Oralce manages permissions strictly, and ordinary users cannot access each other by default. They need to authorize each other

  

  grant select on tablename to sun;//Grant sun user permission to view the specified table

  grant drop on tablename to sun;//Grant the permission to delete the table

  grant insert on tablename to sun;//Grant the permission to insert

  grant update on tablename to sun;//Grant the permission to modify the table

  grant insert(id) on tablename to sun ;

  grant update(id) on tablename to sun;//Grant insert and modify permissions on specific fields of the specified table, note that only insert and update

  grant alert all table to sun;//Grant sun user the permission to alert any table

Revoke permissions The

  basic syntax is the same as grant, the keyword is revoke to

view permissions

  select * from user_sys_privs;//View all permissions of the current user

  select * from user_tab_privs;//View the permissions of the user used on the table

Permission transfer

  means that user A grants permissions to B, B The operation authority can be granted to C again, and the command is as follows:

  grant alert table on tablename to sun with admin option;//keyword with admin option

  grant alert table on tablename to sun with grant option;//keyword with grant option effect and admin like

Role A

  role is a collection of permissions, you can grant a role to a user

  create role myrole;//Create a role

  grant create session to myrole;//Grant the permission to create a session to myrole

  grant myrole to sun;//Grant the role of sun user myrole

  drop role myrole; delete role

  

--import and export command    
ip export method: exp demo/[email protected]:1521/orcl file=f:/f.dmp full=y 
exp demo/demo@orcl file=f:/f .dmp full=y 
imp demo/demo@orcl file=f:/f.dmp full=y ignore=y 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326267317&siteId=291194637