I have SQL Server Express on my laptop. I only need to hit it every few weeks. Running SQL Server sucks up a fair bit of memory on my laptop so I was wondering what is the easiest way to turn off SQL Server when not using it?
What I have done thus far is to create two batch files on my desktop. One brings SQL Server up with this command:
net start "sql server (sqlexpress)"
and the other takes it down with this:
net stop "sql server (sqlexpress)"
Is there a more elegant way to do this? Maybe a tool try app or something other than batch files?
The old SQL 2000 system tray service manager actually works with any service (just configure the service name). There is also a codeplex project for a 2005 replacement: http://www.codeplex.com/SQL2005SrvcMngr/
I would move your shortcuts into your Quicklaunch bar :)
Or you could even use a tool like launchy to easily run the shortcuts.
Have you thought about installing SQL Server onto a virtual machine? That way SQL Server doesn't need to be installed on your system and anytime you need it you just fire up the VM.
Thanks to the prompting from some of the answered here, the best I have found is Windows Service Manager Tray because it also allows me to start and stop other services, not just SQL Server. it lives in the tray and is easy to config/use.
Thanks Remus Rusanu for pointing me toward the idea of a general service manager. I had been thinking only about something SQL Server specific.
I have actually written my own system tray app that reads a folder for short cuts or batch files. It gives me very quick access to my scripts.
You could also create a start menu option and/or use something like Launchy to quickly run you scripts.
Control Panel>Administrative Tools>Services
Find MSSQL service and disable it or put it to start on manual request.
I guess I can't see what could be easier than clicking to start a batch file or clicking a button in the service manager sys tray app.
Related
I have imported data to SQL Server Express from MS Access and have tried to link to the data from an Access front end file.
I have tried several different login types, but each gives me the same error:
Error Locating Server/Instance Specified
Please help.
Assuming a local instance of SQL server?
The default is usually YOURCOMPUTERNAME\SQLEXPRESS.
But, you can use a "." (dot) in place of your computer name.
So, the server name should be .\SQLEXPRESS
A few things:
When you setup and attempt to connect? Always create a FILE dsn. The reasons for this are many, but one really nice reason is that then Access will by default create a DSN-LESS connection. This approach is preferred since then Access remembers the settings, and no external settings (such as registry or even a file (dsn) is used or required. And if you connect to a SQL server on your network? Well then you can distribute the access application to each workstation, and it will "just work" - all without you having to setup a DSN or do anything with the ODBC manager on each station. So, a great tip and habit. So, use a FILE dsn (and if you follow the default prompts when linking tables, a FILE dsn is the default anyway).
Next up:
Make sure the sql server browser service is running. In the past this was often not required, but now it is recommended. That service is this:
Once you sure that service is running?
Make sure that you enabled named Pipes - in fact I would also enable TCP/IP. That is found here:
Ok, now the next question:
Are you using SQL server logons, or Windows authentication?
For now since this is your local stand alone machine? lets go with windows.
As noted, if you have SSMS installed, then see if it can connect. This not only is a quick + easy fast test but it will also tend to give you the hints as to what the server name connect is. (this helps you when you attempt to connect with Access - you can see what worked with SSMS - and better is SSMS does usually figure out the correct computer name for you.
So, from Access, you now choose from ribbon "External" data, and then import and link group - choose ODBC.
the wizard to connect will start. choose "link to the data source".
At this point, the panels that start to launch are the same one you see if you try to use the ODBC manager from the control panel - but in most cases this road is better, since Access will correctly launch the x32 or x64 bit ODBC manager (it makes this correct decision for you).
So you be at a DSN name, but just hit new. Now you have to choose a ODBC (for sql server) driver.
For now, I would try "SQL server". You can choose SQL Server Native Client 11 (or later if you see). Either one is fine. Just keep in future mind that SQL Server driver choice exists on all computers - so for future distribution to other workstations, this is a good choice. The native 11 (or later) driver is NOT installed by default, and you have to install this on other workstations if you want to use that driver if you move or distribute your application to other workstations.
Next, and now you can enter a name for this connection (myTestcon or whatever). Hit finish.
You should now see/be at this screen:
The dropdown for the server name SHOULD appear and work (it make take 30 seconds). So, it should show you a server name, and a sql instance.
Next, and now you have to choose the type of logon
Because this is a local stand alone computer? Well, you can choose windows logons, or sql logons. Being a local computer - choose the default - windows auth.
Next.
NOW VERY VERY important - make sure you change/select the correct database here - SO MANY skip or miss this - and that's painful!!
This one:
So make sure you select/change the default from "master" to your database you created when you sent the data to sql server.
Next - (you can try the test data source). "ok".
Now you are back to the VERY same starting panel. Your "name" should be defaulted for the file connection. This:
So, now just click ok.
You can then select the tables you want to link to.
Nothing important or fancy, I am creating a demo jpeg in SQL Server and don't want to take the extra step of having to launch mspaint directly after running my script in order to see it. It would be nice if the script could just do the launching for me.
I have seen a number of posts on this subject and it looks like xp_cmdshell won't work for a UI-based app. Does anybody know of any way within a simple T-SQL script to launch notepad or mspaint or any other UI-based app without having to resort to SSIS or ServiceBroker? TIA
I am demo-ing SQL Server R services for my users group and outputting a plot of a machine learning algorithm
If I understand you correctly you want to show result from SQL Server R Services (during demo). I would recommend to install SSMS Boost for SSMS and use SSMS ResultGrid Visualizers:
Image from: http://www.ssmsboost.com/Content/images/Feature/ssms-add-in-results-grid-visualizers.png
Sample:
present TSQL/R script
execute it
visualize varbinary data(jpeg)
I created a wpf application which connect to some sql database tables.
When i run this application on my pc every thing works fine,but when i try to run it from other pc on the local network i got an error: "The file ("file name") is on a network path that is not supported for database files".
What is the best way to create a WPF application that have to run from some pc's on the local network that share a common DB?
Have you considered a database server, SQL Server, MySQL, or something similar? If you really want to stick to a file based database (something I wouldn't recommend for security reasons) then you can use something like SQLite.
You will only be able to connect to your server (your pc in this case) instance from another pc if you have 'named pipes' enabled. You can also enable TCP\IP etc. if needs be, but this is probably why you are getting the error.
Named Pipes is not available in the Compact or Free versions of MSSQL.
A database server or pc with a proper version of MSSQL is your best bet.
yepppp solved.
Thanks for your answers.
I did some things that finally solved my problem:
1. Remove the "uid=Tomer, pwd=, and pooling=False" from the connection string.
2. Enable Port 1433(sql port) in the firewall.
3. Enable the TCP/IP and the 'named pipes' as i mentioned before.
Thanks alot for your help.
Vista just finished one of its many updates. After restarting my computer I try connecting to SqlServer2008 instance with Sql Server Management Studio and I get this error:
Error connecting to '...\MSSQLSERVER2008'.
Additional information:
Login failed for user '...'. Reason: Server is in script upgrade mode. Only administrator can connect at this time. (Microsoft SQL Server, Error: 18401).
Pressing help gets me to an internet page saying there's no additional information.
Thx Vista & Updates. Anyone an idea because on the internet I can't find anything about this issue.
It appears This Guy was having the same problems as you and his only suggestion was to wait a few minutes before trying to log in again.
I have yet to see any type of Microsoft documentation about this, nor have I seen any forum posts which came to any sort of resolution concerning the same problem.
Check your event viewer. I had the same problem and found that (in my case) it was looking for a directory that didn't exist to perform an upgrade script. NO hint that there was any sort of problem in the dialog, but the event viewer showed clearly what the problem was.
jim
I had the same problem. Waiting until update was done did not help. Solution was, (after checking Windows eventlog) to set the folder rights. SQL-Express had no rights on the database folder, why ever. Something has mixed up the rights during the upgrade from WinXP to Win 7. That was it.
Adding a comment to this page since this is the top Google result for "script upgrade mode". It seems that a number of things can cause a SQL Server DB to go into this mode. In our shop we've run into these two cases in the past months:
Log shipping - Can't recall at what point of the process exactly the DB went into this mode, iirc it was when bringing it back up. The solution was just to wait it out.
Hard drive full - The DB went into this mode when it ran out of space. We're currently clearing up the drive, will come back with an update if waking it up turns out to be challenging.
Update: After freeing up disk space, it was a simple matter of setting the DB "Offline" and then "Online" to bring it back up.
We had the same issue, but needed to know what was going on in the background.
The db's were put into recovery mode, hence they had to recover. To assist we went to the SQL Server error log located where the system files (normally master, model, msdb...) are located, but under the log folder. In the ERRORLOG, we did a find on the word recovery and could watch the db's percentage recovered. Everything recovered normally, but it was much longer than expected.
The Reason for this is that the system reboot happens with important\necesssary softwares loaded and does all other operation later so that the booting happens faster.
Here in your case, the sql booting is happening as the start of SQL is not needed for system to start. I hope you are aware of DAC account(Dedicated Administrator Connection, Link) who has seperate connectivity and has ability to resolve issues even the whole SQL server is not responing. The SQL server is asking you either to wait or open the SQL with DAC account and stop the SQL update.
Solutions:
1) Wait until backround update completes
2) Open SQL using DAC account and kill all running processes
I have a program that runs osql.exe from microsoft sql server tools directory and runs a script.
The problem is that on computers that don't have an installation of sql server, this tool is missing. So my question is whether or not is possible to run it as a standalone( along with any dll that may be required ) meaning that run them from Process.Start from a local directory of the application.
Yes, you can. Just copy the binary and off you go.
Why are you spawning osql?
I've written simple programs to execute scripts using SMO - mostly insired by this post.
EDIT
The jist of the post is to use SQL Server Management Objects (SMO). Server.ConnectionContext.ExecuteNonQuery parses SQL with GO statements in it.