Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle creates tablespaces, creates users, and authorizes and views permissions

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

My oracle notes and the new knowledge I have learned in the future are new in this post.

Drop user ewedu cascade;-- deletes all data associated with ewedu

Create a temporary tablespace

CREATE TEMPORARY TABLESPACE EWEDU_TEMP

TEMPFILE'e:\\ bw\\ EWEDU_TEMP.dbf'

SIZE 32M

AUTOEXTEND ON

NEXT 32M MAXSIZE 2048M

EXTENT MANAGEMENT LOCAL; creates user tablespaces

Create user tablespace

CREATE TABLESPACE EWEDU_DATA

LOGGING

DATAFILE'E:\\ bw\\ EWEDU_DATA.DBF'

SIZE 32M

AUTOEXTEND ON

NEXT 32M MAXSIZE 2048M

EXTENT MANAGEMENT LOCAL; creates users and formulates tablespaces

Imp system/hack520 file=E:\\ Octave\\ bawei.dmp fromuser=ewedu touser=ewedu

You must first query the tablespace and the tablespace where the database is located.

Select tablespace_name from user_tablespaces

Know the name of the table space and display all tables included in the table space.

Select * from all_tables where tablespace_name=' table space name 'know the table name

Check which tablespace the table belongs to

Select tablespace_name,table_name from user_tables where table_name='emp'

Select * from user_tables where table_name='BW_XY_CLASSCOMMITTEE'

-- connect to the local instance

-- conn / @ orcl as sysdba

Conn sys/hack520 as sysdba

-- Delete user "oauser"

Drop user oauser cascade

-- delete tablespace "oauser"

Drop TEMPORARY TABLESPACE bwie_temp

Drop tablespace beie_TEMP

Commit

-- drop table SYS_CONDES

CREATE USER EWEDU IDENTIFIED BY EWEDU_DATA

DEFAULT TABLESPACE EWEDU_DATA

TEMPORARY TABLESPACE EWEDU_TEMP; grants permissions to users

GRANT

CREATE SESSION, CREATE ANY TABLE, CREATE ANY VIEW, CREATE ANY INDEX

, CREATE ANY PROCEDURE

ALTER ANY TABLE, ALTER ANY PROCEDURE

DROP ANY TABLE, DROP ANY VIEW, DROP ANY INDEX, DROP ANY

PROCEDURE

SELECT ANY TABLE, INSERT ANY TABLE, UPDATE ANY TABLE, DELETE ANY

TABLE

TO username; grants the role of role to username, that is, to enable the user username to manage and use

Resources owned by role

Grant dba to username; assigns all permissions to the user username

GRANT role TO username

View user permissions

Select * from role_sys_privs where role='RESOURCE'

View all users

SELECT * FROM DBA_USERS

SELECT * FROM ALL_USERS

SELECT * FROM USER_USERS; to view user's system permissions

SELECT * FROM DBA_SYS_PRIVS

SELECT * FROM USER_SYS_PRIVS; to view user object or role permissions

SELECT * FROM DBA_TAB_PRIVS

SELECT * FROM ALL_TAB_PRIVS

SELECT * FROM USER_TAB_PRIVS; view all roles

SELECT * FROM DBA_ROLES; to view roles owned by a user or role

SELECT * FROM DBA_ROLE_PRIVS

SELECT * FROM USER_ROLE_PRIVS

-- connect to the local instance

Conn sys/hack520 as sysdba

-- create tablespace "DATA"

CREATE TABLESPACE NEWER_DATA DATAFILE'G:\\ NEWER_DATA.DBF' SIZE 100m reuse AUTOEXTEND ON

NEXT 5M MAXSIZE UNLIMITED

-- create tablespace "TEMP"

CREATE TEMPORARY TABLESPACE NEWER_TEMP TEMPFILE'G:\\ NEWER_TEMP.DBF' SIZE 100m reuse

AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED

-- create user "TEMP"

CREATE USER NEWER PROFILE DEFAULT IDENTIFIED BY NEWER DEFAULT TABLESPACE NEWER_DATA

TEMPORARY TABLESPACE NEWER_TEMP ACCOUNT UNLOCK

-- authorize the user "newer"

GRANT DBA TO NEWER

Commit

Exit

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report