expdp.sh and impdp.sh

 

 ####expdp.sh

 

###### ------------- --   UAT   -- -------------

@D:\dba\change\UAT\eais\env\env_eaisuat.sql

-------------- --   PROD   -- -------------- --

@D:\dba\change\PROD\eais\env\env_eaisprod.sql

 

conn &v_system_un/&v_system_pw@&V_CONN_STR;

col dt new_value dt noprint

select to_char(sysdate, 'YYYYMMDD_HH24MISS') dt from dual;

define v_log_file=.\log\01_rollout_&dt..log spool &v_log_file

set echo on feedback on verify on

 

------------------------------------------ --   1. Check Invalid Ojbect (before)   -- ------------------------------------------

--

conn &v_system_un/&v_system_pw@&V_CONN_STR;

@chk_invalid.sql

 

------------------------------------------ --   2. Check dba_direcotry (before)   -- ------------------------------------------

conn &v_system_un/&v_system_pw@&V_CONN_STR;

select DIRECTORY_NAME,DIRECTORY_PATH from dba_directories;  

 

------------------------------------------ --   3. spool exp scripts   -- ------------------------------------------

set feedback off

set pagesize 0

set heading off

set verify off

set linesize 200

set trimspool on

spool c:/数据库备份.bat;

select 'expdp &v_system_un/&v_system_pw@&V_CONN_STR file=&V_CONN_STR&dt..dmp directory=DATA_PUMP_DIR log=&V_CONN_STR&dt..log schemas=''&v_eaisdata_un'',''&v_eaisusr_un'',''&v_eaisquery_un'',''&v_eaispatch_un'' parallel=2' from dual;

 

spool off

set feedback on

set pagesize 9999

set heading on

set verify on exit

 

 ####impdp.sh

###### ------------- --   UAT   -- -------------

@D:\dba\change\UAT\eais\env\env_eaisuat.sql

-------------- --   PROD   -- -------------- --

@D:\dba\change\PROD\eais\env\env_eaisprod.sql

conn &v_system_un/&v_system_pw@&V_CONN_STR;

col dt new_value dt noprint

select to_char(sysdate, 'YYYYMMDD_HH24MISS') dt from dual;

define v_log_file=.\log\01_rollout_&dt..log spool &v_log_file

set echo on feedback on verify on

------------------------------------------ --   1. Check Invalid Ojbect (before)   -- ------------------------------------------

--conn &v_system_un/&v_system_pw@&V_CONN_STR;

@chk_invalid.sql

------------------------------------------ --   2. Check dba_direcotry (before)   -- ------------------------------------------

conn &v_system_un/&v_system_pw@&V_CONN_STR;

select DIRECTORY_NAME,DIRECTORY_PATH from dba_directories;

 

  ------------------------------------------ --   3. spool exp scripts   -- ------------------------------------------

set feedback off

set pagesize 0

set heading off

set verify off

set linesize 200

set trimspool on

spool c:/数据库恢复.bat;

select 'impdp &v_system_un/&v_system_pw@&V_CONN_STR file=&1.dmp directory=DATA_PUMP_DIR log=&V_CONN_STR&dt..log schemas=''&v_eaisdata_un'',''&v_eaisusr_un'',''&v_eaisquery_un'',''&v_eaispatch_un'' table_exists_action=replace  parallel=2' from dual;

spool off

set feedback on

set pagesize 9999

set heading on

set verify on exit

 

 

 

 

 

 

 

####设计思路

 

## expdp.sh输入变量

用户名: 密码: 文件名: 目录名: schema名字

 

输出变量 生成文件:

## 思路如下: 1. 2.

## impdp.sh输入变量

用户名: 密码: 文件名: 目录名: schema名字

 

输出变量 导入之前失效对象 生成文件:导出日志 导入之后失效对象

## 思路如下: 1. 2.

posted @ 2016-10-10 10:07  feiyun8616  阅读(389)  评论(0编辑  收藏  举报