Saturday, February 25, 2012

reporting..

Great,
So basically, in a small networked office setup I described,I will:
1> Install myapp on all 4 machines
2> Install MSDE on the centralserver A
3> Connection string will point to the machine A for datasource
But what about:
1> If I need to start the sqlserver service on clients machine, for e.g. to backup/restore database. How will I do it. Currently I use the following code to create the service controller and then start it if needed:
svc = New ServiceController("MSSQL$MyInstanceName)
What will I do when the service is on the central machine. How to start the service using the above code.
(See my clients will not have a dba and are assumed to not know that there is anything related to sql server on their machines, so we are providing the UI for backup/restore etc and the db functionality is kept as hidden as possible from them, this UI wil
l be in the tools on my vb.net app)
2> Will I need to run any network config utilities on the client machine. I know I will have to set disablenetworkprotocols to false on the server, but is there anything related to network access to be done on the client.
3> Andrea sometime back you mentioned something like, the location to backup should be from the MSDE machine's point of view.. so if PC1 wants to backup the db on it's D:\Backup drive, then what change will I have to do to this code below(which works fine
for a machine which has msde installed)
'--
cn = New SqlConnection(mMasterConnString)
cn.Open()
Dim cm As New SqlCommand
With cm
.Connection = cn
.CommandType = CommandType.Text
.CommandText = "BACKUP DATABASE " & mDBName & " TO DISK = '" & bkpFileWithPath & "' WITH NAME = My Backup', INIT"
.ExecuteNonQuery()
End With
'Note: bkpFileWithPath argument is: "D:\Backup\MyDB.bak"
'---
4> I guess I will take DMO slowly..
Thanks a lot guys.
dev
hi dev_kh,
"dev_kh" <devkh@.discussions.microsoft.com> ha scritto nel messaggio
news:FB209BF1-68B3-489C-A9E3-FD4CDDB6E87A@.microsoft.com...
> Great,
> So basically, in a small networked office setup I described,I will:
> 1> Install myapp on all 4 machines
> 2> Install MSDE on the centralserver A
> 3> Connection string will point to the machine A for datasource
yep =;-D

> But what about:
> 1> If I need to start the sqlserver service on clients machine, for e.g.
to
>backup/restore database. How will I do it. Currently I use the following
code to
>create the service controller and then start it if needed:
> svc = New ServiceController("MSSQL$MyInstanceName)
> What will I do when the service is on the central machine. How to start
the service
>using the above code.
usually the MSDE instance running on the remote server shoul'd be up and
running...
if you do have SQL-DMO [again =;-D ] you can try starting it, but the best
solution is making sure the MSDE instance starts at server startup...

> (See my clients will not have a dba and are assumed to not know that there
is
>anything related to sql server on their machines, so we are providing the
UI for
>backup/restore etc and the db functionality is kept as hidden as possible
from them,
>this UI will be in the tools on my vb.net app)
add a job script to make sure a dayly (?) backup operation is performed at
least..

> 2> Will I need to run any network config utilities on the client machine.
I know I will have
>to set disablenetworkprotocols to false on the server, but is there
anything related to network
>access to be done on the client.
usually not... but wait for WinXP sp2 and then he all will have a lot to do,
related to personal firewall settings =;-D ... and this is good, related to
secuirty concerns...

> 3> Andrea sometime back you mentioned something like, the location to
backup
>should be from the MSDE machine's point of view.. so if PC1 wants to backup
the
> db on it's D:\Backup drive, then what change will I have to do to this
code below(which
> works fine for a machine which has msde installed)
> '--
> cn = New SqlConnection(mMasterConnString)
> cn.Open()
> Dim cm As New SqlCommand
> With cm
> .Connection = cn
> .CommandType = CommandType.Text
> .CommandText = "BACKUP DATABASE " & mDBName & " TO DISK =
'" & bkpFileWithPath & "' WITH NAME = My Backup', INIT"
> .ExecuteNonQuery()
> End With
> 'Note: bkpFileWithPath argument is: "D:\Backup\MyDB.bak"
> '---
nothing...
>bkpFileWithPath argument is: "D:\Backup\MyDB.bak"
will actually point to server's file system... so the db wil be backed up on
server's d:\....

> 4> I guess I will take DMO slowly..
ROTFL
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Thanks Andrea,
you mentioned:
"usually the MSDE instance running on the remote server shoul'd be up and
running...
if you do have SQL-DMO [again =;-D ] you can try starting it, but the best
solution is making sure the MSDE instance starts at server startup"
Do you mean making sure that the MSDE is set to startup automatically.. but I want to use the Start Service if needed. So when my app starts I want to see if the service is running, if not I want to start it.
So, on my machine I was using the following line:
svc = New ServiceController("MSSQL$MyInstanceName)
but now when the service is on the central machine then will anything change in the above line of code? I mean will I have to add the server's name/path somewhere in the above line.. after all the service is on the server...
Hope my question is clear now..
Thanks a lot
dev
|||hi dev
"dev_kh" <devkh@.discussions.microsoft.com> ha scritto nel messaggio
news:CAF7632E-4D3E-4EF9-9B75-ADE8414C3632@.microsoft.com...[vbcol=seagreen]
> you mentioned:
best
> Do you mean making sure that the MSDE is set to startup automatically..
>but I want to use the Start Service if needed. So when my app starts I
want
> to see if the service is running, if not I want to start it.
> So, on my machine I was using the following line:
> svc = New ServiceController("MSSQL$MyInstanceName)
> but now when the service is on the central machine then will anything
change
>in the above line of code? I mean will I have to add the server's
name/path
>somewhere in the above line.. after all the service is on the server...
> Hope my question is clear now..
if you are using WMI, you will actually invoke SQL-DMO behind the scenes, so
just directly rely on DMO...
so you have to try a connection, possiblyy with low timeout in order not to
wait to much, and eventaully start the server if needed...
but, again, you shoul'd rely on autostart service method whenever
possible...
make it simple =;-D
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||You said "if you are using WMI, you will actually invoke SQL-DMO behind the scenes, so just directly rely on DMO... so you have to try a connection, possiblyy with low timeout in order not to wait to much, and eventaully start the server if needed... but,
again, you shoul'd rely on autostart service method whenever
possible... make it simple =;-D"
But this code works fine without wmi or dmo on my machine which has msde.. and if I don't want to use dmo, just simply start the service on the server from the client's machine.. then will I need to add some server name etc on this line of code...
thanks
dev

No comments:

Post a Comment