How do you manually start SQL Server 2014? - sql-server

During installation, I opted for manual startup of my SQL Server 2014 instance. The official MS documentation states that you should enter the following command into a command prompt to start it:
sqlservr
I tried that, as well as
sqlservr.exe
However, the command is not recognized, and running the command prompt in administrator mode doesn't work either. How do I manually start SQL Server 2014?

Generally you should use net start MSSQLSERVER command to run service, and not executable file you've mentioned.
In most cases, the sqlservr.exe program is only used for troubleshooting or major maintenance.
Also it makes sense where exactly this executable is located.
For the default instance, run sqlservr from the \MSSQL\Binn directory. For a named instance, run sqlservr from the \MSSQL$instance_name\Binn directory.
When SQL Server is started from the command prompt with sqlservr.exe, SQL Server does not start as a service, so you cannot stop SQL Server using net commands.
See MSDN article about starting and stopping SQL Server and sqlservr.exe related article.

Related

SQL Server Agent fails some SSIS jobs

I've been tasked with deploying a handful of SSIS packages on Microsoft SQL Server 2012 Enterprise 64-bit (11.0.6020.0) running on Windows Server 2012 R2.
The packages run perfectly when run from SQL Management Studio by right-clicking the package and clicking execute with the proper parameters.
However, when I schedule them to run under the SQL Server Agent, some of them fail. I have not been able to identify any pattern that distinguishes the failing packages from the working packages.
All of the packages are run using a, probably unconventional, approach which involves creating the job step in the job as a Operating system (CmdExec) step rather than a SQL Server Integration Services Package step. This is because the packages depend on access to a particular SMB share and must have credentials provided first to access this share. The CmdExec step calls a wrapper batch file and passes the package name and the environment reference for dtexec to run the package.
Here's the file bat file:
set ETL_PACKAGE=%1
set ETL_ENV_REF=%2
net use \\remote-share.some-domain.local\dropfolder\in /user:ssisagent mypassword
dtexec /Envreference %ETL_ENV_REF% /ISSERVER \SSISDB\%ETL_PACKAGE%
if "%errorlevel%"=="1" (
exit /b %errorlevel%
)
When the agent runs these jobs by rightclicking the job and selecting "Start Job at Step..." the job is started succesfully, but when you pull an execution report it fails with this error:
Message Source Name: Transact-SQL stored procedure
Operation is not valid due to the current state of the object.;
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ISServerExecutionEvents.LoadPackage(PackageItem item)
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.StartPackage()
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.PerformOperation()
I would appreciate ANY idea about what could possibly cause this error or how I can troubleshoot it to narrow down the causes.
I have tried setting up a proxy account using my own admininstrator credentials to rule out possible permission issues, but it doesn't change a thing. I have checked permissions on the SSIS environment used, but that doesn't change anything.
The packages in question interact with DB2, MS SQL and various fileshares with CSV/XML files.

How to autostart and instance of MSSQLLocalDB (Microsoft SQL Express 2016)

Is is possible to autostart an instance of the Microsoft SQL Server Express 2016.
This is currently on a Windows 10 system.
When I run sqllocaldb.exe info I get:
command line screenshot
Everything works fine, except that I have to manually start it everytime.
*for those wanting to know how to do this the command line string is
command line screenshot starting MSSQLLocalDB
Or if you cannot see that picture then: sqllocaldb start mssqllocaldb
Reiterating my question: Is it possible to start this at system boot up?
Make a batch file containing only the command starting SQL Server Express and add a shortcut to it in the Windows Startup folder.
Details about how to auto start an executable when booting Windows can be found for instance here: https://www.howtogeek.com/208224/how-to-add-programs-files-and-folders-to-system-startup-in-windows-8.1/

Connect to localdb with sql-cli

