1.oracle导出表结构到sql文件
需要登陆oralce用户: sqlplus 用户名/密码@实例名
SQL> set serveroutput on
SQL> set long 999999
SQL> set feedback off
SQL> spool temp.sql
SQL> SELECT DBMS_METADATA.GET_DDL('TABLE',table_name) FROM USER_TABLES;
SQL> spool off
1.数据库导出功能:
1).将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
exp system/manager@TEST file=d:\daochu.dmp full=y
2).将数据库中system用户与sys用户的表导出
exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
3).将数据库中的表table1 、table2导出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
4).将数据库中的表table1中的字段filed1以"00"打头的数据导出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=" where filed1 like '00%'"
如果是导出远程数据库,需要在Test前加上ip,如system/manager@192.168.1.123/test
2.数据的导入
1).将D:\daochu.dmp 中的数据导入 orcl数据库中。
imp system/manager@127.0.0.1:1521/orcl file=d:\daochu.dmp full=y ignore=y
2).将d:\daochu.dmp中的表table1 导入
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)