电脑技术学习

Sybase中如何恢复master数据库

dn001

Sybase中如何恢复master数据库
ASE can't setup and has no valid dump of master

1、编辑RUN_servername
在命令行最后加入:-T3607

2、单用户模式启动ASE
$cd install
$startserver -f RUN_servername -m

3、bcp out系统表
$bcp master..sysdevices out /directory.spec/devs -Usa -P -c
$bcp master..sysdatabases out /directory.spec/dbs -Usa -P -c
$bcp master..sysusages out /directory.spec/usages -Usa -P -c
$bcp master..syslogins out /directory.spec/logins -Usa -P -c
$bcp master..sysconfigures out /directory.spec/configures -Usa -P -c
$bcp master..syscharsets out /directory.spec/charsets -Usa -P -c

4、shutdownASE

5、创建新master设备
$buildmaster -d<path_to_new_master_device> -s<new_master_device_size>
(new_master_device_size以2K为单位)

6、编辑RUN_servername
将指定master设备指定为新创建的master设备,并删除在第1步中增加的参数。

7、删除/directory.spec/dbs、/directory.spec/usages文件中有关master、tempdb、model的内容。

8、单用户模式启动ASE
$cd install
$startserver -f RUN_servername -m

9、 bcp in系统表
$ bcp master..sysdevices in /directory.spec/devs -Usa -P -b 1 -c
$bcp master..sysdatabases in /directory.spec/dbs -Usa -P -b 1 -c
$bcp master..sysusages in /directory.spec/usages -Usa -P -b 1 -c
$bcp master..syslogins in /directory.spec/logins -Usa -P -b 1 -c
$bcp master..sysconfigures in /directory.spec/configures -Usa -P -b 1 -c
$bcp master..syscharsets in /directory.spec/charsets -Usa -P -b 1 -c

10、重启ASE

11、执行installmaster脚本
$isql -Usa -P < $SYBASE/scripts/installmaster