# mysqldump脚本

```bash
#!/bin/bash
#set -x

oldifs=$IFS
dump(){
mysqldump -h10.0.0.0 -uadmin -P9800 -p123456 --opt --single-transaction boss $1 | mysql  -uroot -P8306 -p123456 -C boss
}
dtd(){
        IFS=$oldifs
        arr=($1)
        for table in ${arr[@]}
        do
            echo start dump $table
            dump $table
        done
        IFS=$'\n'
}

IFS=$'\n'

#crm_measurement_units  crm_department crm_role_extend crm_price_item_ref_measure_time crm_time_units
#crm_special_rules_item crm_special_rules_product_item_rel crm_special_rules_product_type_rel
#dw_manual_rule dw_slice_rule
#crm_account_director crm_employee crm_region_base

tables="
crm_product_type crm_account crm_contract contract_account_release contract_product_price
crm_price_definition crm_price_detail
crm_special_rules_discount crm_contract_sprules crm_contract_sprules_regions
crm_rule_use_log crm_rule_use_lock crm_manual_rule crm_manual_rule_lock
month_bill_locked month_bill_summary_new
"

for table in ${tables[@]}
do
        read -r -p $table" ? [Y/n] " input
        case $input in
                [yY][eE][sS]|[yY]) dtd "${table}" ;;
                *) echo "No";;
        esac
done
```

`--opt`参数后面跟着的`--single-transaction`可以实现不锁住dump数据的表

## 导入

mysql -hlocahost -P3310 -uroot -p1234 activiti < ./activiti.sql


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.rizon.top/linux/mysqldump-jiao-ben.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
