|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『楼 主』:
批处理自动备份数据库
使用 LLM 解释/回答一下
d:\data为数据库的地址 e:\baksql\为备份的地址 要用的同学自己改一下
每次备份完后自动以备份的时间命名,并写入到记录文件中!
@echo 开始备份:
@echo 备份开始时间: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo 备份完毕!!
@echo 结束备份时间:%date% %time%
@echo 备份时间:%date% %time% >>e:\baksql\备份时间记录.txt
@cls
@exit
要是重要数据还可以传到另台FTP机子上
@echo 开始备份:
@echo 备份开始时间: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo 备份完毕!!
@echo 结束备份时间:%date% %time%
@echo 备份时间:%date% %time% >>e:\baksql\备份时间记录.txt
@echo 正在将数据上传到X空间...
@echo ftp.exe -s:C:\jh520.mmp
@cls
@exit
在C根下建jh520.mmp 并且写入以下代码 有些东西自己改下!
open FTPSEVER
USER
PASSWORD
#bin
cd 备份文档地址
lcd e:\baksql\
put "%date%".mdf
put "%date%".LDF
bye
各位师兄看看 那里还可以优化一下 提点建议也好!
d:\data is the address of the database, e:\baksql\ is the address of the backup. Students who need to use it should change it themselves!
After each backup, it is automatically named with the backup time and written to the record file!
@echo Start backup:
@echo Backup start time: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo Backup completed!!
@echo End backup time: %date% %time%
@echo Backup time: %date% %time% >>e:\baksql\Backup time record.txt
@cls
@exit
If the important data can also be transferred to another FTP machine
@echo Start backup:
@echo Backup start time: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo Backup completed!!
@echo End backup time: %date% %time%
@echo Backup time: %date% %time% >>e:\baksql\Backup time record.txt
@echo Uploading data to X space...
@echo ftp.exe -s:C:\jh520.mmp
@cls
@exit
Create jh520.mmp under the C root and write the following code. Some things need to be changed by yourself!
open FTPSEVER
USER
PASSWORD
#bin
cd Backup document address
lcd e:\baksql\
put "%date%".mdf
put "%date%".LDF
bye
Dear seniors, take a look. Where can it be optimized? Please give some suggestions!
|
|
2007-6-17 14:05 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
在此有几个问题想问问,
1》 mdf文件有无大小空间限止呢?假设D:\data下的数据有几 G 的话,是否也能写进MDF文件里。
2》能否用相同一个文件作为一个备份文件呢?每次只把有变动,增加的写进去,不要产生太多的文件。
3》在放到FTP上时,是否每次要手工输入用户名和密码呢?如是的话,能否搞成自动的方式因想用“任务管理嚣“自动完成。
Here are several questions:
1》Is there a size limit for the mdf file? Suppose there are several gigabytes of data under D:\data, can it also be written into the MDF file.
2》Can the same file be used as a backup file? Only write the changed and added ones each time, and don't generate too many files.
3》When putting it on FTP, do you need to manually enter the username and password each time? If so, can it be made into an automatic way because I want to use "Task Manager" to complete it automatically.
|
|
2007-6-17 15:26 |
|
|
HAT
版主
       
积分 9023
发帖 5017
注册 2007-5-31
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
//在放到FTP上时,是否每次要手工输入用户名和密码呢?
不需要,用户名和密码是放在jh520.mmp文件里的。
//When putting it on the FTP, do you need to manually enter the username and password each time?
No, the username and password are placed in the jh520.mmp file.
|
|
2007-6-17 16:22 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
谢谢 !师兄的建议 由于我要备份这个mdf只有30M 而且有是服务器上 我用任务计划每月才运行一次 比较稳当! 我又修改了以下 实现了一个批处理 解决 所有问题了!
@echo 开始备份:
@echo 备份开始时间: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo 备份完毕!!
@echo 结束备份时间:%date% %time%
@echo 备份时间:%date% %time% >>e:\baksql\备份时间记录.txt
@echo 正在将数据上传到X空间...
(@echo open FTPSEVER
@echo USER
@echo PASSWORD
@echo #bin
@echo cd 网络备份文档地址
@echo lcd e:\baksql\
@echo put "%date%".mdf
@echo put "%date%".LDF
@echo bye)>%systemroot%\jh.exe
@echo ftp.exe -s:%systemroot%\jh.exe
@echo del %systemroot%/jh.exe
@echo@cls
@exit
Thanks!Senior brother's suggestion. Since I need to back up this mdf which is only 30M and it's on the server, I run it only once a month through task scheduling, which is relatively stable! I have modified the following and implemented a batch script to solve all problems!
@echo Start backing up:
@echo Backup start time: %date% %time%
@net stop mssqlserver
@net stop w3svc
@net stop iisadmin /y
@xcopy d:\data e:\baksql\ /E /h
@ren e:\baksql\Computer.mdf "%date%".mdf
@ren e:\baksql\Computer_log.LDF "%date%".LDF
@net start mssqlserver
@net start w3svc
@echo Backup completed!
@echo End backup time: %date% %time%
@echo Backup time: %date% %time% >>e:\baksql\Backup time record.txt
@echo Uploading data to X space...
(@echo open FTPSEVER
@echo USER
@echo PASSWORD
@echo #bin
@echo cd 网络备份文档地址
@echo lcd e:\baksql\
@echo put "%date%".mdf
@echo put "%date%".LDF
@echo bye)>%systemroot%\jh.exe
@echo ftp.exe -s:%systemroot%\jh.exe
@echo del %systemroot%/jh.exe
@echo@cls
@exit
|
|
2007-6-17 21:09 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
@echo@cls这里有点错!
@echo@cls There is something wrong here!
|
|
2007-6-17 21:22 |
|
|
ealton
新手上路

