項目實施中oracle數(shù)據(jù)庫表空間問題
2023-04-12
問題描述:前一段時間,項目部署到客戶機房服務(wù)器上的時候,我們發(fā)現(xiàn)我們的測試數(shù)據(jù)庫的表都放在system或者users表空間下面。相應(yīng)的表并沒有放到對應(yīng)的表空間下,比如我創(chuàng)建一個cncb的表空間和數(shù)據(jù)庫用戶,當我們導(dǎo)入數(shù)據(jù)的時候數(shù)據(jù)并沒有導(dǎo)入到相應(yīng)的表空間下,如下圖所示:
為此在網(wǎng)上查了一些資料,進行了如下處理:
--首先需要備份一下數(shù)據(jù)庫
exp cncb/join@orcl file=f:\cncb20120331.dmp owner=(cncb)
revoke unlimited tablespace from cncb;
alter user cncb quota 0 on 表空間名;
--補充,凡是其他表空間中存在cncb的表的都執(zhí)行上邊語句,絕對保障其他表空間存儲cncb的空間額度設(shè)置為0
alter user cncb quota unlimited on cncb;
--執(zhí)行完之后,再倒入剛才備份的數(shù)據(jù)庫
刷新可以看到,如下圖所示:
順便總結(jié)一下:
Windows下創(chuàng)建表空間命令:(windows和Linux稍微不同)
首先以dba的角色登陸,或者使用sqlplus或者使用plsql
sqlplus /nolog
connect system/admin@ORCL as sysdba
drop tablespace test including contents;
create tablespace test datafile 'F:\oracle\product\10.2.0\oradata\ORCL\ test.ora' size 100m reuse
autoextend on maxsize unlimited
default storage(initial 320k
next 320k
minextents 1
maxextents unlimited
pctincrease 0);
--創(chuàng)建用戶
create user 數(shù)據(jù)庫用戶名 identified by 密碼 default tablespace 表空間名 temporary tablespace temp;
--授權(quán),一般為了方便,我們直接賦權(quán)dba
grant dba to 數(shù)據(jù)庫用戶;
Linux下創(chuàng)建表空間命令:
--創(chuàng)建臨時表空間
create temporary tablespace test_temp
tempfile '/opt/oracle/oradata/orcl /test_temp01.dbf'
size 64m
autoextend on
next 65m maxsize 2048m
extent management local;
--創(chuàng)建表空間
create tablespace test_data
logging
datafile '/opt/oracle/oradata/orcl/test_data01.dbf'
size 64m
autoextend on
next 65m maxsize 2048m
extent management local;
本文僅代表作者觀點,版權(quán)歸原創(chuàng)者所有,如需轉(zhuǎn)載請在文中注明來源及作者名字。
免責聲明:本文系轉(zhuǎn)載編輯文章,僅作分享之用。如分享內(nèi)容、圖片侵犯到您的版權(quán)或非授權(quán)發(fā)布,請及時與我們聯(lián)系進行審核處理或刪除,您可以發(fā)送材料至郵箱:service@tojoy.com





