oracle导出所有表的表结构命令 oracle导出表数据语句( 二 )

2.部分用户表table导入导出:exp(imp)username/password@SERVICENAME:1521 file="e:\temp.dmp" tabels= (table1,table2,table3,...);3.表空间tablespaces导入导出://一个数据库实例可以有N个表空间(tablespace),一个表空间下可以有N张表(table) 。exp(imp)username/password@SERVICENAME:1521 file="e:\temp.dmp" tablespaces=(tablespace1,tablespace2,tablespace3,...);4.用户名username对象导入导出:exp(imp)username/password@SERVICENAME:1521 file="e:\temp.dmp"owner(username1,username2,username3);2、数据泵方法:创建directory:expdp(impdp) username/password@SERVICENAME:1521 schemas=usernamedumpfile=file1.dmp logfile=file1.log directory=testdata1 remap_schema=test:test;数据库导出举例:expdp xinxiaoyong/123456@127.0.0.1:1521 schemas=xinxiaoyong dumpfile=test.dmp logfile=test.log directory=testdata1;exp:导出命令,导出时必写 。imp:导入命令,导入时必写,每次操作,二者只能选择一个执行 。username:导出数据的用户名,必写;password:导出数据的密码 , 必写;@:地址符号,必写;SERVICENAME:Oracle的服务名,必写;1521:端口号,1521是默认的可以不写,非默认要写;schemas:导出操作的用户名;dumpfile:导出的文件;logfile:导出的日志文件,可以不写;directory:创建的文件夹名称;remap_schema=源数据库用户名:目标数据库用户名,二者不同时必写 , 相同可以省略;1.查看表空间:select * from dba_tablespaces;2.查看管理理员目录(同时查看操作系统是否存在,因为Oracle并不关心该目录是否存在,如果不存在,则出错) 。select * from dba_directories;3.创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建 。create directory testdata1 as 'd:\test\dump';4.给xinxiaoyong用户赋予在指定目录的操作权限,最好以system等管理员赋予 。//xinxiaoyong 是用户名(123456是用户密码)grant read,write on directory testdata1 to xinxiaoyong;5.导出数据1)按用户导 expdp xinxiaoyong/123456@orcl schemas=xinxiaoyongdumpfile=expdp.dmp directory=testdata1;2)并行进程parallel expdp xinxiaoyong/123456@orcl directory=testdata1dumpfile=xinxiaoyong3.dmp parallel=40 job_name=xinxiaoyong33)按表名导 expdp xinxiaoyong/123456@orcl tables=emp,dept dumpfile=expdp.dmpdirectory=testdata1;4)按查询条件导 expdp xinxiaoyong/123456@orcl directory=testdata1dumpfile=expdp.dmp tables=emp query='WHERE deptno=20';5)按表空间导 expdp system/manager directory=testdata1 dumpfile=tablespace.dmptablespaces=temp,example;6)导整个数据库 expdp system/manager directory=testdata1 dumpfile=full.dmp FULL=y;6.还原数据1)导到指定用户下 impdp xinxiaoyong/123456 directory=testdata1 dumpfile=expdp.dmpschemas=xinxiaoyong;2)改变表的owner impdp system/manager directory=testdata1 dumpfile=expdp.dmptables=xinxiaoyong.dept remap_schema =xinxiaoyong:system;3)导入表空间 impdp system/manager directory=testdata1 dumpfile=tablespace.dmptablespaces=example;4)导入数据库 impdb system/manager directory=dump_dir dumpfile=full.dmp FULL=y;5)追加数据 impdp system/manager directory=testdata1 dumpfile=expdp.dmpschemas=systemtable_exists_action;3、PLSQL方法:登录plsql工具,所使用用户为源数据库有导出权限(exp_full_database,dba等)的用户 。? 1.导出建表语句(包括存储结构) 导出步骤tools ->export user object,选择要导出的对象,导出.sql格式文件并等待导出完成 , 如 下图:

oracle导出所有表的表结构命令 oracle导出表数据语句

文章插图
导出数据文件 ;
2.导出步骤tools ->export tables,选择要导出的表及导出的格式进行导出 。
导出为dmp格式 , 如下图:


以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!

「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助: