Oracle創(chuàng)建用戶表空間和導(dǎo)入導(dǎo)出數(shù)據(jù)舉例
//創(chuàng)建臨時(shí)表空間
- create temporary tablespace test_temp
- tempfile 'E:\oracle\product\10.2.0\oradata\testserver\test_temp01.dbf'
- size 32m
- autoextend on
- next 32m maxsize 2048m
- extent management local;
//創(chuàng)建數(shù)據(jù)表空間
- create tablespace test_data
- logging
- datafile 'E:\oracle\product\10.2.0\oradata\testserver\test_data01.dbf'
- size 32m
- autoextend on
- next 32m maxsize 2048m
- extent management local;
//創(chuàng)建用戶并指定表空間
- create user testserver_user identified by testserver_user
- default tablespace test_data
- temporary tablespace test_temp;
//給用戶授予權(quán)限
- grant connect,resource to testserver_user;
//數(shù)據(jù)導(dǎo)出:
- //1 將數(shù)據(jù)庫(kù)TEST完全導(dǎo)出,用戶名system 密碼manager 導(dǎo)出到D:daochu.dmp中
- exp system/manager@TEST
- file=d:/daochu.dmp full=y
- //2 將數(shù)據(jù)庫(kù)中system用戶與sys用戶的表導(dǎo)出
- exp system/manager@TEST file=d:daochu.dmp owner=(system,sys)
- //3 將數(shù)據(jù)庫(kù)中的表inner_notify、notify_staff_relat導(dǎo)出
- exp aichannel/aichannel@TESTDB2 file= d:datanewsmgnt.dmp tables=(inner_notify,notify_staff_relat)
- //4 將數(shù)據(jù)庫(kù)中的表table1中的字段filed1以"00"打頭的數(shù)據(jù)導(dǎo)出
- exp system/manager@TEST file=d:daochu.dmp tables=(table1) query=" where filed1 like '00%'"
//上面是常用的導(dǎo)出,對(duì)于壓縮,既用winzip把dmp文件可以很好的壓縮。
//也可以在上面命令后面 加上 compress=y 來實(shí)現(xiàn)。
//數(shù)據(jù)的導(dǎo)入
//1 將D:daochu.dmp 中的數(shù)據(jù)導(dǎo)入 TEST數(shù)據(jù)庫(kù)中。
imp system/manager@TEST full=y file=d:daochu.dmp
imp aichannel/aichannel@HUST full=y file=d:datanewsmgnt.dmp ignore=y
//上面可能有點(diǎn)問題,因?yàn)橛械谋硪呀?jīng)存在,然后它就報(bào)錯(cuò),對(duì)該表就不進(jìn)行導(dǎo)入。
//在后面加上 ignore=y 就可以了。
2 將d:daochu.dmp中的表table1 導(dǎo)入
//imp system/manager@TEST file=d:daochu.dmp tables=(table1)
本文來自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/lstrue/archive/2009/02/04/3862378.aspx