Académique Documents
Professionnel Documents
Culture Documents
Page 1 of 9
Welcome to Sybase Hub! Excelent place to find the information about the Sybase Database. Learn
more about us
Sybase Guru
All about Sybase DB
Submit Query
Home
About
Contact Us
Links
Sitemap
Leave a Comment
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 2 of 9
Leave a Comment
Suffix
CODES
Code
IDENTIFIER
Id
INDICATOR/FLAG
Flag
AMOUNT
Amount
RATES
Rate
KEY
Key
Number
Number
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 3 of 9
Name
Name
Type
Type
Leave a Comment
Item
Standards/documentation
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
No.
Page 4 of 9
Item
Database objects names less than or equal to 30 characters
Stored procedures P<event type>_< procedure_name >.
Event Type:
Logic coverage
Programming logic:
correct (conforms to specifications)
Use transactions inside stored procedures and check the return status .
3.
Data reference
Variables initialized with proper datatype and size. Specify Null and
output,if required
No unused variables.
Define global variables for error checking and count.
Control flow
Condition for loop termination exists(while, if-else) .No abnormal exits.
Loops to have break/continue for exception handling.
Boundary conditions and value range covered
GOTO for looping purposes.
5.
Interface
Datatypes of parameters passed/ received are consistent
Lengths of parameters passed/received are correct
Return codes correct.
6.
7.
Others
Comments for understanding logic flow.
No unused functions/code.
Raise error messages, if any.
Leave a Comment
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 5 of 9
Running the script populates table #a and the transaction log at the same time, until tempdb is full.
Then the log gets automatically truncated by ASE, allowing for more rows to be inserted in the
table until tempdb is full again. This cycle repeats itself a number of times until tempdb is filled
up to the point that even the transaction log cannot be truncated anymore. At that point the ASE
errorlog will show messages like 1 task(s) are sleeping waiting for space to become available in
the log segment for database tempdb.
When you log on to ASE to resolve this problem and you run an sp_who, you will get Failed to
allocate disk space for a work table in database tempdb. You may be able to free up space by
using the DUMP TRANsaction command, or you may want to extend the size of the database by
using the ALTER DATABASE command..
Your first task is to kill off the process that causes the problem, but how can you know which
process to kill if you even cant run an sp_who? This problem can be solved with the lct_admin
function. In the format lct_admin(abort,0,) you can kill sessions that are waiting on a log
suspend. So you do a:
select @a = 1
while @a > 0
begin
insert into #a values(get full)
end
go
select lct_admin(abort,0,2) - 2 is dbid for tempdb.
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 6 of 9
When you execute the lct_admin function the session is killed but tempdb is still full. In fact its
so full that the table #a cannot be dropped because this action must also be logged in the
transaction log of tempdb. Besides a reboot of the server you would have no other option than to
increase tempdb with just a bit more space for the logsegment.
alter database tempdb log on <some_device> = <number of Mbs>
This extends tempdb and makes it possible to drop table #a and to truncate the transaction log.
In a real-life situation this scenario could cause significant problems for users.
Prevention of a full logsegment
One of the database options that can be set with the sp_dboption stored procedure can be used to
prevent this. When you do:
sp_dboption tempdb,abort tran on log full,true
(for pre 12.5.1: followed by a checkpoint in tempdb) the transaction that fills up the transaction
log in tempdb is automatically aborted by the server.
Default or system segments are full
The default or system segments in tempdb, where the actual data is stored, can also get full, just
like any ordinary database. Your query is cancelled with a Msg 1105 Cant allocate space for
object #a_____00000180017895422 in database tempdb because default segment is full/has
no free extents. If you ran out of space in syslogs, dump the transaction log. Otherwise, use
ALTER DATABASE or sp_extendsegment to increase size of the segment.
This message can be caused by a query that creates a large table in tempdb, or an internal
worktable created by ASE used for sorts, etc.
Potentially, this problem is much worse than a full transaction log since the transaction is
cancelled. A full log segment leads to sleeping processes until the problem is resolved.
However, a full data segment leads to aborted transactions.
Prevention of a full segment for data
The Resource Governor in ASE allows you to deal with these circumstances. You can specify just
how much space a session is allowed to consume within tempdb. When the space usage exceeds
the specified limit the session is given a warning or is killed. Before using this feature you must
configure ASE to use the Resource Governor:
sp_configure allow resource limits,1
After a reboot of the server (12.5.1. too) you can use limits:
sp_add_resource_limit petersap,null,at all times,tempdb_space,200
This limit means that the user petersap is allowed to use 200 pages within tempdb. When the limit
is exceeded the session receives an error message (Msg 11056) and the query is aborted. Different
options for sp_add_resource_limit make it possible to kill the session when the limit is exceeded.
Just how much pages a user should be allowed to use in tempdb depends on your environment.
Things like the size of tempdb, the number of concurrent users and the type of queries should be
taken into account when setting the resource limit. When a resource limit for tempdb is crossed it
is logged into the Sybase errorlog. This makes it possible to trace how often a limit is exceeded
and by who. With this information the resource limit can be tuned.
When you use multiple temporary databases the limit is enforced on all of these.
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 7 of 9
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 8 of 9
When you use this configuration you should know the recovery procedure just in case one of the
devices of tempdb gets corrupted or lost. Start your ASE in single user mode by adding the m
switch to the dataserver options. Then submit the following statements:
update master..sysusages set segmap = 7
where dbid = 2
and lstart = 0
go
delete master..sysusages
where dbid = 2
and lstart > 0
go
shutdown -- reboot now!
go
Remove the m switch from the dataserver options and restart ASE. Your tempdb is now available
with the default allocation on the master device.
Summary of the recommendations
Set the option abort tran on log full for tempdb to on
Create resource limits
Place data and log segments on separate devices
Place tempdb on filesystem with dsync set to false
Move tempdb off the master device by modifying the segmap attribute
Leave a Comment
Previous Page
next entries
Advertising
Categories
Standard of Sybase
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011
Page 9 of 9
Sybase
Meta
Log in
Valid XHTML
WordPress
http://sybaseguru.freetimelabs.com/page/2/
10-03-2011