34 lines
1.0 KiB
Bash
34 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
home="/home/simon"
|
|
project="goprojects"
|
|
user="root"
|
|
password="1000omc@kp!"
|
|
host="192.168.2.119"
|
|
port="33066"
|
|
dbname="omc_db"
|
|
dumpdbdir=${home}/${project}/ems.agt/tools/misc
|
|
insdir=${home}/${project}/ems.agt/database/install
|
|
upgdir=${home}/${project}/ems.agt/database/upgrade
|
|
tables_c=tables_c.lst
|
|
tables_s=tables_s.lst
|
|
|
|
#mysql -u ${user} -p${password} -D ${dbname} -e "show tables ; " > tables.lst
|
|
|
|
# dump table struct and data
|
|
while read line
|
|
do
|
|
table=`echo $line | cut -d " " -f 1`
|
|
echo "dump ${table} to install & upgrade 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
|
|
done < ${dumpdbdir}/${tables_c}
|
|
|
|
# dump table struct
|
|
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}
|