oracle 表空間 資料庫使用者管理

2021-09-12 04:36:00 字數 2312 閱讀 1064

----------------建立臨時表空間

create temporary tablespace sms_temp

tempfile 'e:\sms_direct_data\sms_direct_temp.dbf'

size 32m

autoextend on

next 32m maxsize 2048m

extent management local;

-----建立表空間

create tablespace sms_data

logging

datafile 'e:\sms_direct_data\sms_direct_data.dbf'

size 32m

autoextend on

next 32m maxsize 10000m

extent management local;

-----建立使用者sms

create user sms identified by 123456

default tablespace sms_data

temporary tablespace sms_temp;

-----使用者授權

grant connect ,resource,dba to sms ;

grant create any table,create any procedure to sms;

---匯出資料

exp sms/123456@orcl file=d:\sms.dmp owner=(sms);

----匯入資料

imp sms/123456@orcl file=d:\sms.dmp full=y ignore=y;

-----匯入資料到不同使用者

imp sms/[email protected]:1521/orcl file=d:\sms.dmp fromuser="sms" touser="crm";

----賦予表許可權

grant select, insert, update, delete, references, alter, index on sys_user_table to public;

----查詢表空間 大小

select

b.file_name 物理檔名,

b.tablespace_name 表空間,

b.bytes/1024/1024 大小m,

(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 已使用m,

substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) 利用率

from dba_free_space a,dba_data_files b

where a.file_id=b.file_id

group by b.tablespace_name,b.file_name,b.bytes

order by b.tablespace_name ;

-----查詢物理塊大小

select dbf.tablespace_name,

dbf.totalspace "總量(m)",

dbf.totalblocks as 總塊數,

dfs.freespace "剩餘總量(m)",

dfs.freeblocks "剩餘塊數",

(dfs.freespace / dbf.totalspace) * 100 "空閒比例"

from (select t.tablespace_name,

sum(t.bytes) / 1024 / 1024 totalspace,

sum(t.blocks) totalblocks

from dba_data_files t

group by t.tablespace_name) dbf,

(select tt.tablespace_name,

sum(tt.bytes) / 1024 / 1024 freespace,

sum(tt.blocks) freeblocks

from dba_free_space tt

group by tt.tablespace_name) dfs

where trim(dbf.tablespace_name) = trim(dfs.tablespace_name);

--刪除使用者,會刪除此使用者名稱下的所有表和檢視

drop user sms cascade

--刪除表空間 包括裡面的物理內容

drop tablespace sms_data including contents and datafiles

空間資料庫

引用 空間資料庫指的是地理資訊系統在計算機物理儲存介質上儲存的與應用相關的地理空間資料的總和,一般是以一系列特定結構的檔案的形式組織在儲存介質之上的。空間資料庫的研究始於20 世紀 70年代的地圖製圖與遙感影象處理領域,其目的是為了有效地利用衛星遙感資源迅速繪製出各種經濟專題地圖。由於傳統的關聯式資...

地理空間資料庫

地理空間資料庫 課程介紹地理空間資料庫的空間資料型別 空間分析操作和空間索引,幫助學生理解ogc的簡單要素訪問規範 空間資料庫的基本概念和基本設計方法,通過幾何物件模型和空間網路模型在postgresql postgis pgrouting上的應用實踐,掌握地理資訊資料建庫 空間關聯分析 最短路徑查...

SDE直連Oracle空間資料庫

2.直連oracle空間資料庫 以下內容將介紹三種直連到oracle空間資料庫的方式 第一,使用資料庫認證直連到oracle空間資料庫 第二,使用作業系統認證直連到oracle空間資料庫 第三,如何連線到某使用者方案的空間資料庫。使用資料庫認證直連到oracle空間資料庫 1 在arccatalog...