sybase 重要维护命令.docx

上传人:b****4 文档编号:4630872 上传时间:2022-12-07 格式:DOCX 页数:9 大小:19.49KB
下载 相关 举报
sybase 重要维护命令.docx_第1页
第1页 / 共9页
sybase 重要维护命令.docx_第2页
第2页 / 共9页
sybase 重要维护命令.docx_第3页
第3页 / 共9页
sybase 重要维护命令.docx_第4页
第4页 / 共9页
sybase 重要维护命令.docx_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

sybase 重要维护命令.docx

《sybase 重要维护命令.docx》由会员分享,可在线阅读,更多相关《sybase 重要维护命令.docx(9页珍藏版)》请在冰豆网上搜索。

sybase 重要维护命令.docx

sybase重要维护命令

关键字:

sybase数据库维护

一、从命令行里进入数据库

依次打开“开始”—>“运行”,在运行对话框里输入cmd,打开“命令提示符”窗口,

在“>”后面输入下面兰色的语句。

C:

\DocumentsandSettings\hhy>isql-Usa-Shrms-Jcp936

Password:

注意:

-U后为登陆数据库使用的用户名

-S后为所登陆数据库服务的名称

-J后为所登陆数据库使用的字符集

二、列出现有数据库极其大小

将数据库服务器里的全部的数据库列表出来,使用下面语句。

1>sp_helpdb

2>go

name                    db_size      owner                   dbid

        created

        status

-------------------------------------------------------------------

        ------------------

        ----------------------------------------------------------------------

-------------------------------

hrms                        1100.0MBsa                           4

        May13,2006

        nooptionsset

master                        48.0MBsa                           1

        May13,2006

        mixedloganddata

model                         16.0MBsa                           3

        May13,2006

        mixedloganddata

sybsystemdb                   20.0MBsa                       31513

        May13,2006

        trunclogonchkpt,mixedloganddata

sybsystemprocs               120.0MBsa                       31514

        May13,2006

        trunclogonchkpt,mixedloganddata

tempdb                      1416.0MBsa                           2

        May18,2006

        selectinto/bulkcopy/pllsort,trunclogonchkpt,mixedloganddata

(1rowaffected)

(returnstatus=0)

三、创建数据库设备,并且指定数据设备和日志设备的大小。

diskinitname=‘你要取的逻辑名',

physname='你要存放的物理路径及设备名',size='大小M' ○1建立数据设备并指定大小,语句如下

1>diskinitname='hhydata',physname='c:

\hhyyhhdata.dev',size='100M'

2>go

○2建立日志设备并指定大小,语句如下

1>diskinitname='hhylog',physname='c:

\hhyyhhlog.dev',size='100M'

2>go

四、创建指定的数据库,指定数据和日志的大小。

创建新的数据库的时候,分别指定数据设备和日志设备,

createdatabase数据库名 on数据设备逻辑名= '大小M'

logon日志设备逻辑名= '大小M' 语句如下:

1>createdatabasehhyyhh2002onhhydata='80M'logonhhylog='80M'

2> go

CREATEDATABASE:

allocating5120logicalpages(80.0megabytes)ondisk

'hhydata'.

CREATEDATABASE:

allocating5120logicalpages(80.0megabytes)ondisk

'hhylog'.

五、把数据库设备设置为缺省设备

○1数据设备

1>sp_diskdefault hrmsdata,defaulton

2>go

○2日志设备

1>sp_diskdefault hrmslog,defaulton

2>go

五.中文字符集CP936的安装

1.    JDBC连接串要有字符集设置

jdbc:

sybase:

Tds:

192.168.3.11:

5000/Wfis_db?

charset=cp936

2.    服务器配置成cp936

(1)   使用isql查看当前已经安装的字符集

isql-Usa-Plongtop

>usemaster

>go

>selectid,namefromsyscharsets

>go

idname

-------------------

  0ascii_8

  1iso_1

  2cp850

20defaultml

21thaidict

22iso14651

24utf8bin