There is the sql-cli utlity (installed with npm) which I am using to connect to various SQL Server machines. It works perfectly, however when connecting to localdb it responds with an error. So the next command line works:
mssql -s SomeServerAddress
But this one doesnt work:
mssql -s (localdb)\v11.0
And it responds with
\v11.0 was unexpected at this time.
Is there any special formatting for the server name to work?
Thanks.
its because (localdb)\v11.0 is not an actual instance as it can only be used inside visual studio.
"The localdb is at the heart of SSDT; it’s similar to SQL Server Express under the hood and runs a full version of sqlserver.exe. However this is throttled by the numbers of CPUs and limits on resources. There are quite a lot of limitations; you cannot upgrade the instance and there is no management and the sqlserver.exe does not run as a service. It is not similar to SQL Server Compact as this is feature-less (no stored procedures or functions) it is actually a DLL file that runs in a process from within Visual Studio, but is not available to task manager or windows. It is awakened when the SQL Server Native Client requests a connection from within Visual Studio. It doesn't stay online forever, it shuts down after time. You can configure where it creates the SQL files required to run. The localdb does not support table partitioning or data compression at the moment. However there are not many features that it does not support. You can however configure SSDT to use a full version of SQL Server i.e. the Developer edition, if your project requires unsupported features; by changing the Debug Connections tring in the projects properies." - Andrew J Fenna
This works:
mssql-cli -E -S (localdb)\mssqllocaldb
The -E is for integrated auth, the -S is the server.
If it does not connect, try to start localdb:
sqllocaldb start mssqllocaldb
This is all that is needed. No need to start Visual Studio or any other tool.
You may alreaady have gone on to bigger and better things, but
mssql -s "(localdb)\MSSQLLocalDB"
has worked for me.
Regards

Timed Script Function

I want to run a daily script file on a Windows based SQL server. Currently I'm running it on a Linux machine so all I have to type is: "./MyScript.sh" and it runs once.
I'm not familiar with SQL Servers, not really sure if they have a terminal similar to Linux. Does anyone know how I would get this script to run everyday at 7:30am on a 2008 SQL server? Could I just enter a command into a terminal of sorts and still use the terminal for other tasks? I believe I don't have access to Crontab.
Thanks for your time!
For a terminal of sorts you could use cmd.exe (Start / Run / cmd.exe) and then use sqlcmd; sqlcmd /? will show the many options. You could then create a batch file that could be scheduled with the Windows Task Scheduler
Or as M.Ali says, if you are running an edition and version of SQL that has the SQL Server Agent, add jobs using Sql Server Management Studio.

Error in Commandline Installation of SQL Server 2005 Express SP 3

I am facing a strange issue while installing SQL Server Express 2005 on Windows XP SP3 (German OS) machine.
PFB the description:
I am performing a silent installation of SQL Server 2005 via a .bat file.
The installation command is as following :
start /wait Setup.exe /qn INSTANCENAME=<instance name> ADDLOCAL=SQL_Engine SAPWD="strong password>" SECURITYMODE=SQL SQLACCOUNT="NT-AUTORITÄT\SYSTEM" DISABLENETWORKPROTOCOLS=0 TARGETDIR="C:\Program Files\Microsoft SQL Server \"
The SQLACCOUNT parameter is derived at run-time be checking the language of the OS. In English, it is "NT AUTHORITY\SYSTEM" .In German, it is "NT-AUTORITÄT\SYSTEM"
If I provide the above command directly to the command line, then installation is successful. But, if I put the same command in the bat file, then installation fails.
The reason for failure mentioned in the log files is that the system is not able to recognize the local system account.
In the log files, I checked that when the passed parameter is "NT-AUTORITÄT\SYSTEM" then, SQL logs contain the name of the parameter as "NT-AUTORIT-T\SYSTEM".
This parameter is invalid and hence, the installation is failing.
I also tried providing the ".\LocalSystem" as the parameter but, still installation fails.
Please Note:
I faced a similar issue while installing SQL Server 2008 Express on the same machine.
I changed the installation command from "NT-AUTORITÄT\SYSTEM" to "NT AUTHORITY\SYSTEM", then the issue was solved.

Resources