--expdp导出:
1.创建数据泵路径:
SQL> create or replace directory imostdb as '/opt/oracle/imost';
---Directory created. //需确保/home/目录空间足够大(提前进行备份验证)
2.赋予导出用户“导入导出”的权限
grant connect to imostdb_cs;
grant dba to imostdb_cs;
grant exp_full_database to imostdb_cs;
grant imp_full_database to imostdb_cs;
grant resource to imostdb_cs;
3.导出数据:(dmp文件在数据泵路径下)
expdp userid=imostdb_cs/'%TGB6yhn' directory=imostdb dumpfile=Expdp_imost_20150318.dmp LOGFILE=Expdp_imost_20150318.log SCHEMAS=PROMOTION CONTENT=METADATA_ONLY;
--需要注意的地方有:
1.userid用到的用户和密码是否正确并具有导出导入权限
2.directory用到的路径是否存在并保证空间充裕且userid用到的用户对该路径拥有读写权限
3.用户模式导出使用SCHEMAS,除此之外还有表模式,表空间模式,全库模式等(网上可以找到很多模板的)
4.CONTENT参数值,因为本次仅导出数据结构所以我们使用的是METADATA_ONLY,该参数的默认值就是ALL
--impdp导入
第一步到第三步请使用具有dba权限的用户执行
第一步:创建用户所在的profile
-- Create profile
create profile SDPUSER limit
sessions_per_user unlimited
cpu_per_session unlimited
cpu_per_call unlimited
connect_time unlimited
idle_time unlimited
logical_reads_per_session unlimited
logical_reads_per_call unlimited
composite_limit unlimited
private_sga unlimited
failed_login_attempts unlimited
password_life_time unlimited
password_reuse_time unlimited
password_reuse_max unlimited
password_lock_time unlimited
password_grace_time unlimited
password_verify_function Null;