您好,登錄后才能下訂單哦!
自己的oracle筆記,以后學(xué)到的新知識就在這個(gè)帖子跟新。
drop user ewedu cascade;--刪除和ewedu相關(guān)聯(lián)的所有數(shù)據(jù)
創(chuàng)建臨時(shí)表空間
CREATE TEMPORARY TABLESPACE EWEDU_TEMP
TEMPFILE
'E:\\bw\\EWEDU_TEMP.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE
2048M
EXTENT MANAGEMENT LOCAL; 創(chuàng)建用戶表空間
創(chuàng)建用戶表空間
CREATE TABLESPACE EWEDU_DATA
LOGGING
DATAFILE '
E:\\bw\\EWEDU_DATA.DBF '
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE
2048M
EXTENT MANAGEMENT LOCAL; 創(chuàng)建用戶并制定表空間
imp system/hack520 file=E:\\八維\\bawei.dmp fromuser=ewedu
touser=ewedu
先必須查詢表空間,數(shù)據(jù)庫所在表空間
select tablespace_name from
user_tablespaces;
知道表空間名,顯示該表空間包括的所有表。
select * from all_tables where
tablespace_name='表空間名'知道表名,
查看該表屬于那個(gè)表空間
select tablespace_name,table_name
from user_tables where table_name='emp'
select * from user_tables where table_name='BW_XY_CLASSCOMMITTEE'
-- 連接本地實(shí)例
--conn /@orcl as sysdba;
conn sys/hack520 as
sysdba;
-- 刪除用戶 "oauser"
drop user oauser cascade;
-- 刪除表空間 "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; 給用戶授予權(quán)限
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; 將role這個(gè)角色授與username,也就是說,使username這個(gè)用戶可以管理和使用
role所擁有的資源
grant dba to username;賦值所有權(quán)限給用戶username
GRANT role TO
username;
-----------------------------------------------
查看用戶權(quán)限
select * from
role_sys_privs where role='RESOURCE';
查看所有用戶
SELECT * FROM DBA_USERS;
SELECT * FROM ALL_USERS;
SELECT * FROM
USER_USERS; 查看用戶系統(tǒng)權(quán)限
SELECT * FROM DBA_SYS_PRIVS;
SELECT * FROM USER_SYS_PRIVS; 查看用戶對象或角色權(quán)限
SELECT * FROM DBA_TAB_PRIVS;
SELECT * FROM ALL_TAB_PRIVS;
SELECT * FROM
USER_TAB_PRIVS; 查看所有角色
SELECT * FROM DBA_ROLES; 查看用戶或角色所擁有的角色
SELECT * FROM DBA_ROLE_PRIVS;
SELECT * FROM USER_ROLE_PRIVS;
-- 連接本地實(shí)例
conn sys/hack520 as sysdba;
-- 創(chuàng)建表空間 “DATA”
CREATE TABLESPACE NEWER_DATA DATAFILE 'G:\\NEWER_DATA.DBF'
SIZE 100M reuse AUTOEXTEND ON
NEXT 5M MAXSIZE UNLIMITED;
-- 創(chuàng)建表空間
“TEMP”
CREATE TEMPORARY TABLESPACE NEWER_TEMP TEMPFILE 'G:\\NEWER_TEMP.DBF'
SIZE 100M reuse
AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;
-- 創(chuàng)建用戶
“TEMP"
CREATE USER NEWER PROFILE DEFAULT IDENTIFIED BY NEWER DEFAULT
TABLESPACE NEWER_DATA
TEMPORARY TABLESPACE NEWER_TEMP ACCOUNT UNLOCK;
-- 對用戶 "newer" 授權(quán)
GRANT DBA TO NEWER;
commit;
exit;
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。