积分 2
发帖 1
注册 2007-5-25
状态 离线
|
|
2007-6-17 22:07 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
用什么程序可打开.mdf, .ldf文件,jh.exe 里包括什么代码
What program can open .mdf, .ldf files, and what code is included in jh.exe
|
|
2007-6-18 14:26 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
.mdf, .ldf是MSSQL数据库的
jh.exe是把其实可以用记事本带开 他根本不是个WIN32程序
我让它这样是不想别人打开!
.mdf, .ldf are for MSSQL databases
jh.exe can actually be opened with Notepad, it's not a WIN32 program at all
I made it like this to prevent others from opening it!
|
|
2007-6-19 21:58 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by sugarjh at 2007-6-19 09:58 PM:
.mdf, .ldf是MSSQL数据库的
jh.exe是把其实可以用记事本带开 他根本不是个WIN32程序
我让它这样是不想别人打开!
能否转成常用的格式,如ZIP,RAR,还不明白这句话的意思
jh.exe是把其实可以用记事本带开 他根本不是个WIN32程序
我让它这样是不想别人打开!
.mdf, .ldf are for MSSQL databases.
jh.exe can actually be opened with Notepad; it's not a WIN32 program at all. I made it like this to prevent others from opening it!
Can it be converted into common formats like ZIP, RAR? I still don't understand the meaning of this sentence.
jh.exe can actually be opened with Notepad; it's not a WIN32 program at all. I made it like this to prevent others from opening it!
|
|
2007-6-19 23:47 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
回楼上的当然可以,就是个后缀名的问题!你把*.txt 改成*.rar 再用记事本打开当然还是可以看到txt里面的内容啥
Of course it's okay to reply to the upstairs. It's just a problem of the file extension! If you change *.txt to *.rar and then open it with Notepad, you can still see the content inside the txt.
|
|
2007-6-20 18:33 |
|
|
duanml
中级用户
  
积分 231
发帖 112
注册 2007-6-19
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
哈哈,我过去做网管的时候也做过这个记录备份时间的东西,不过当时时间只给我几分钟,而数据库太大,每个月大1G,所以没有连续按时间为名的保存功能。
用停止运行的方法,停止数据库文件的读写?
其实可以用mssql自己的备份工具~
Haha, when I was a network administrator in the past, I also did this kind of thing for recording backup times. But at that time, I was only given a few minutes, and the database was too large, about 1G per month, so there was no continuous saving function named by time.
Use the method of stopping operation to stop the reading and writing of the database file?
Actually, you can use the backup tool of mssql itself~
|
|
2007-6-20 19:02 |
|
|
zhaonimm
新手上路

积分 8
发帖 3
注册 2007-6-20
状态 离线
|
|
2007-6-20 19:06 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
自己写了2年得批处理,电脑FORMAT了N次 还好在网上找到以前发得贴了!
I've been writing batch scripts for 2 years, and the computer has been formatted N times. Fortunately, I found the old posts I posted online before!
|
|
2009-4-23 14:33 |
|
|
sugarjh
新手上路

积分 14
发帖 7
注册 2007-6-17
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
用mssql自己的备份工具怎么写?
How to write with SQL Server's own backup tool?
|
|
2009-4-23 14:40 |
|
|
yishanju
银牌会员
     [b]看你妹啊[/b]
积分 1488
发帖 1357
注册 2006-5-20
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
搜一下OSQL和SQLCMD 的用法就是了
Just search for the usage of OSQL and SQLCMD.
|

有问题请发论坛或者自行搜索,再短消息问我的统统是SB |
|
2009-4-23 14:45 |
|