25binary

39altnoacc

45altdict

46altnocsp

47scandict

48scannocp

50bin_iso_1

50bin_cp850

51dict

52nocase

53nocasep

54noaccent

55espdict

56espnocs

57espnoac

59rusnocs

64cyrnocs

65elldict

69hundict

70hunnoac

71hunnocs

73turknoac

74turknocs

129cp932bin

130dynix

137gb2312bn

140cyrdict

155turdict

161euckscbn

163gbpinyin

165rusdict

179sjisbin

192eucjisbn

194big5bin

(41rowsaffected)

从列表中看出没有安装cp936字符集

(2)   查看当前使用的缺省字符集

>sp_configure"defaultchar"

>go

ParameterName                Default    MemoryUsedConfigValue

        RunValue  Unit                Type

----------------------------------------------------------------

        -----------------------------------------

defaultcharactersetid                2          0          2

                  2id                  static

缺省字符集的id是2,查看上面的列表,可以得知是cp850

(3)   因为上面的列表中没有安装cp936,所以就安装cp936字符集

进入目录C:

\sybase\charsets\cp936

运行命令charset-Usa–P binary.srtcp936

操作如下,红色为要输入的内容。

C:

\>cds*

C:

\sybase>cdchar*

C:

\sybase\charsets>cdcp936

C:

\sybase\charsets\cp936>charset-Usa-Pbinary.srtcp936

Loadingfile'binary.srt'.

Founda[sortorder]section.

ThisisClass-1sortorder.

FinishedloadingtheCharacterSetDefinition.

Finishedloadingfile'binary.srt'.

1sortorderloadedsuccessfully

C:

\sybase\charsets\cp936>

运行完成后,系统就安装了cp936字符集

(4)   验证是否确实安装了cp936字符集

C:

\sybase\charsets\cp936>isql-Usa-P

1>usemaster

2>go

1>selectid,namefromsyscharsets

2>go

idname

---------------------------------

  0ascii_8

  1iso_1

  2cp850

20defaultml

21thaidict

22iso14651

24utf8bin

25binary

39altnoacc

45altdict

46altnocsp

47scandict

48scannocp

50bin_iso_1

50bin_cp850

50bin_cp936

51dict

52nocase

53nocasep

54noaccent

55espdict

56espnocs

57espnoac

59rusnocs

64cyrnocs

65elldict

69hundict

70hunnoac

71hunnocs

73turknoac

74turknocs

129cp932bin

130dynix

137gb2312bn

140cyrdict

155turdict

161euckscbn

163gbpinyin

165rusdict

171cp936

179sjisbin

192eucjisbn

194big5bin

(43rowsaffected)

从列表中可以发现已经安装了cp936,id是171

(5)   把系统的当前缺省字符集设置为cp936

1>sp_configure"defaultchar",171

2>go

Inchangingthedefaultsortorder,youhavealsoreconfiguredSQLServer's

defaultcharacterset.

ParameterName                Default    MemoryUsedConfigValue

        RunValue  Unit                Type

----------------------------------------------------------------

        -----------------------------------------

defaultcharactersetid                2          0        171

                  2id                  static

(1rowaffected)

Configurationoptionchanged.Sincetheoptionisstatic,AdaptiveServermust

berebootedinorderforthechangetotakeeffect.

Changingthevalueof'defaultcharactersetid'to'171'increasestheamount

ofmemoryASEusesby6K.

(returnstatus=0)

(6)   重启Sybase服务,使更改生效

第一次重启,系统会对已经存在的数据进行转换,转换完成后自动停止服务,只要再次启动服务就可以了。

补充:

在isql状态下查看原来数据库字符集使用情况,服务器和客户端的都要查看,方法是:

一、获得服务器端的字符集情况:

 1>sp_helpsort

 2>go

 输出结果为:

 CharacterSet=2,cp850

    CodePage850(Multilingual)characterset.

 SortOrder=50,bin_cp850

    BinarySortOrderforCodePage850(cp850).

 二、获得客户端字符集情况:

 1>select@@client_csname

 2>go

 输出结果应为:

