这期内容为使用expdp/impdp进行迁移的一般步骤
分为如下五个部分:
SQL>select * from dba_users;
SQL>select * from dba_roles;
SQL>select * from dba_tablespaces;
SQL>select * from dba_mviews;
SQL>select * from dba_mview_logs;
SQL>select * from dba_jobs; SQL>select * from dba_scheduler_jobs;
SQL>select * from dba_db_links;
这里查看环境中其他数据库的dblink是否和该数据库有关联
SQL>CREATE SMALLFILE TABLESPACE "EMAPTBS" DATAFILE SIZE 25G LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; SQL>ALTER TABLESPACE "EMAPTBS" ADD DATAFILE SIZE 25G;
具体查看:
没有需要建立的角色
SQL>create user emap identified by emap default tablespace emaptbs ; SQL>create user emaptest identified by emaptest default tablespace emaptbs; SQL>grant connect,resource to emap; SQL>grant connect,resource to emaptest; SQL>grant select on v_$session to emap; SQL>grant select on v_$session to emaptest; SQL>grant unlimited tablespace to emap; SQL>grant unlimited tablespace to emaptest;
create public database link MESASSY connect to username IDENTIFIED BY password using '(description=(address=(protocol=TCP) (host=10.65.1.113)(port=1521))(connect_data=(SERVICE_NAME = MESASSY)))';
这里使用sys账号进行
SQL>select * from dba_directories;
SQL>CREATE OR REPLACE DIRECTORY dump_dir AS '/oradata/dump';
导出前锁定emap/emaptest账号
SQL>alter user emap acccount lock; SQL>alter user emaptest account lock;
注意oracle 11.2.0.1 之后空表如没有数据则会不导出
请事先找出这些表
新建parfile:expdp_emap.txt
userid='sys/ase_sys_1 as sysdba' job_name=job_emp_emptest_exp directory=dump_dir filesize=15G dumpfile=expdp_emap_%U.dmp logfile=emp_emptest_expdp.log schemas=emap,emaptest parallel=4 content=all
3.4 导出数据
expdp parfile=expdp_emap.txt
SQL>select * from dba_directories
SQL>CREATE OR REPLACE DIRECTORY dump_dir AS '/oradata/dump/';
scp expdp_emp_0* oracle@10.65.202.201:/oradata/dump/
新建parfile:impdp_emap.txt
userid='sys/ase_password as sysdba' job_name=job_emp_emptest_imp directory=dump_dir dumpfile=expdp_emap_%U.dmp logfile=emp_emptest_impdp.log schemas=emap,emaptest parallel=4 content=all
导入数据
impdp parfile=exp_emap.txt
参见Python脚本
检查如下对象是否失效
检查如下参数是否和源库一致或设置合理(不保证全面)