oracle数据库导出导入--perl脚本实现
2009-07-08 15:13
417 查看
#导出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=====================";
相关文章推荐
- Perl 脚本实现MySQL 异机导入导出
- 对oracle数据库使用sql脚本进行导入导出
- 利用windows脚本实现Oracle数据库定时导出文件
- 用Oracle导入导出工具实现Oracle数据库移植
- Oracle数据库数据导入导出基本方法及unix定时备份脚本
- 使用DBI(perl)实现文本文件的导入导出mysql
- 利用windows脚本实现Oracle数据库定时导出文件
- 利用SHELL脚本实现将Oracle数据库的每日EXPDP导出文件复制到远程服务器
- 用Oracle导入导出工具实现Oracle数据库移植
- 使用DBI(perl) 实现文本文件导入导出mysql
- SQL Server 数据导入Oracle数据库(脚本实现)
- 利用windows脚本实现Oracle数据库定时导出文件
- 利用windows脚本实现Oracle数据库定时导出文件
- oracle数据库导入导出的实现
- 怎样实现oracle数据库某个用户名下的所有表的导入导出
- 用Oracle导入导出工具实现Oracle数据库移植
- 对oracle数据库使用sql脚本进行导入导出
- 对oracle数据库使用sql脚本进行导入导出
- 对oracle数据库使用sql脚本进行导入导出
- 使用perl 实现 oracle数据库用户自动备份脚本