Showing posts with label avoid. Show all posts
Showing posts with label avoid. Show all posts

Friday, March 23, 2012

How can I pre-allocate file size of TempDB in SQL 2000?

Hello:
We reboot our production server on Mondays. I would like to pre-allocate
(set original) file size for TempDB to a reasonable size to avoid frequent
expand of this DB. How can I achieve that? I couldn't find any setting in
the Enterprise Manager to allow me to pre-allocate file size of TempDB.
What SQL command will I use then?
Thank you in advance for your help.
Chai
Chai,
See "alter database" in BOL.
AMB
"Chai" wrote:

> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting in
> the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>
>
|||Hi Chai
You can use ALTER DATABASE, similar to the following:
alter database tempdb
modify file
( NAME = tempdev,
SIZE = 10 MB)
You can run sp_helpdb to verify the name of the data file for tempdb, the
default is tempdev. You might also want to change the initial log size.
Note that you cannot set a file size with ALTER that is smaller than the
current size. So if you want the new size to be smaller that it is
currently, you will have to restart one more time and issue the alter before
tempdb gets too big.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Chai" <chai@.trs.state.il.us> wrote in message
news:uXt%238gAjHHA.208@.TK2MSFTNGP05.phx.gbl...
> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting
> in the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>
sql

How can I pre-allocate file size of TempDB in SQL 2000?

Hello:
We reboot our production server on Mondays. I would like to pre-allocate
(set original) file size for TempDB to a reasonable size to avoid frequent
expand of this DB. How can I achieve that? I couldn't find any setting in
the Enterprise Manager to allow me to pre-allocate file size of TempDB.
What SQL command will I use then?
Thank you in advance for your help.
ChaiChai,
See "alter database" in BOL.
AMB
"Chai" wrote:

> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting i
n
> the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>
>|||Hi Chai
You can use ALTER DATABASE, similar to the following:
alter database tempdb
modify file
( NAME = tempdev,
SIZE = 10 MB)
You can run sp_helpdb to verify the name of the data file for tempdb, the
default is tempdev. You might also want to change the initial log size.
Note that you cannot set a file size with ALTER that is smaller than the
current size. So if you want the new size to be smaller that it is
currently, you will have to restart one more time and issue the alter before
tempdb gets too big.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Chai" <chai@.trs.state.il.us> wrote in message
news:uXt%238gAjHHA.208@.TK2MSFTNGP05.phx.gbl...
> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting
> in the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>

How can I pre-allocate file size of TempDB in SQL 2000?

Hello:
We reboot our production server on Mondays. I would like to pre-allocate
(set original) file size for TempDB to a reasonable size to avoid frequent
expand of this DB. How can I achieve that? I couldn't find any setting in
the Enterprise Manager to allow me to pre-allocate file size of TempDB.
What SQL command will I use then?
Thank you in advance for your help.
ChaiChai,
See "alter database" in BOL.
AMB
"Chai" wrote:
> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting in
> the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>
>|||Hi Chai
You can use ALTER DATABASE, similar to the following:
alter database tempdb
modify file
( NAME = tempdev,
SIZE = 10 MB)
You can run sp_helpdb to verify the name of the data file for tempdb, the
default is tempdev. You might also want to change the initial log size.
Note that you cannot set a file size with ALTER that is smaller than the
current size. So if you want the new size to be smaller that it is
currently, you will have to restart one more time and issue the alter before
tempdb gets too big.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Chai" <chai@.trs.state.il.us> wrote in message
news:uXt%238gAjHHA.208@.TK2MSFTNGP05.phx.gbl...
> Hello:
> We reboot our production server on Mondays. I would like to pre-allocate
> (set original) file size for TempDB to a reasonable size to avoid frequent
> expand of this DB. How can I achieve that? I couldn't find any setting
> in the Enterprise Manager to allow me to pre-allocate file size of TempDB.
> What SQL command will I use then?
> Thank you in advance for your help.
>
> Chai
>

Monday, March 19, 2012

How can i lock a record

hi all iam working on a ticketing application i want to avoid two users to book the same ticket the requirement is as follows

1. the system should show all the available tickets which is not yet booked

2.when two users book the ticket at the same time time it should not allow the two persons to update at the same tme

the main aim is to avoid data concurency

how can i get this done

Use a flag or the best is to use time-stamps?

|||

Hi,

From your description, it seems that your problem is related to SQL concurrency issue.
Suppose each ticket is saved in your data table. For your first requirement, it can be achieved by using a flag which indicates if the ticket has been booked or not.
For your second requirement, since ADO.NET uses Optimistic Concurrency. Then locks are set and held only while the database is being accessed. The locks prevent other users from attempting to update records at the same instant. The data is always available except for the exact moment that an update is taking place.

In Optimistic Concurrency, there are two general ways to determine if changes have occurred: the version approach (true version numbers or date-time stamps) and the saving all values approach.

i.e. For Version Number approach, the record to be updated must have a column that contains a date-time stamp or version number. The date-time stamp or a version number is saved on the client when the record is read. This value is then made part of the update.

For more information, seehttp://msdn2.microsoft.com/en-us/library/cs6hb8k4(VS.71).aspx

Thanks!