#导出oracle数据库
#!/usr/bin/perl -w
`set NLS_LANG=AMERICAN_AMERICA.AL32UTF8`;
my @aa=`exp system/******/@dbname file=d:/daochu.dmp owner=(cm)`;
foreach(@aa){
print $_;
}
print "==============oracle data exp end=====================";
###########################################################
#导入oracle数据库
#!/usr/bin/perl -w
use DBI;
$dbname="YUYU";
$user="username";
$passwd="passwd";
$dbh="";
print "start...... /n";
$dbh = DBI->connect("DBI:Oracle:$dbname",$user,$passwd) or die "can't connect to database ". DBI-errstr;
##delete user
$sth=$dbh->prepare("drop user username cascade");
$sth->execute;
print "drop user cm /n";
##create user
$sth=$dbh->prepare("create user username IDENTIFIED BY passwd");
$sth->execute;
print "create user username/n";
##grant role
$sth=$dbh->prepare("grant dba to username");
$sth->execute;
print "grant dba to username/n";
##close dbbase;
$dbh->disconnect;
print "==============oracle data imp start=====================";
##imp oracle date##
my @aa=`imp username/passwd/@YUYU file=e:/daochu.dmp fromuser=username`;
foreach(@aa){
print $_;
}
print "==============oracle data imp end=====================";