dbcoy
来源:互联网 发布:grub安装ubuntu 编辑:程序博客网 时间:2024/06/05 22:49
#!/bin/bash
if [ 4 -ne $# ];
then
echo "arg error!"
echo "example(databaseIp userName userPasswd)"
fi
databaseIp=$1
userName=$2
userPasswd=$3
newDatabase=$4
#echo ${databaseIp} ${userName} ${userPasswd}
#arg(oldDbName newDbName tableName tableSubCount)
function copyTable()
{
oldDbName=$1
oldTableName=$3
tableSubCount=$4
newDbName=$2
newTableName=$3
for((i = 0; ${tableSubCount} > i; ++i));
do
sql="CREATE TABLE ${newDbName}.${newTableName}${i} LIKE ${oldDbName}.${oldTableName}${i}"
mysql -h${databaseIp} -u${userName} -p${userPasswd} -e"${sql}"
sql="INSERT INTO ${newDbName}.${newTableName}${i} select * from ${oldDbName}.${oldTableName}${i}"
mysql -h${databaseIp} -u${userName} -p${userPasswd} -e"${sql}"
done
}
copyTable nfyg ${newDatabase} table_ 2
if [ 4 -ne $# ];
then
echo "arg error!"
echo "example(databaseIp userName userPasswd)"
fi
databaseIp=$1
userName=$2
userPasswd=$3
newDatabase=$4
#echo ${databaseIp} ${userName} ${userPasswd}
#arg(oldDbName newDbName tableName tableSubCount)
function copyTable()
{
oldDbName=$1
oldTableName=$3
tableSubCount=$4
newDbName=$2
newTableName=$3
for((i = 0; ${tableSubCount} > i; ++i));
do
sql="CREATE TABLE ${newDbName}.${newTableName}${i} LIKE ${oldDbName}.${oldTableName}${i}"
mysql -h${databaseIp} -u${userName} -p${userPasswd} -e"${sql}"
sql="INSERT INTO ${newDbName}.${newTableName}${i} select * from ${oldDbName}.${oldTableName}${i}"
mysql -h${databaseIp} -u${userName} -p${userPasswd} -e"${sql}"
done
}
copyTable nfyg ${newDatabase} table_ 2
0 0
- dbcoy
- OGC
- [BZOJ 3680]吊打XXX(广义费马点、模拟退火搜索)
- 内核编译选项20要20不要
- Your content must have a ListView whose id attribute is 'android.R.id.list'
- LeetCode(1) Two Sum实现
- dbcoy
- Leetcode_62_Unique Paths
- ios用企业证书发布app的心得之三web安装
- node.js mongodb数据库驱动性能测试
- Decode Ways
- tomcat 开启ssl
- Subsets II
- Codeforces Round #289 (Div. 2, ACM ICPC Rules)(A,B)
- Reverse Linked List II