sp_dboption设置数据为单用户模式

来源:互联网 发布:轻型战斗机知乎 编辑:程序博客网 时间:2024/06/03 17:07

二.使用sp_dboption设置数据为单用户模式
1> use master
2> go
1> sp_dboption tec,"single user",true
2> go
Database option 'single user' turned ON for database 'tec'.
Running CHECKPOINT on database 'tec' for option 'single user' to take effect.
(return status = 0)

三.使用sp_flushstats将内存中存储的统计信息刷新到systabstats系统表。你必须至少等待10秒钟,等待进程完成
1> use tec
2> go
1> sp_flushstats
2> go
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.
(return status = 0)

四.运行checkpoint命令将所有脏页(自上次写入以来被更新的页)写入到数据库设备。你必须至少等待10秒钟,等待进程完成。
1> checkpoint
2> go

五.运行卸载数据库。
1> use master
2> go
1> dump database tec to "/data_backup/tec0912zm"
2> go
Backup Server session id is:  4.  Use this value when executing the
'sp_volchanged' system stored procedure after fulfilling any volume change
request from the Backup Server.
Backup Server: 4.41.1.1: Creating new disk file /data_backup/tec0912zm.
Backup Server: 6.28.1.1: Dumpfile name 'tec0825608D59    ' section number 1
mounted on disk file '/data_backup/tec0912zm'
Backup Server: 4.58.1.1: Database tec: 14644 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database tec: 36278 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database tec: 57912 kilobytes DUMPED.
…………………………………………………………………………….
Backup Server: 4.58.1.1: Database tec: 585206 kilobytes DUMPED.
Backup Server: 4.58.1.1: Database tec: 586744 kilobytes DUMPED.
Backup Server: 3.43.1.1: Dump phase number 1 completed.
Backup Server: 3.43.1.1: Dump phase number 2 completed.
Backup Server: 3.43.1.1: Dump phase number 3 completed.
Backup Server: 4.58.1.1: Database tec: 586752 kilobytes DUMPED.
Backup Server: 3.42.1.1: DUMP is complete (database tec).

六.取消sp_dboption单用户模式设置
1> sp_dboption tec,"single user",false
2> go
Database option 'single user' turned OFF for database 'tec'.
Running CHECKPOINT on database 'tec' for option 'single user' to take effect.
(return status = 0)

(必须在master 库  更改database options
You must be in the 'master' database in order to change database options.)

七.将dump文件拷贝到windows-ASE 服务器中
1.可使用ftp拷贝
2.也可以使用ftp工具拷贝

原创粉丝点击