1. 备份
create table [备份名] as select * from [表名];
2. 恢复
truncate table org_group;
insert into org_group select * from [备份名] ;
3. 说明
此种情况适用于,同一个数据库,需要备份某张表。
备份方案二:
1. 备份
oracle用户终端执行:
exp [用户名]/[密码] tables=[表一],[表二] file=/home/oracle/table.dmp
2. 恢复
oracle用户终端执行:
imp [用户名]/[密码] grants=y commit=y full=y ignore=y file=/home/oracle/table.dmp
备份方案三:
1. 备份
登录sqlplus:
sqlplus / as sysdba
创建directory:
create directory dpdata as '/home/oracle/';
目录创建以后,就可以把读写权限授予特定用户:
grant read, write on directory dpdata to [用户名];
oracle用户终端执行:
expdp [用户名]/[密码] tables=[表一],[表二] directory=dpdata dumpfile=table.dmp job_name=cases_export
2. 恢复
登录sqlplus :
sqlplus / as sysdba
创建directory:
create directory dpdata as '/home/oracle/';
目录创建以后,就可以把读写权限授予特定用户:
grant read, write on directory dpdata to [用户名];
oracle用户终端执行:
impdp [用户名]/[密码] directory=dpdata dumpfile=table.dmp job_name=cases_export
3. 说明
查询dba_directories查看所有directory:
select * from dba_directories;
删除directory:
drop directory dpdata;
也可参考: