add: new dump db sql script
This commit is contained in:
51
tools/misc/dumpsql.sh
Normal file
51
tools/misc/dumpsql.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
Home=/home/simon
|
||||
GitLocalRoot=${Home}/local.git
|
||||
EmsBEDir=${GitLocalRoot}/be.ems
|
||||
EMSBuildDir=${GitLocalRoot}/build.ems
|
||||
user="root"
|
||||
password="1000omc@kp!"
|
||||
host="192.168.2.219"
|
||||
port="33066"
|
||||
dbname="omc_db"
|
||||
dumpdbdir=${EmsBEDir}/tools/misc
|
||||
insdir=${EMSBuildDir}/build/usr/local/omc/etc/db/install
|
||||
upgdir=${EMSBuildDir}/build/usr/local/omc/etc/db/upgrade
|
||||
upgvue3dir=${EMSBuildDir}/build/usr/local/omc/etc/db/upgvue3
|
||||
tables_s=tables_s.lst
|
||||
tables_c=tables_c.lst
|
||||
tables_ic=tables_ic.lst
|
||||
|
||||
mysql -h ${host} -P ${port} -u ${user} -p${password} -D ${dbname} -e "show tables ; " > tables.lst
|
||||
|
||||
# dump table struct to install dir
|
||||
while read line
|
||||
do
|
||||
table=`echo $line | cut -d " " -f 1`
|
||||
echo "dump ${table} to install directory"
|
||||
mysqldump -h ${host} -P ${port} -u ${user} -p${password} -d ${dbname} ${table} > ${insdir}/${table}.sql
|
||||
done < ${dumpdbdir}/${tables_s}
|
||||
|
||||
# dump table struct and data to install dir
|
||||
while read line
|
||||
do
|
||||
table=`echo $line | cut -d " " -f 1`
|
||||
echo "dump ${table} to install directory"
|
||||
mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${insdir}/${table}.sql
|
||||
done < ${dumpdbdir}/${tables_ic}
|
||||
|
||||
|
||||
# dump table struct and data to upgrade, upgvue3 and install dir
|
||||
while read line
|
||||
do
|
||||
table=`echo $line | cut -d " " -f 1`
|
||||
echo "dump ${table} to install & upgrade & upgvue3 directory"
|
||||
mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${insdir}/${table}.sql
|
||||
mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${upgdir}/${table}.sql
|
||||
mysqldump -h ${host} -P ${port} -u ${user} -p${password} ${dbname} ${table} > ${upgvue3dir}/${table}.sql
|
||||
done < ${dumpdbdir}/${tables_c}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user