iso_1

说明:

很多时候应用程序报错,客户端和服务器端字符集不相匹配。

三、修改客户端缺省字符集文件c:

\sybase\locales\locales.dat文件,首先找到[NT]操作系统分组,然后定位到该分组最后一行“local=default,us_english,iso_1”,将其修改为:

“local=default,us_english,cp936”。

参考上面步骤,再次确认服务器端和客户端字符集均已修改正确。

(7)   更改DB客户端的字符集

DBArtisan中要更改客户端的字符集为cp936才能连接cp936的服务器

通过菜单\Logfile\Options...打开对话框,选择Connection标签,

更改ClientCharacter输入框的值为cp936。

数据库的charset修改为cp936时,使用isql按如下的方式

isql-Usa-Plongtop-Sdbserver-Jcp936

六、Sybase客户端会话数量的更改

SyBase的会话数量默认为25个,在人力资源系统中远远不够,需要调整数量为1000。

调整命令如下:

1>sp_configure“numberofuser”,1000

2>go

其他配置

1、临时表:

临时表的默认配置在人力资源系统中不足于运行,需至少增加10个G的数据库设备到tempdb之上,否则一旦执行大数据量的分页存储过程时,将会抛出临时表空间分配不足的异常。

关于建立数据库设备,可参见附件《快速维护手册V2.0.doc》

六、从指定位置导入备份数据到指定的数据库

1>loaddatabasehhyyhh2002from"d:

\hrms060513.bak"

2>go

BackupServersessionidis:

 10. Usethisvaluewhenexecutingthe

'sp_volchanged'systemstoredprocedureafterfulfillinganyvolumechange

requestfromtheBackupServer.

BackupServer:

6.28.1.1:

Dumpfilename'hrmis06138082CE 'sectionnumber1

mountedondiskfile'd:

\hrmis060518.bak'

BackupServer:

4.58.1.1:

Databasehrms:

34980kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

82726kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

118152kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

176714kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

207308kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

241934kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

268624kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

303250kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

329940kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

360550kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

391256kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

417898kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

452572kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

487838kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

510560kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

770098kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

1019940kilobytesLOADed.

BackupServer:

4.58.1.1:

Databasehrms:

1019962kilobytesLOADed.

BackupServer:

3.42.1.1:

LOADiscomplete(databasehrms).

Caution:

 Youhavesetupthisdatabasetoincludespaceondisk3forbothdat

andthetransactionlog. Thiscanmakerecoveryimpossibleifthatdiskfails.

Alldumpedpageshavebeenloaded. SQLServerisnowclearingpagesabovepage

63744,whichwerenotpresentinthedatabasejustloaded.

SQLServerhasfinishedclearingdatabasepages.

Startedestimatingrecoverylogboundariesfordatabase'hrms'.

Database'hrms',checkpoint=(38143,191),first=(38143,191),last=(38143,

232).

Completedestimatingrecoverylogboundariesfordatabase'hrms'.

StartedANALYSISpassfordatabase'hrms'.

CompletedANALYSISpassfordatabase'hrms'.

StartedREDOpassfordatabase'hrms'.Thetotalnumberoflogrecordsto

processis42.

Redopassofrecoveryhasprocessed3committedand16abortedtransactions.

CompletedREDOpassfordatabase'hrms'.

UsetheONLINEDATABASEcommandtobringthisdatabaseonline;SQLServerwill

notbringitonlineautomatically.

七、使当前数据库,(使当前数据库在线)执行如下语句:

1>onlinedatabasehrms

2>go

Startedestimatingrecoverylogboundariesfordatabase'hrms'.

Database'hrms',checkpoint=(38143,191),first=(38143,191),last=(38143,

232).

Completedestimatingrecoverylogboundariesfordatabase'hrms'.

StartedANALYSISpassfordatabase'hrms'.

CompletedANALYSISpassfordata

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 数学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1