Вы находитесь на странице: 1из 11

http://www.rocket99.com/techref/sybase8634.

html

Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
logins
Sybase : Administration
Sybase : Administration
Sybase : Administration
Settings
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Disk Space
Sybase : Administration
Sybase : Administration
objects
Sybase : Administration
sysprotects
Sybase : Administration
login
Sybase : Administration
Remote Server
Sybase : Administration
device
Sybase : Administration
Sybase : Administration
Transaction Log Marker
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
Sybase : Administration
bit ASE

:
:
:
:
:
:

A backup routine
Adding a segment to a database
Apply a transaction dump
Apply multiple transaction dumps
Configuring the cache
Create proxy tables and external

: DBCC Notes
: Database Creation
: Database Engines: Status and
:
:
:
:
:
:

Database maintenance procedure


Database maintenance script
Dealing with a Corrupted Database
Dealing with a Server Failure
Device initialization
Display Available Device Space - Free

: Display Locks on Tables


: Display grants, effective rights to
: Displaying access information from
: Drop an alias, with objects linked to
: Loading data into Sybase IQ from a
: Moving the transaction log to another
: Post-installation check
: Removing the Replication Marker or
:
:
:
:
:

Renaming a database
Reorg: rebuilding a table
Replication Server 15 Configuration
Security Tasks
Server Configuration: example for 64

Sybase : Administration : Server configuration


Sybase : Administration : Setting Process Priorities
Sybase : Administration : Setting the thresholds
Sybase : Administration : Show Users / Logins with Access to
the Database
Sybase : Administration : Striping Dump Devices
Sybase : Administration : Sybase ASE 15 Enhancements
Sybase : Administration : Sybase ASE Architecture Overview
Sybase : Administration : Sybase IQ - Remote Access From ASE
Sybase : Administration : Sybase IQ Functions
Sybase : Administration : Sybase IQ Overview
Sybase : Administration : Transaction Log Checking: Wait Until
It Clears
Sybase : Administration : Transaction Log Filled Up - Log
Suspended : What To Do
Sybase : DDL : Alter a column
Sybase : DDL : Altering a table
Sybase : DDL : Binding Rules to Colunms
Sybase : DDL : Clustered vs non-clustered indexes
Sybase : DDL : Creating a constraint
Sybase : DDL : Creating a proxy table
Sybase : DDL : Creating a table
Sybase : DDL : Creating an index
Sybase : DDL : Modifying a Colunm
Sybase : DDL : Moving an object to another segment
Sybase : DDL : Object Permissions
Sybase : DDL : Sybase data types
Sybase : DDL : Table Partitioning
Sybase : DDL : Tables which span multiple segments
Sybase : Monitoring : Listing object names and attributes
Sybase : T-SQL : ASE 15 Hints: Query Plan Optimization
Sybase : T-SQL : Aborting a T-SQL script
Sybase : T-SQL : Detecting What Your tempdb Is
Sybase : T-SQL : Executing dynamic SQL in a procedure
Sybase : T-SQL : Functions in Sybase IQ
Sybase : T-SQL : N-Tile Analytic Queries
Sybase : T-SQL : Sybase IQ - Lead / Lag Functions
Sybase : T-SQL : Sybase IQ - Showing Multiple Result Sets
Sybase : Transact-SQL : Case Statement

Sybase : Transact-SQL : Creating a stored procedure


