expdp批量导入数据脚本

expdp批量导入数据脚本

𝓓𝓸𝓷 Lv6

Oracle批量导入数据,批量创建数据文件脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash




datetime=$(date +%Y-%m-%d_%H%M)

export ORACLE_SID=aidb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:$PATH



export schema=zj
export source_schema=hie
export directory=expdir
export directory_path=/data/jw/${schema}
#export directory_path=/data/jw/${schema}/pt
export data_path=/data/oracle/aidb
export dumpfile=${schema}_hie_2025-02-14_%U.dmp
export logfile=imp_${schema}_${source_schema}_$datetime.log
export parallel=8
export dbfile_num=25
export tablespace=${schema}_hie_data
export temp_tablespace=${schema}_hie_data_temp


sqlplus / as sysdba <<EOF


drop directory $directory;

create directory $directory as '$directory_path';


create tablespace $tablespace datafile '$data_path/${tablespace}01.dbf' size 10g autoextend on next 100M;
create temporary tablespace $temp_tablespace tempfile '$data_path/${temp_tablespace}01.dbf' size 10g autoextend on next 100M;

set serveroutput on
declare
num_str varchar(1000);
begin
for i in 2 .. $dbfile_num loop
num_str := CASE WHEN i < 10 THEN '0' || TO_CHAR(i) ELSE TO_CHAR(i) END;
DBMS_OUTPUT.PUT_LINE(num_str);
execute immediate 'alter tablespace $tablespace add datafile ''$data_path/${tablespace}'||num_str||'.dbf'' size 10g autoextend on next 100M';
end loop;
end;
/

exit;
EOF



impdp \"sys/!aA239131 AS SYSDBA \" directory=$directory schemas=$source_schema remap_schema=$source_schema:${schema}_hie \
remap_tablespace=TBS_HIE_DATA:${schema}_HIE_DATA,EIF_TBS:${schema}_HIE_DATA,HIE_TBS:${schema}_HIE_DATA,RP_TBS:${schema}_HIE_DATA,TBS_HIE_DATA_TEMP:${schema}_HIE_DATA_TEMP \
parallel=$parallel dumpfile=$dumpfile logfile=$logfile
  • Title: expdp批量导入数据脚本
  • Author: 𝓓𝓸𝓷
  • Created at : 2025-03-27 17:08:20
  • Updated at : 2025-03-27 17:13:26
  • Link: https://www.zhangdong.me/oracle-batch-impdp.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论