代码改变世界

Oracle数据库导入与导出

2020-08-11 11:23  gangzi4321  阅读(149)  评论(0编辑  收藏  举报

给空表配空间语句 

1. select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 or num_rows is null

数据库导出导入语句:  

1.导出 :exp 用户名/密码@远程库地址:端口/全局数据库 file=c:\xxx.dmp owner=用户名 log=c:\xxx.log(用于打印导出日志) tables=表名1,表名2,表名3(用于导出特定表)  

2.导入 :imp xxx_xx/xxxx@192.168.1.174:1521/orcl file=c:\database\xxxx_xx_0809.dmp full=y 

cmd脚本:

exp test_jf/gangzi@localhost:1521/orcl file=E:\temp\db_gz.dmp
pause

imp test_jf/gangzi@localhost:1521/orcl file=C:\Users\Administrator\Desktop\jf.dmp full=y log=C:\Users\Administrator\Desktop\jf.log
pause 

删除指定用户的所有表

 drop user gangzi_nx cascade;

 

imp bclrms_tn/xxx@127.0.0.1:1521/orcl file=D:\database_dmp\tn_bf20200811112325.dmp full=y