快速导入数据
在数据量很大的时候,会带来明显的时间减少.在导数据的时候,总感觉太慢了.
#!/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 </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 </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
阅读(1650) | 评论(1) | 转发(0) |