標籤:
聲明:本文為博主在做項目中用到的一些常用命令,請勿轉載。
oracle常用命名總結
建立資料表空間:
--create tablespace vms
--datafile ‘e:\vms.dbf‘
--size 32000M
--extent management local uniform size 100M;
drop user c##vms;
create user c##vms identified by vms2014
default tablespace vms;
刪除資料表空間
DROP TABLESPACE tablespacename INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;
grant all privileges to c##vms;
授權
grant dba to c##vms;
alter user c##vms quota unlimited on vms;
匯入
imp c##vms/[email protected]/oracle file=E:\bkNew\daochu.dmp tables=S_COUNTRY grants=n fromuser=vms touser=c##vms buffer=100000000
imp MES/[email protected] file=E:\DB\oracle.dmp ignore=y tables=(ECUA2LFILEVER,ECUVERSION,ECUDCMFILE,ECUEWPFILE,ECUFILEINFO,ECUIMAGE,ECUMODELREFERENCE,ECUTESTREPORT) FULL=N
匯入的時候:
CONSTRAINTS=n不匯入約束
imp_tian.par
userid=system/password
file = exp_tian.dmp
fromuser=sasman
touser=oraver02
buffer=20000000
ignore=y
grants=n
CONSTRAINTS=n
rows=y
log=imp_tian.log
commit=y
nohup imp parfile=imp_tian.par 2>imp_tian.out 1>&2 &
很簡單,查 dba_tablespaces 資料字典:
select tablespace_name from dba_tablespaces;
··如果有服務沒啟動。
alter database datafile ‘file_name‘ offline drop
這個file_name你要改成你刪掉的那個檔案路徑加檔案名稱。
追問
執行成功了 還是見不來其他的資料表空間啊
回答
執行成功了 你要 把資料庫開啟啊;
alter database open;
EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
這樣使用者SONIC的表SONIC就被匯出
刪除有資料的資料表空間
alter tablespace vms offline
drop tablespace vms including contents;
設定自動成長的資料表空間
autoextend on next 1000M maxsize umlimited extent management local segment space management auto;
create tablespace "JYDB" logging datafile ‘d:\oracle\oradata\JYDB.dbf‘ size 5000M autoextend on next 1000M maxsize unlimited extent management local segment space management auto;
C:\Users\Administrator>imp ctbt/[email protected]/orcl file=E:\imp\daochu.dmp fromuser=vms touser=ctbt constraints=n ignore=y buffer=819200;
例如: IMP SCOTT/TIGER IGNORE=Y TABLES=(EMP,DEPT) FULL=N
oracle常用命名總結