Showing posts with label via. Show all posts
Showing posts with label via. Show all posts

Friday, March 30, 2012

long time to establish a connection

When I login using QA to my SQL Server database, it takes 15-20 seconds
to establish a connection and open a query window. Drilling into a
database via Enterprise Manager is similar. Once the connection is
established, the server runs plenty fast however.

Can someone tell me why it could take a long time for a connection to
be established?

This behavior occurs when I am local on the box.

Thanks,
John(john.livermore@.inginix.com) writes:
> When I login using QA to my SQL Server database, it takes 15-20 seconds
> to establish a connection and open a query window. Drilling into a
> database via Enterprise Manager is similar. Once the connection is
> established, the server runs plenty fast however.
> Can someone tell me why it could take a long time for a connection to
> be established?
> This behavior occurs when I am local on the box.

One thing to check for is the autoclose on databases. You should be
able to investigate this with sp_helpdb.

Another thing that I have seen is that if I have a QA window open, stop
SQL Server and restart, connections after this takes a long time. Apparently
something is happening to shared memory. Needless to say, these problems
goes away after a reboot.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 21, 2012

logshipping

Hi,
I'll take FULL and transaction LOG backups via a custom written stored
procedure.
But its working only for single database file. Does not dynamically pick up
database files/filegroups from the backup files themselves.
Is it possible to take backup of database contain files/filegroups?
I used this code in stored procedure:
BACKUP DATABASE @.db_name TO @.vbackupdevice
WITH INIT, NAME=@.db_name, NOSKIP, STATS=10, DESCRIPTION=@.v_filename, NOFORMAT
Any help will be appreciated.
Kind Regards,
Melih.Yea maan, i think its very impressive,
bu i am away this technical issues for 3 months,
sorry maan.
I hope you will find more usefull solution technics..
Cihan.
"Melih" wrote:
> Hi,
> I'll take FULL and transaction LOG backups via a custom written stored
> procedure.
> But its working only for single database file. Does not dynamically pick up
> database files/filegroups from the backup files themselves.
> Is it possible to take backup of database contain files/filegroups?
> I used this code in stored procedure:
> BACKUP DATABASE @.db_name TO @.vbackupdevice
> WITH INIT, NAME=@.db_name, NOSKIP, STATS=10, DESCRIPTION=@.v_filename, NOFORMAT
>
> Any help will be appreciated.
> Kind Regards,
> Melih.
>|||Melih,
Your backup is probably working... Even when the database contains multiple
files, from one or more filegroups the backup file (given your command) will
contain all of this in a single backup file..
Do a small test , backup, then restore a multi-file database as a different
name. This should show you that things are working fine.
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.
"Melih" wrote:
> Hi,
> I'll take FULL and transaction LOG backups via a custom written stored
> procedure.
> But its working only for single database file. Does not dynamically pick up
> database files/filegroups from the backup files themselves.
> Is it possible to take backup of database contain files/filegroups?
> I used this code in stored procedure:
> BACKUP DATABASE @.db_name TO @.vbackupdevice
> WITH INIT, NAME=@.db_name, NOSKIP, STATS=10, DESCRIPTION=@.v_filename, NOFORMAT
>
> Any help will be appreciated.
> Kind Regards,
> Melih.
>|||I tested and get result:
Database 'Exchange' does not exist. Check sysdatabases.
ALTER DATABASE statement failed.
Device activation error. The physical file name 'C:\DATABASES
SQL2K\Exchange_Data2_Data.NDF' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'Exchange_Data2' cannot be restored to 'C:\DATABASES
SQL2K\Exchange_Data2_Data.NDF'. Use WITH MOVE to identify a valid location
for the file.
Server: Msg 5105, Level 16, State 1, Line 1
Device activation error. The physical file name 'C:\DATABASES
SQL2K\Exchange_Data3_Data.NDF' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'Exchange_Data3' cannot be restored to 'C:\DATABASES
SQL2K\Exchange_Data3_Data.NDF'. Use WITH MOVE to identify a valid location
for the file.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I used this code in stored procedure:
set @.found_full = 0
if @.@.fetch_status = 0 and @.found_full = 0
begin
set @.sqlstring = 'alter database ' + @.dbname + ' set RESTRICTED_USER with
rollback immediate'
exec (@.sqlstring)
set @.sqlstring = 'alter database ' + @.dbname + ' set MULTI_USER with
rollback immediate'
exec (@.sqlstring)
-- check file isnt zipped, if so decompress & restore
if charindex('.gz', @.restore_filename) > 0 or charindex('.zip',
@.restore_filename) > 0
begin
SELECT @.sqlstring = @.zippath + '\gzip.exe -d ' + @.backuppath +
@.restore_filename
EXEC @.error = master..xp_cmdshell @.sqlstring, NO_OUTPUT
set @.restore_filename = replace(@.restore_filename, '.gz', '')
set @.restore_filename = replace(@.restore_filename, '.zip', '')
end
--set @.sqlstring = 'alter database ' + @.dbname + ' set RESTRICTED_USER
with rollback immediate'
--exec (@.sqlstring)
set @.sqlstring = 'RESTORE DATABASE ' + @.dbname + ' ' +
'FROM DISK= ''' + @.backuppath + @.restore_filename + ''' ' +
'WITH ' + @.fullbackupmovecommand + ' , STANDBY = ''' + @.standbyfile + ''''
exec (@.sqlstring)
etc......

Monday, February 20, 2012

Login permisions

Hi!
I've just moved a mdb to MSDE without problem. The problem comes when I try
to open the tables I have attached via ODBC. Tables are in MSDE and I call
them from Access.
I get an error telling me that the user is not allowed to read (error
18456). Following that message, I get a login screen. If I enter the sa user
password it connects and allows me to see the table contents.
I use MSDE Manager to manage the server, but any other option is welcomed if
I should have more control over it.
What I would like to do is that no password is asked when the users run the
Access database.
Thanks in advance.
Xavier Boneu
hi Xavier,
Xavier Boneu wrote:
> Hi!
> I've just moved a mdb to MSDE without problem. The problem comes when
> I try to open the tables I have attached via ODBC. Tables are in MSDE
> and I call them from Access.
> I get an error telling me that the user is not allowed to read (error
> 18456). Following that message, I get a login screen. If I enter the
> sa user password it connects and allows me to see the table contents.
> I use MSDE Manager to manage the server, but any other option is
> welcomed if I should have more control over it.
> What I would like to do is that no password is asked when the users
> run the Access database.
> Thanks in advance.
you have then to specify, in the ODBC management console, to use integrated
security... you have then to manage your Windows account to grant them
access to the MSDE instance, using sp_grantlogin system stored procedure (
http://msdn.microsoft.com/library/de...ga-gz_8dri.asp )
and grant each login, or WinNT group (if you can manage them at group level
instead of single account level you will gain some freedom) access to each
desired database via sp_grantdbaccess system stored procedure (
http://msdn.microsoft.com/library/de...ga-gz_290z.asp )
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Hi!
Thanks for your info. I'll try it and post back the results.
Xavier Boneu
"Andrea Montanari" wrote:

> hi Xavier,
> Xavier Boneu wrote:
> you have then to specify, in the ODBC management console, to use integrated
> security... you have then to manage your Windows account to grant them
> access to the MSDE instance, using sp_grantlogin system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_8dri.asp )
> and grant each login, or WinNT group (if you can manage them at group level
> instead of single account level you will gain some freedom) access to each
> desired database via sp_grantdbaccess system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_290z.asp )
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
>
|||Andrea,
I am trying what you suggest but it works only partialy.
I've issued the sp_grantlogin and sp_grantdbaccess but when I try to execute
a query from a client computer I get an error saying I have no permission to
SELECT the object 'mytable', database 'mydtabase' , owner 'dbo'. (#229)
What I wrote was:
EXEC sp_grantlogin 'companyname\username'
EXEC sp_grantdbaccess 'companyname\username'
but something is still missing...
Could you give me a hand with this error?
Thank you.
Xavier
Xavier Boneu
"Andrea Montanari" wrote:

> hi Xavier,
> Xavier Boneu wrote:
> you have then to specify, in the ODBC management console, to use integrated
> security... you have then to manage your Windows account to grant them
> access to the MSDE instance, using sp_grantlogin system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_8dri.asp )
> and grant each login, or WinNT group (if you can manage them at group level
> instead of single account level you will gain some freedom) access to each
> desired database via sp_grantdbaccess system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_290z.asp )
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
>
|||Andrea,
I am trying what you suggest but it works only partialy.
I've issued the sp_grantlogin and sp_grantdbaccess but when I try to execute
a query from a client computer I get an error saying I have no permission to
SELECT the object 'mytable', database 'mydtabase' , owner 'dbo'. (#229)
What I wrote was:
EXEC sp_grantlogin 'companyname\username'
EXEC sp_grantdbaccess 'companyname\username'
but something is still missing...
Could you give me a hand with this error?
Thank you.
Xavier
Xavier Boneu
"Andrea Montanari" wrote:

> hi Xavier,
> Xavier Boneu wrote:
> you have then to specify, in the ODBC management console, to use integrated
> security... you have then to manage your Windows account to grant them
> access to the MSDE instance, using sp_grantlogin system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_8dri.asp )
> and grant each login, or WinNT group (if you can manage them at group level
> instead of single account level you will gain some freedom) access to each
> desired database via sp_grantdbaccess system stored procedure (
> http://msdn.microsoft.com/library/de...ga-gz_290z.asp )
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
>
|||hi Xavier,
Xavier Boneu wrote:
> Andrea,
> I am trying what you suggest but it works only partialy.
> I've issued the sp_grantlogin and sp_grantdbaccess but when I try to
> execute a query from a client computer I get an error saying I have
> no permission to SELECT the object 'mytable', database 'mydtabase' ,
> owner 'dbo'. (#229)
the security goes on :D
as you add a database user to your preferred database, he/she will only be
member of the Public database role, and usually that role has no kind of
access to object's data...
you can so grant the desired permission (SELECT/INSERT/UPDATE/DELETE) to the
Public database role (not recommended at all) or make him/her member of
specific builtin (or user defined) database role(s) [
http://msdn.microsoft.com/library/de..._addp_4boy.asp ,
http://msdn.microsoft.com/library/de..._addp_33s5.asp ]
...
that's to say you can make him/her member of the default db_datareader role
to permit only data browsing, eventually db_datawriter to allow data
modification, or grant him/her only specific privilegs on specific tables...
usually you make him/her member of custom db roles granting only EXEC
privileges to defined stored procedures for data retrevial/modification, and
/or SELECT/INSERT/UPDATE/DELETE privileges on user define views as it's not
a best practice to allow direct access to base table (please have a look at
http://msdn.microsoft.com/library/de...ga-gz_8odw.asp)
you can start reading at
http://www.microsoft.com/technet/pro...sp3sec00.mspx,
http://www.developer.com/tech/article.php/721441
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Andrea,
Thanks for your help. By now, I have granted db_datareader and db_datawriter
permisions to all the users. This way they can work and now, with more time,
I will read the information you have suggested and 'study' to manage MSDE
better.
Thanks a lot!!!
Xavier Boneu
"Andrea Montanari" wrote:

> hi Xavier,
> Xavier Boneu wrote:
> the security goes on :D
> as you add a database user to your preferred database, he/she will only be
> member of the Public database role, and usually that role has no kind of
> access to object's data...
> you can so grant the desired permission (SELECT/INSERT/UPDATE/DELETE) to the
> Public database role (not recommended at all) or make him/her member of
> specific builtin (or user defined) database role(s) [
> http://msdn.microsoft.com/library/de..._addp_4boy.asp ,
> http://msdn.microsoft.com/library/de..._addp_33s5.asp ]
> ...
> that's to say you can make him/her member of the default db_datareader role
> to permit only data browsing, eventually db_datawriter to allow data
> modification, or grant him/her only specific privilegs on specific tables...
> usually you make him/her member of custom db roles granting only EXEC
> privileges to defined stored procedures for data retrevial/modification, and
> /or SELECT/INSERT/UPDATE/DELETE privileges on user define views as it's not
> a best practice to allow direct access to base table (please have a look at
> http://msdn.microsoft.com/library/de...ga-gz_8odw.asp)
> you can start reading at
> http://www.microsoft.com/technet/pro...sp3sec00.mspx,
> http://www.developer.com/tech/article.php/721441
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.11.1 - DbaMgr ver 0.57.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
>