天天看點

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)   -- ------------------------------------------

--

@chk_invalid.sql

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

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

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

select DIRECTORY_NAME,DIRECTORY_PATH from dba_directories;

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

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;

####設計思路

## expdp.sh輸入變量

使用者名: 密碼: 檔案名: 目錄名: schema名字

輸出變量 生成檔案:

## 思路如下: 1. 2.

## impdp.sh輸入變量

炊煙起了;夕陽下了;細雨來了

多調試,互動式程式設計體驗

記錄,獨立思考,對比

感謝轉載作者

修車

國産化

read and connect

匍匐前進,

講故事