1、新建data文件夹,用于存放备份数据
2、新建db文件夹,用于存放初建数据库为脚本
3、首次使用双击export.bat进行备份数据库;
4、以后每次使用双击setup.bat进行还原数据库;
备注:如果数据库内容有变,需要重新执行export.bat进行备份数据库。
export.bat如下:
@shift @echo off title 联影医疗移动护理信息系统安装中... mode con cols lines color 3f cls set sname_sql=localhost :connsql echo. echo ******************************* echo 您即将连接到SQL Server... echo 服务器地址是:%sname_sql% echo 登录名是:sa echo ******************************* echo. goto changesql :setsql echo. set /P sname_sql=请输入您想连接的SQL Server服务器地址: goto checksql :changesql echo 是否要连接到%sname_sql%这台SQL Server数据库? set /P csql=“y”连接到这台SQL Server数据库,“n”更换服务器地址,输入其它字符将退出程序[y/n] if "%csql%"=="y" ( goto checksql ) else ( if "%csql%"=="n" ( goto setsql ) else ( goto cend ) ) :checksql echo. set /P pwdsa=请输入%sname_sql%数据库管理员sa用户的密码: osql -S%sname_sql% -Usa -P%pwdsa% -Q ( echo 【已经正确连接到%sname_sql%这台SQL Server数据库...】 goto runsql ) else ( goto errorend ) :runsql echo 【下面将导出系统的初始化数据...】 bcp UIH_MOIS_V2.dbo.BIZ_USER out .\data\dbo.BIZ_USER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.CALLING out .\data\dbo.CALLING -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.CODE_NUM out .\data\dbo.CODE_NUM -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.DAY_EXECUTIVE out .\data\dbo.DAY_EXECUTIVE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_DRUG out .\data\dbo.EXECUTIVE_DRUG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_OPERATE out .\data\dbo.EXECUTIVE_OPERATE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_ORDER out .\data\dbo.EXECUTIVE_ORDER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.INJECT_WINDOW out .\data\dbo.INJECT_WINDOW -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.LOOK_CODE out .\data\dbo.LOOK_CODE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.LOOK_TYPE out .\data\dbo.LOOK_TYPE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MEDICAL_ORDER out .\data\dbo.MEDICAL_ORDER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_CALL out .\data\dbo.MESSAGE_CALL -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_NDA out .\data\dbo.MESSAGE_NDA -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_NDA_USER out .\data\dbo.MESSAGE_NDA_USER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.NDA_INTERFACE_URL out .\data\dbo.NDA_INTERFACE_URL -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PATIENT out .\data\dbo.PATIENT -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PRESCRIPTION out .\data\dbo.PRESCRIPTION -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PRESCRIPTION_COST out .\data\dbo.PRESCRIPTION_COST -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER out .\data\dbo.REGISTER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER_OPERATE out .\data\dbo.REGISTER_OPERATE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER_ST out .\data\dbo.REGISTER_ST -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.RESOURCE out .\data\dbo.RESOURCE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.ROLE out .\data\dbo.ROLE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.ROLE_RESOURCE out .\data\dbo.ROLE_RESOURCE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SEAT out .\data\dbo.SEAT -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SEAT_AREA out .\data\dbo.SEAT_AREA -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SYS_CONFIG out .\data\dbo.SYS_CONFIG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SYS_CONFIG_OPTION out .\data\dbo.SYS_CONFIG_OPTION -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.TEMP_ID out .\data\dbo.TEMP_ID -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.UNIT_CHANGE out .\data\dbo.UNIT_CHANGE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.UNITS out .\data\dbo.UNITS -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.USER_CONFIG out .\data\dbo.USER_CONFIG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.USER_ROLE out .\data\dbo.USER_ROLE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.WORKLOAD out .\data\dbo.WORKLOAD -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" set pwdsa= echo. goto succend :succend echo 已完成导出! echo 感谢您选用联影医疗软件! echo. goto end :errorend echo 安装程序没有正确运行,查看错误提示,并尝试按照提示解决这次的安装问题,如果问题依然存在,请发送错误信息到zehua.xing@united-imaging.com,联影医疗将提供专业的技术支持。 echo 安装程序即将退出... echo. goto end :cend echo 无效的输入! echo 您已退出安装程序... echo. goto end :end pause
setup.bat如下:
@shift @echo off title 联影医疗移动护理信息系统安装中... mode con cols lines color 3f cls echo. echo 感谢您使用联影信息化医疗软件,您正在安装联影移动护理信息系统... set sname_sql=localhost :connsql echo. echo ******************************* echo 您即将连接到SQL Server... echo 服务器地址是:%sname_sql% echo 登录名是:sa echo ******************************* echo. goto changesql :setsql echo. set /P sname_sql=请输入您想连接的SQL Server服务器地址: goto checksql :changesql echo 是否要连接到%sname_sql%这台SQL Server数据库? set /P csql=“y”连接到这台SQL Server数据库,“n”更换服务器地址,输入其它字符将退出程序[y/n] if "%csql%"=="y" ( goto checksql ) else ( if "%csql%"=="n" ( goto setsql ) else ( goto cend ) ) :checksql echo. set /P pwdsa=请输入%sname_sql%数据库管理员sa用户的密码: osql -S%sname_sql% -Usa -P%pwdsa% -Q ( echo 【已经正确连接到%sname_sql%这台SQL Server数据库...】 goto runsql ) else ( goto errorend ) :runsql pause osql -S%sname_sql% -Usa -P%pwdsa% -i "db\create_db.sql" osql -S%sname_sql% -Usa -P%pwdsa% -d "UIH_MOIS_V2" -i "db\0_crebas_mois.sql" echo. echo 【数据库结构安装完成!】 echo 【下面将导入系统的初始化数据...】 pause bcp UIH_MOIS_V2.dbo.BIZ_USER in .\data\dbo.BIZ_USER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.CALLING in .\data\dbo.CALLING -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.CODE_NUM in .\data\dbo.CODE_NUM -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.DAY_EXECUTIVE in .\data\dbo.DAY_EXECUTIVE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_DRUG in .\data\dbo.EXECUTIVE_DRUG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_OPERATE in .\data\dbo.EXECUTIVE_OPERATE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.EXECUTIVE_ORDER in .\data\dbo.EXECUTIVE_ORDER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.INJECT_WINDOW in .\data\dbo.INJECT_WINDOW -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.LOOK_CODE in .\data\dbo.LOOK_CODE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.LOOK_TYPE in .\data\dbo.LOOK_TYPE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MEDICAL_ORDER in .\data\dbo.MEDICAL_ORDER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_CALL in .\data\dbo.MESSAGE_CALL -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_NDA in .\data\dbo.MESSAGE_NDA -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.MESSAGE_NDA_USER in .\data\dbo.MESSAGE_NDA_USER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.NDA_INTERFACE_URL in .\data\dbo.NDA_INTERFACE_URL -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PATIENT in .\data\dbo.PATIENT -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PRESCRIPTION in .\data\dbo.PRESCRIPTION -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.PRESCRIPTION_COST in .\data\dbo.PRESCRIPTION_COST -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER in .\data\dbo.REGISTER -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER_OPERATE in .\data\dbo.REGISTER_OPERATE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.REGISTER_ST in .\data\dbo.REGISTER_ST -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.RESOURCE in .\data\dbo.RESOURCE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.ROLE in .\data\dbo.ROLE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.ROLE_RESOURCE in .\data\dbo.ROLE_RESOURCE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SEAT in .\data\dbo.SEAT -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SEAT_AREA in .\data\dbo.SEAT_AREA -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SYS_CONFIG in .\data\dbo.SYS_CONFIG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.SYS_CONFIG_OPTION in .\data\dbo.SYS_CONFIG_OPTION -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.TEMP_ID in .\data\dbo.TEMP_ID -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.UNIT_CHANGE in .\data\dbo.UNIT_CHANGE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.UNITS in .\data\dbo.UNITS -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.USER_CONFIG in .\data\dbo.USER_CONFIG -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.USER_ROLE in .\data\dbo.USER_ROLE -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" bcp UIH_MOIS_V2.dbo.WORKLOAD in .\data\dbo.WORKLOAD -S%sname_sql% -Usa -P%pwdsa% -c -t"**$**" -r "**&**" set pwdsa= echo. goto succend :succend echo 已完成安装! echo 感谢您选用联影医疗软件! echo. goto end :errorend echo 安装程序没有正确运行,查看错误提示,并尝试按照提示解决这次的安装问题,如果问题依然存在,请发送错误信息到zehua.xing@united-imaging.com,联影医疗将提供专业的技术支持。 echo 安装程序即将退出... echo. goto end :cend echo 无效的输入! echo 您已退出安装程序... echo. goto end :end pause