快速导入数据
时间:2010-12-08 来源:oracle狂热分子
快速导入数据
在数据量很大的时候,会带来明显的时间减少.在导数据的时候,总感觉太慢了.
#!/bin/bash
IF [ $@ -gt 1 ] THEN
echo " Bad Usage"
exit
ENDIF IF [ $@ -eq 1 ] THEN
case $0 in
-v|-version|-ver)
echo "version 1.0"
;;
-h|-help|-?)
echo "execute scripts with no parameter"
;;
esac
exit
ENDIF
echo "Data DDL imp is runing........." $ORACLE_HOME/bin/imp frank/frank file=test.dmp rows=n >/dev.null echo "Data DDL imp has finished" $ORACLE_HOME/bin/sqlplus /nolog <<EOF >/dev/null
conn / as sysdba;
declare
tname1 varchar2(30);
c varchar2(500);
cursor tname
is
select table_name from dba_tables where owner='FRANK';
begin
open tname;
loop
fetch tname into tname1;
exit when tname%NOTFOUND;
c:='alter table FRANK.'||tname1||' nologging';
execute immediate c;
end loop;
close tname;
end;
/
EOF $ORACLE_HOME/bin/imp frank/frank file=test.dmp
$ORACLE_HOME/bin/sqlplus /nolog <<EOF >/dev/null
conn / as sysdba;
declare
tname1 varchar2(30);
c varchar2(500);
cursor tname
is
select table_name from dba_tables where owner='FRANK';
begin
open tname;
loop
fetch tname into tname1;
exit when tname%NOTFOUND;
c:='alter table FRANK.'||tname1||' logging';
execute immediate c;
end loop;
close tname;
end;
/
EOF
IF [ $@ -gt 1 ] THEN
echo " Bad Usage"
exit
ENDIF IF [ $@ -eq 1 ] THEN
case $0 in
-v|-version|-ver)
echo "version 1.0"
;;
-h|-help|-?)
echo "execute scripts with no parameter"
;;
esac
exit
ENDIF
echo "Data DDL imp is runing........." $ORACLE_HOME/bin/imp frank/frank file=test.dmp rows=n >/dev.null echo "Data DDL imp has finished" $ORACLE_HOME/bin/sqlplus /nolog <<EOF >/dev/null
conn / as sysdba;
declare
tname1 varchar2(30);
c varchar2(500);
cursor tname
is
select table_name from dba_tables where owner='FRANK';
begin
open tname;
loop
fetch tname into tname1;
exit when tname%NOTFOUND;
c:='alter table FRANK.'||tname1||' nologging';
execute immediate c;
end loop;
close tname;
end;
/
EOF $ORACLE_HOME/bin/imp frank/frank file=test.dmp
$ORACLE_HOME/bin/sqlplus /nolog <<EOF >/dev/null
conn / as sysdba;
declare
tname1 varchar2(30);
c varchar2(500);
cursor tname
is
select table_name from dba_tables where owner='FRANK';
begin
open tname;
loop
fetch tname into tname1;
exit when tname%NOTFOUND;
c:='alter table FRANK.'||tname1||' logging';
execute immediate c;
end loop;
close tname;
end;
/
EOF
相关阅读 更多 +