一、表數據備份與還原
creat table 備份表 select * from 原表 where
insert into 原表 select * from 備份表
二、利用備份表還原原表部分字段數據
update 原表 t
set (age, idnumber) =
(select age, idnumber from 備份表 b where b.stuid = t.stuid)
where exists
(select 1 from 備份表 b
where b.stuid = t.stuid
and b.stuname = '張三');
三、,exp導出命令(cmd下運行)
1、導出數據庫
exp 用戶名/密碼@orcl file=d:\daochu.dmp full=y
2、 導出表空間
exp 用戶名/密碼@orcl file=d:\daochu.dmp tablespaces=(testspace)
3、導出用戶
exp 用戶名/密碼@orcl file=d:\daochu.dmp owner=(system,sys)
4、導出表
exp 用戶名/密碼@orcl file=d:\daochu.dmp tables=table1,table2
備注:buffer=4096(指定數據緩存區的大小) log=d:\student.log(指定日志保存路徑),例如:
四、imp導入命令(cmd下運行)
imp 用戶名/密碼@orcl file=d:/daochu.dmp full=y ignore=y
備注:導入數據前需用sys用戶創建普通用戶,並新建表空間、賦權。