Sybase : Transact-SQL : Custom query plans
Sybase : Transact-SQL : Date processing: stripping time from
datetime
Sybase : Transact-SQL : Forcing an index in a query
Sybase : Transact-SQL : Getting the size of a blob or image
Sybase : Transact-SQL : Inner/Outer Joins
Sybase : Transact-SQL : Isolation Levels
Sybase : Transact-SQL : Lead and Lag with pure SQL
Sybase : Transact-SQL : Median Calculation, with pure SQL
Sybase : Transact-SQL : Ranking Data - with Duplicates
Sybase : Transact-SQL : Reporting: SQL Performance and
Tuning
Sybase : Transact-SQL : Returning Multiple Result Sets in
Sybase IQ
Sybase : Transact-SQL : Rowcount setting - limiting result sets
Sybase : Transact-SQL : Safely delete a large number of rows
without blowing the t-log
Sybase : Transact-SQL : Self-Joins in SQL
Sybase : Transact-SQL : Transact SQL: Complex Updates
Sybase : Transact-SQL : Transact SQL: Conditionals
Sybase : Transact-SQL : Transact SQL: Cursors
Sybase : Transact-SQL : Transact SQL: Finding duplicate rows in
a table
Sybase : Transact-SQL : Transact SQL: date/time formats
Sybase : Transact-SQL : Transact SQL: date/time functions
Sybase : Transact-SQL : Transact SQL: looping constructs
Sybase : Transact-SQL : Transact SQL: misc functions
Sybase : Transact-SQL : Transact SQL: numeric functions
Sybase : Transact-SQL : Transact SQL: string functions
Sybase : Transact-SQL : Using Temporary Tables
Sybase : UNIX : BCP data to/from a flat file
Sybase : UNIX : Interface Files, IP and Port Translation
Sybase : UNIX : Running SQL within a script
Sybase : UNIX : Shared memory setting
Sybase : UNIX : Starting the Sybase process

Sybase Administration DBA

Reorg: rebuilding a table


Para las tablas de activos en sistemas OLTP, es necesario a veces para
ejecutar una reorg para asegurar la cadenas de pginas y los ndices se
han optimizado, y el espacio no asignado se freeed.
1>reorgrebuildaccount_sales
2>go
BeginningREORGREBUILDof'account_sales'.
Thereareapproximately15pagestobeprocessed.
Nonclusteredindex(indexid=2)isbeingrebuilt.
REORGREBUILDof'account_sales'completed.
Post-installation check
Posterior a la instalacin de verificacin
No deje master como el device predeterminado, base de datos creada
sin un dispositivo de especificacin se cre en el master.
1>sp_diskdefaultmaster,defaultoff
2>go
(returnstatus=0)
1>sp_diskdefaultdevice26,defaulton
2>go
Comprobacin memory check
dbcctraceon(3604)
go
dbccmemusage
go
dbcctraceoff(3604)
go
/*samplepostinstallconfig,for12.5ASE*/
Muestra posterior a la instalacin de configuracin, el 12,5 ASE
sendresults,nowait(enviarlosresultados,noespere)
sp_configure'tcpnodelay',1
go

allocate1.2gbtosybase(asignar1,2gbdesybase)
sp_configure'maxmemory',600000
go

allocateatsybaseboottime(asignarenelarranque
sybase)
sp_configure'locksharedmemory',1
go
additionaldatacache(cachdedatosadicional)
sp_cacheconfig'defaultdatacache','600M'
go
additionalprocedurecache(cachdeprocedimientos
adicionales)
sp_cacheconfig'procedurecache','50M'
go
cachefortempdb(cacheparatempdb)
sp_cacheconfig'cache01','80M'
go
Additionalconfig,forserverw/severalCPUs
Configadicional,paraelservidorw/variasCPUs
sp_configure"numberofuserconnections",500
go
sp_configure"numberofworkerprocesses",100
go
sp_configure"maxparalleldegree",3
go
sp_configure"maxscanparalleldegree",3
go
sp_configure"globalcachepartitionnumber",2
go
sp_configure"numberoflocks",50000
go
sp_configure"numberofopenobjects",50000
go
sp_configure"numberofopendatabases",32
go
sp_configure"numberofdevices",50
go
/*rebootASE*/

Additionalconfig,forsystemusingtext/blobdata

sp_configure'additionalnetworkmemory',4096
go
sp_configure'maxnetworkpacketsize',2048
go
sp_configure'defaultnetworkpacketsize',1024
go
sp_configure'heapmemoryperuser',4096
go

/*
UNIXSybase>=11.9,allowdevicebufferinginO/S;
improvesperformance
increaseschanceofdevicecorruptionduringfailure
*/
sp_deviceattr"device21","dsync","false"
go

/*LINUX:mayneedtosetsharedmemory*/
echo134217728>/proc/sys/kernel/shmmax
echo999999999>/proc/sys/kernel/shmmax

Extend tempdb:
size should be about 20% of the main production database's size.
Extender tempdb:
Tamao debe ser aproximadamente 20% del tamao de la base de
datos de produccin principal.
/*configuretempdbto20mb...thiscommandaddsan
additional
18megtothe2mbalreadypresentonthemasterdevice*/
1>alterdatabasetempdbondevice26=18
2>go

