资源描述
数据库系统管理数据库系统管理:Adaptive Server Enterprise 12.5服务器配置和数据库备份服务器配置和数据库备份服务器配置和数据库备份服务器配置和数据库备份尹海宁尹海宁 高级顾问高级顾问Sybase Software(China)S2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-1单元概要单元概要按缺省配置安装的服务器只能满足启动该服务器,但是这种配置在现实的生产与开发环境中是不够的。因此,一个服务器安装后,系统管理员要做的第一件事就是按照实际性能要求重新配置服务器。目标目标完成本单元学习后,应该能够:n描述配置文件的特征;n查看配置参数的值;n修改配置参数的值;n使用多个配置文件。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-2单元提要单元提要n配置文件配置文件n查看配置值n修改配置值n多个配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-3配置参数配置参数n配置参数是 SA 定义的设置,它控制着 Adaptive Sever 的行为。lAdaptive Server提供缺省值。s缺省值是启动服务器的最小配置。l可重新设置配置参数,以使服务器满足需求。n正确设置配置参数能够使服务器正常工作并能提高性能。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-4配置文件配置文件n配置文件是一个 ASCII 文本文件,它里面存放配置参数值。l缺省情况,该文件名为.cfg。n当服务器启动时,配置文件用于分配服务器资源。l在 UNIX 上,除非特别指明另一个文件,否则使用配置文件$SYBASE/.cfg。l在 NT 上,除非特别指明另一个文件,否则使用配置文件%SYBASE%.cfg。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-5指定一个启动配置文件指定一个启动配置文件n在 UNIX 上,在 RUNSERVER 运行文件中使用-c 命令行标志。l包含全路径;l如果该文件不存在,服务器将不启动;l例子:/work/sybase/ASE-12_5/bin/dataserver-d/devices/master.dat-sSYBASE-e/work/sybase/ASE-12_5/install/errorlog-c/work/sybase/ASE-12_5/SYBASE.0102006 Sybase,Inc.and its subsidiaries.All rights reserved.2-6配置文件例子配置文件例子n这是一个安装时创建的配置文件例子。注意许多值都为 DEFAULT(依赖于平台)。n参数是黑体字,是 ASE 12.5 版中新参数(没有星号开头)或在以前版 ASE 已存在,但被挪到ASE 12.5中新的位置(有星号开头)。ASE 12.5 以前版中配置文件例子,参看附录“配置文件例子”。#Configuration File for the Sybase SQL Server#Please read the System Administration Guide(SAG)#before changing any of the values in this file.#2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-7配置文件例子配置文件例子Configuration OptionsGeneral InformationBackup/Recoveryrecovery interval in minutes=DEFAULTprint recovery information=DEFAULTtape retention in days=DEFAULTCache Managernumber of oam trips=DEFAULTnumber of index trips=DEFAULTprocedure cache percent=DEFAULTmemory alignment boundary=DEFAULTglobal async prefetch limit=DEFAULTglobal cache partition number =DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-8配置文件例子配置文件例子Named Cache:default data cachecache size=DEFAULTcache status=default data cacheMeta-Data Cachesnumber of open databases=DEFAULTnumber of open objects=DEFAULTopen object spinlock ratio=DEFAULTnumber of open indexes=DEFAULTopen index hash spinlock ratio=DEFAULTopen index spinlock ratio=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-9Disk I/Odisk i/o structures=DEFAULTpage utilization percent=DEFAULTnumber of devices=DEFAULTdisable disk mirroring=DEFAULTdisable character set conversions=DEFAULTenable unicode conversions=DEFAULTsize of unilib cache=DEFAULTNetwork Communicationdefault network packet size=DEFAULTmax network packet size=DEFAULTremote server pre-read packets=DEFAULTnumber of remote connections=DEFAULTnumber of remote logins=DEFAULTnumber of remote sites=DEFAULTmax number network listeners=DEFAULTtcp no delay=DEFAULTallow sendmsg=DEFAULTsyb_sendmsg port number=DEFAULT配置文件例子配置文件例子2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-10配置文件例子配置文件例子O/S Resourcesmax async i/os per engine=DEFAULTmax async i/os per server=DEFAULTParallel Querynumber of worker processes=DEFAULTmemory per worker process=DEFAULTmax parallel degree=DEFAULTmax scan parallel degree=DEFAULTPhysical ResourcesPhysical Memorytotal memory=DEFAULTadditional network memory=DEFAULTshared memory starting address=DEFAULTmax SQL text monitored=DEFAULTProcessorsmax online engines=DEFAULTmin online engines=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-11配置文件例子配置文件例子SQL Server Administrationdefault database size=DEFAULTidentity burning set factor=DEFAULTallow nested triggers=DEFAULTallow updates to system tables=DEFAULTprint deadlock information=DEFAULTdefault fill factor percent=DEFAULTdefault exp_row_size percent=DEFAULTnumber of mailboxes=DEFAULTnumber of messages=DEFAULTnumber of alarms=DEFAULTnumber of pre-allocated extents=DEFAULTevent buffers per engine=DEFAULTcpu accounting flush interval=DEFAULTi/o accounting flush interval=DEFAULTsql server clock tick length=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-12配置文件例子配置文件例子 runnable process search count=DEFAULTi/o polling process count=DEFAULTtime slice=DEFAULTdeadlock retries=DEFAULTcpu grace time=DEFAULTnumber of sort buffers=DEFAULTnumber of large i/o buffers=DEFAULTsize of auto identity column=DEFAULTidentity grab size=DEFAULTpage lock promotion HWM=DEFAULTpage lock promotion LWM=DEFAULTpage lock promotion PCT=DEFAULThousekeeper free write percent=DEFAULTenable housekeeper GC=DEFAULTpartition groups=DEFAULTpartition spinlock ratio=DEFAULT 2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-13配置文件例子配置文件例子 allow resource limits=DEFAULTnumber of aux scan descriptors=DEFAULTSQL Perfmon Integration=DEFAULTallow backward scans=DEFAULTrow lock promotion HWM=DEFAULTrow lock promotion LWM=DEFAULTrow lock promotion PCT=DEFAULTlicense information=DEFAULTenable sort-merge join and JTC=DEFAULTabstract plan load=DEFAULTabstract plan dump=DEFAULTabstract plan replace=DEFAULTabstract plan cache=DEFAULTtext prefetch size=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-14配置文件例子配置文件例子User Environmentnumber of user connections=DEFAULTstack size=DEFAULTstack guard size=DEFAULTpermission cache entries=DEFAULTuser log cache size=DEFAULTuser log cache spinlock ratio=DEFAULTenable HA=DEFAULTenable DTM=DEFAULTallow remote access=DEFAULTlock shared memory=DEFAULTallow sql server async i/o=DEFAULTLock Managernumber of locks=DEFAULTdeadlock checking period=DEFAULTfreelock transfer block size=DEFAULTmax engine freelocks=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-15配置文件例子配置文件例子lock spinlock ratio=DEFAULTlock address spinlock ratio=DEFAULTlock table spinlock ratio=DEFAULTlock hashtable size=DEFAULTlock scheme=DEFAULTlock wait period=DEFAULTread committed with lock=DEFAULTSecurity Relatedsystemwide password expiration=DEFAULTaudit queue size=DEFAULTcurread change w/open cursors=DEFAULTallow procedure grouping=DEFAULTselect on syscomments.text=DEFAULTauditing=DEFAULTcurrent audit table=DEFAULTsuspend audit when device full=DEFAULTmax roles enabled per user=DEFAULTcheck password for digit=DEFAULTminimum password length=DEFAULT 2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-16配置文件例子配置文件例子maximum failed logins=DEFAULTunified login required=DEFAULTuse security services=DEFAULTmsg confidentiality reqd=DEFAULTmsg integrity reqd=DEFAULTdtm detach timeout period=DEFAULTsecure default login=DEFAULTExtended Stored Procedureesp unload dll=DEFAULTesp execution priority=DEFAULTesp execution stacksize=DEFAULTxp_cmdshell context=DEFAULTstart mail session=DEFAULTError Logevent logging=DEFAULTlog audit logon success=DEFAULTlog audit logon failure=DEFAULTevent log computer name=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-17配置文件例子配置文件例子Rep Agent Thread Administrationenable rep agent threads=DEFAULTComponent Integration Servicesenable cis=DEFAULTcis connect timeout=DEFAULTcis bulk insert batch size=DEFAULTmax cis remote connections=DEFAULTmax cis remote servers=DEFAULTcis packet size=DEFAULTcis cursor rows=DEFAULTcis rpc handling=DEFAULTJava Servicesenable java=DEFAULTsize of process object heap=DEFAULTsize of shared class heap=DEFAULTsize of global fixed heap=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-18配置文件例子配置文件例子 plan text pipe max messages=DEFAULTstatement pipe active=DEFAULTstatement pipe max messages=DEFAULTerrorlog pipe active=DEFAULTerrorlog pipe max messages=DEFAULTdeadlock pipe active=DEFAULTdeadlock pipe max messages=DEFAULTwait event timing=DEFAULTprocess wait events=DEFAULTobject lockwait timing=DEFAULTSQL batch capture=DEFAULTstatement statistics active=DEFAULTper object statistics active=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-19配置文件例子配置文件例子DTM Administrationenable xact coordination=DEFAULTxact coordination interval=DEFAULTnumber of dtx participants=DEFAULTstrict dtm enforcement=DEFAULTtxn to pss ratio=DEFAULTdtm lock timeout period=DEFAULTDiagnosticsdump on conditions=DEFAULTmaximum dump conditions=DEFAULTnumber of ccbs=DEFAULTcaps per ccb=DEFAULTaverage cap size=DEFAULTMonitoringQ diagnostics active=DEFAULTsql text pipe active=DEFAULTsql text pipe max messages=DEFAULT2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-20动态和静态参数动态和静态参数n动态参数是修改后立即起作用。n静态参数是修改后要重新启动服务器才起作用。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-21启动时配置文件启动时配置文件n当 Adaptive Server 启动时:l它按照配置文件分配资源。l备份配置文件。s备份文件名叫.baks前一次启动的备份文件被覆盖。n如果文件中有错误,Adaptive Server 会用缺省值启动,也可能不启动。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-22单元提要单元提要配置文件n查看配置值查看配置值n修改配置值n多个配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-23查看配置值查看配置值nsp_configure显示配置参数值:l语法:sp_configure parameter_name|group_namel例子:sp_configure number of remote connectionsParam.NameDefaultMemoryConfig Val.Run Val.-number of20332020l注释:由于空间原因,有些输出可能被缩写n任何用户都可 sp_configure 查看配置参数值。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-24sp_configure输出输出Group:Backup/RecoveryParameter Name DefaultMemoryConfigRunUsedValueValue-recovery interval00 55in minutestape retention in days00 00recovery flags 0010Group Name:Cache ManagerParameter Name DefaultMemoryConfigRunUsedValueValue-total cache size0000size of data cache 00 0 0size of procedure cache0000.Output organized in columnsand by groups2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-25显示级别显示级别n显示级别是一个设置,它决定运行 sp_configure 时所显示的参数。l每一个用户都有他自己的显示级别。n显示级别可设为如下三个值:lBasic 只显示基本参数;lIntermediate 显示所有基本参数和一些较复杂参数;lComprehensive 显示所有参数。n缺省设置为“comprehensive”。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-26查看和改变显示级别查看和改变显示级别n用户可通过使用 sp_displaylevel 查看或改变显示级别。l语法:sp_displaylevel user_name,basic|intermediate|comprehensivel查看例子:sp_displaylevel-The current display level for login nyaris intermediate.l改变例子:sp_displaylevel sa,comprehensive-The display level for login nyar has been changed to comprehensive.2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-27获取帮助信息获取帮助信息sp_helpconfig显示配置参数的帮助信息。l语法:sp_helpconfig“parameter_name”l例子:sp_helpconfig number of remote connections-number of remote connections controls the limit onactive connections initiated to and from this SQLServer.The default is 20.Min.Val.Max.Val.Def.Val.Curr.Val.Memory Used-0 32767 02033 l注释:由于空间原因,有些输出被缩写。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-28单元提要单元提要配置文件查看配置值n修改配置值修改配置值n多个配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-29谁能修改配置参数谁能修改配置参数n只有系统管理员与系统安全员能够修改配置参数。l系统管理员能够修改除与系统安全相关外的所有配置参数。l系统安全员只能修改与系统安全相关的配置参数。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-30两个修改方法两个修改方法n可采用如下之一方法修改配置文件:l交互方式。s使用 sp_configure 存贮过程。l非交互方式。s手工修改配置文件,然后把值读到服务器或重新启动服务器。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-31交互方式修改配置值交互方式修改配置值nsp_configure修改配置参数值。l语法:sp_configure parameter_name,parameter_valuel例子:sp_configure number of remote connections,50-Configuration option changed.Since the option isstatic,Adaptive Server must be rebooted in orderfor the change to take effect.2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-32服务器如何修改配置文件服务器如何修改配置文件当使用 sp_configure 改变一个参数时,服务器:1.保存原配置文件的一个拷贝。l对于第一次修改,拷贝名字为.001,对于第二次修改,名字为.002 等等。2.新配置参数值写到文件.cfg 中。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-33把一个值复原到缺省值把一个值复原到缺省值n即使不知到缺省值为多少,sp_configure 可以将一个配置参数值置回它的缺省值。l语法:sp_configure parameter_name,0,defaultl例子:sp_configure number of remote connections,0,default-Configuration option changed.Since the option isstatic,Adaptive Server must be rebooted in orderfor the change to take effect.2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-34nsp_configure带参数“configuration file”可有四个子命令:l语法:sp_configure configuration file,0,write|restore|verify|read,file_namenwrite子命令将当前活动的配置值(来源于 syscurconfigs 中)写到一个文件中。l给定文件名已经不能使用。nrestore子命令创建一个给定名的文件,它包含当前参数配置值,但不一定是活动的配置值(来源于 syscurconfigs 中)。读写配置文件读写配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-35读写配置文件读写配置文件nverify子命令检查给定文件中值的有效性。nread子命令检查给定文件中值的有效性并把有效值传递到服务器中。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-36n可使用文本编辑器手工编辑一个配置文件。l不能编辑服务器正在使用的文件。n当编辑一个文件时,可使用适当的配置。configuration语法:parameter_name=value|DEFAULTl例子:number of user connections=DEFAULTnumber of remote connections=50手工编辑一个配置文件手工编辑一个配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-37手工编辑一个配置文件手工编辑一个配置文件n文件编辑完后,应该运行 sp_configure 带 verify 子命令来检查格式与值。n使用编辑后的配置文件时,能:l运行 sp_configure 带 read 子命令,或l指定那个配置文件重新启动服务器。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-38显示正在使用配置文件的名字显示正在使用配置文件的名字nsyscurconfigs表中储存活动的动态配置参数和启动时的静态参数。l它只存在于 master 数据库中。n下面查询返回正在使用配置文件的名字:select value2 from syscurconfigswhere config=114-C:SybaseSYBASE.cfg2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-39nsp_configurel显示所有参数值。nsp_configure parameter_namel显示给定参数值。nsp_configure group_namel显示给定组内参数值。nsp_configure“parameter_name,valuel改变给定参数到给定值。l只能由系统管理员与系统安全员使用。语法复习语法复习:sp_configure2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-40语法复习语法复习:sp_configurensp_configure parameter_name,0,defaultl把参数设回它的缺省值。l只能由系统管理员与系统安全员使用。nsp_configure configuration file,0,subcommand,file_namel读、写和确认配置文件。l只能由系统管理员与系统安全员使用。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-41与配置相关的系统表与配置相关的系统表nsysconfigures(只在 master 数据库中)l该表存放启动时值,或最近修改的参数值。svalue-参数启动时值scomment-参数名sstatus-是 1(动态)或 0(静态)nsyscurconfigs(只在 master 数据库中)l该表存放当前正在使用的配置参数值。svalue-参数当前值scomment-参数名sstatus-是 1(动态)或 0(静态)sdefvalue-参数缺省值2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-42单元提要单元提要配置文件查看配置值修改配置值n多个配置文件多个配置文件2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-43使用多个配置文件使用多个配置文件n有时使用多个配置文件有用,或者使用同一文件的多个拷贝,例如:l系统上在不同时间处理需求不同。l在系统上有多个服务器需要同一个标准化企业配置。l恢复一个服务器。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-44例子例子1:不同处理需求不同处理需求n情况:l在高峰时刻,一个电话公司使用在线事务处理(OLTP),很多人记录很多事务。l在晚上,很少用户使用,这时运行报表(DSS)。n建议:l在每个时间段创建不同的配置文件。l在高峰时刻前用一个配置文件启动服务器,它在OLTP 条件下提高系统性能。l在高峰时刻后使用另外一个配置文件启动服务器,它在DSS 条件下提高系统性能。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-45例子例子2:分发配置分发配置n情况:l一个机构使用多个服务器,它们需要相同的配置。n建议:l创建一个配置文件并分发到各地。n当其它服务器启动时,它们就会各自创建复制的配置文件。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-46例子例子3:恢复恢复n情况:l修改配置文件会导致服务器起不来。n建议:l使用配置文件的以前版本来启动服务器。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-47n配置参数是用户定义的配置,它控制着 Adaptive Server 各方面的行为。n配置文件是一个 ASCII 文本文件,它里面存放着配置参数值。n有两种类型参数:l动态参数立即起效;l静态参数只有在服务器重新启动后才有效。nsp_configure能用于:l查看配置参数值;l修改配置参数值;l将配置参数值设置为缺省值。总总 结结2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-48总总 结结n可手工修改配置文件或者:l使用 sp_configure“configuration file”读入服务器。l服务器启动时指定文件。n有时使用多个配置文件好。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-49命令总结命令总结nsp_configurel显示配置参数值;l修改配置参数值;l将配置参数值设置为缺省值;l读取和确认配置文件。nsp_displaylevell显示或改变用户显示级别。nsp_helpconfigl显示配置参数的帮助信息。2006 Sybase,Inc.and its subsidiaries.All rights reserved.2-501.配置文件名是什么?2.为什么动态参数立即起效,而动态参数只有在服务器重新启动后才生效?3.给定服务器名为 SYBASE,SYBASE.bak 文件怎么会与文件SYBASE.001 不同?4.谁能使用 sp_configure 改变配置文件?5.sp_configure“configuration file”子命令是什么?6
展开阅读全文