[sql server 2005] lentezza apertura connessione

mercoledì 09 gennaio 2008 - 13.47

escaflowne Profilo | Junior Member

Ciao a tutti,
il programma che ho fatto (vb.net 2005) ci mette troppo (secondo me) a partire perchè il server su cui risiede il db (sql server) ci mette abbastanza a rispondere (solo alla prima connessione, poi tutto procede abbastanza velocemente).
Per velocizzare la connessione, non ci ho ancora studiato a fondo ma, secondo voi, come posso fare?
Avevo pensato, su due piedi, ad un servizio da far partire all'avvio dei client che impostasse la connessione ma poi, tale connessione, la posso richiamare dal programma?

Grazie

lbenaglia Profilo | Guru

>il programma che ho fatto (vb.net 2005) ci mette troppo (secondo
>me) a partire perchè il server su cui risiede il db (sql server)
>ci mette abbastanza a rispondere (solo alla prima connessione,
>poi tutto procede abbastanza velocemente).

Verifica che il database non sia impostato in autoclose.
Se utilizzi SQL Server 2005 seleziona il db in SSMS, tasto DX, Properties..., Options, e verifica che Auto Close sia a False.

>Grazie
Prego.

Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
http://italy.mvps.org

escaflowne Profilo | Junior Member

in effetti autoclose è su true.
Incide tanto?
Un eventuale servizio allora, non chiudendosi se setto a false (giusto?) la connessione, non servirebbe a niente?

Intanto grazie mille!!!

lbenaglia Profilo | Guru

>in effetti autoclose è su true.
>Incide tanto?
Si, allungando i tempi di connessione dato che il database deve essere rimesso online prima che qualcuno possa accedervi.
Se Autoclose = True, SQL Server "chiuderà" automaticamente il database dopo un certo tempo di inutilizzo.
Dai BOL:

AUTO_CLOSE { ON | OFF }
ON
The database is shut down cleanly and its resources are freed after the last user exits.

The database automatically reopens when a user tries to use the database again. For example, by issuing a USE database_name statement. If the database is shut down cleanly while AUTO_CLOSE is set to ON, the database is not reopened until a user tries to use the database the next time the Database Engine is restarted.

OFF
The database remains open after the last user exits.

The AUTO_CLOSE option is useful for desktop databases because it allows for database files to be managed as regular files. They can be moved, copied to make backups, or even e-mailed to other users.

Note:
In earlier versions of SQL Server, AUTO_CLOSE is a synchronous process that can degrade performance when the database is accessed by an application that repeatedly makes and breaks connections to the Database Engine. In SQL Server 2005, the AUTO_CLOSE process is asynchronous; repeatedly opening and closing the database no longer reduces performance.

>Un eventuale servizio allora, non chiudendosi se setto a false
>(giusto?) la connessione, non servirebbe a niente?
E' una configurazione a livello di database che entra in gioco quando non ci sono più connessioni attive per un certo periodo di tempo, quindi risulta indipendente dalle applicazioni client che vi accedono.

>Intanto grazie mille!!!
Prego.

Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo/
http://italy.mvps.org
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5