/*Addlocalservername*/
sp_addserversnoopy,local
go
Device initialization
/*createa2gigdevice*/
1>diskinitname='device19',
2>physname='/dev/md/rdsk/d19',
3>vdevno=6,
4>size=1024000
5>go
Database Creation
/*createa1gigdatabase,witha50mbtransactionlog
*/
/*forloadclauseallowsquickcreationwhendumpis
available*/
1>createdatabase
2>dbname
3>ondevice18=1000
4>logondevice8=50
5>forload
6>go
CREATEDATABASE:allocating512000pagesondisk
'device18'
CREATEDATABASE:allocating25600pagesondisk
'device8'
/*changethedatabaseowner*/
usedbname
go
1>sp_changedbowner'jmith'
2>go
/*setupautomaticlogtruncate,fordevelopmentmode
*/
usemaster
go
sp_dboption'dbname','trunclogonchkpt',true
go

A backup routine
usemaster
go
sp_dboptiondbname,"singleuser",true
go
usedbname
go
checkpoint
go
dbcccheckdb(dname,skip_ncindex)
go
dbcccheckcatalog
go
dbcccheckalloc
go
usemaster
go
sp_dboptiondbname,"singleuser",false
go
usedbname
go
checkpoint
go
dumptrandbnametodevice1
go
dumpdatabasedbnametodevice1
go
Striping Dump Devices (Reparticin de dispositivos de
volcado)
Sybase (prior to version 12) has a 2 GB dump file size
limitation for most platforms. Getting around this is easy simply stripe the dumps across multiple files or devices. The
examples below use file names instead of device names.
Sybase (anterior a la versin 12) tiene un volcado de 2 GB
archivo de limitacin de tamao para la mayora de las
plataformas. Moverse es fcil - simplemente raya los
vertederos en varios archivos o dispositivos. Los ejemplos
siguientes utilizan nombres de archivos en lugar de nombres

de dispositivos.

dumpdatabasehr_dbto
'/usr2/dumps/remote/db_hr05121318.dmp'
stripeon'/usr2/dumps/remote/db_hr_S1_05121318.dmp'
stripeon'/usr2/dumps/remote/db_hr_S2_05121318.dmp'
go

loaddatabasehr_dbfrom
'/usr2/dumps/remote/db_hr05121318.dmp'
stripeon'/usr2/dumps/remote/db_hr_S1_05121318.dmp'
stripeon'/usr2/dumps/remote/db_hr_S2_05121318.dmp'
go
onlinedatabasehr_db
go
Moving the transaction log to another device

1>alterdatabasedbnamelogondevice19=10
1>sp_logdevicedbname,device19
Thelastchancethresholdfordatabasedbnameisnow
1232pages.
...sqlinserts,tofilloldlogsegment...
1>dumptrandbnamewithtruncate_only
1>sp_helplogdbname
2>go
Indatabase'dbname',thelogstartsondevice
'device19'.
(returnstatus=0)
1>
Adding a segment to a database
1>usedbname
2>go
1>sp_addsegment'idx_seg1','dbname','device18'
2>go
DBCCexecutioncompleted.IfDBCCprintederror
messages,contactauserwith

SystemAdministrator(SA)role.
Segmentcreated.
1>usedbname
2>go
1>sp_dropsegment'system','dbname','device18'
2>go
DBCCexecutioncompleted.IfDBCCprintederror
messages,contactauserwith
SystemAdministrator(SA)role.
Segmentreferencetodevicedropped.
(returnstatus=0)
1>sp_dropsegment'default','dbname','device18'
2>go
DBCCexecutioncompleted.IfDBCCprintederror
messages,contactauserwith
SystemAdministrator(SA)role.
Segmentreferencetodevicedropped.
(returnstatus=0)
Configuring the cache
Important: for ASE 12.5, the default data cache MUST be
configured !
usemaster
go
sp_cacheconfig'cache01','4M'
go
Entry in config file looks like this:
[NamedCache:dev_cache1]
cachesize=4M
cachestatus=mixedcache
Next, database objects need to be bound to the cache
usedev_main_db
go
sp_bindcache'dev_cache01','dev_main_db','customer'
go
sp_helpcache
go

/*seesamplepostinstallconfigaboveformore
examples*/